ofproto: per-table statistics
[cascardo/ovs.git] / tests / ofproto-dpif.at
1 AT_BANNER([ofproto-dpif])
2
3 AT_SETUP([ofproto-dpif, active-backup bonding])
4 # Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
5 #    and br1 with interfaces p3, p4 and p8.
6 # toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
7 OVS_VSWITCHD_START(
8   [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
9    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
10    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
11    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
12    add-br br1 -- \
13    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
14    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
15                   fail-mode=secure -- \
16    add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
17    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
18    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
19 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
20
21 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
22 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
23 ovs-appctl netdev-dummy/set-admin-state up
24 ovs-appctl time/warp 100
25 ovs-appctl netdev-dummy/set-admin-state p2 down
26 ovs-appctl time/stop
27 ovs-appctl time/warp 100
28 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)'])
29 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)'])
30 ovs-appctl time/warp 100
31 ovs-appctl netdev-dummy/set-admin-state p2 up
32 ovs-appctl netdev-dummy/set-admin-state p1 down
33 ovs-appctl time/warp 100
34 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)'])
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: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)'])
36 ovs-appctl time/warp 100
37 ovs-appctl time/warp 100
38 sleep 1
39 AT_CHECK([cat ovs-vswitchd.log | grep 'in_port([[348]])' | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
40 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),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/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
41 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),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.3/0.0.0.0,dst=10.0.0.4/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
42 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0d),eth_type(0x0800),ipv4(src=10.0.0.5/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
43 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0e),eth_type(0x0800),ipv4(src=10.0.0.6/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
44 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(4),eth(src=50:54:00:00:00:09,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035),arp(sip=0.0.0.0/0.0.0.0,tip=0.0.0.0/0.0.0.0,op=3/0,sha=50:54:00:00:00:09/00:00:00:00:00:00,tha=50:54:00:00:00:09/00:00:00:00:00:00), actions: <del>
45 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(4),eth(src=50:54:00:00:00:0b,dst=ff:ff:ff:ff:ff:ff),eth_type(0x8035),arp(sip=0.0.0.0/0.0.0.0,tip=0.0.0.0/0.0.0.0,op=3/0,sha=50:54:00:00:00:0b/00:00:00:00:00:00,tha=50:54:00:00:00:0b/00:00:00:00:00:00), actions: <del>
46 ])
47 OVS_VSWITCHD_STOP
48 AT_CLEANUP
49
50 AT_SETUP([ofproto-dpif, balance-slb bonding])
51 # Create br0 with interfaces bond0(p1, p2, p3) and p7,
52 #    and br1 with interfaces p4, p5, p6 and p8.
53 #    p1 <-> p4, p2 <-> p5, p3 <-> p6
54 # Send some traffic, make sure the traffic are spread based on source mac.
55 OVS_VSWITCHD_START(
56   [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
57    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
58    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
59    set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
60    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
61    add-br br1 -- \
62    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
63    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
64                   fail-mode=secure -- \
65    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
66    add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
67    add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
68    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
69
70 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
71 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
72 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
73 ])
74 ovs-appctl netdev-dummy/set-admin-state up
75 ovs-appctl time/stop
76 ovs-appctl time/warp 100
77 (
78 for i in `seq 0 100 |xargs printf '%02x\n'`;
79     do
80     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)"
81     AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
82     done
83 )
84 ovs-appctl time/warp 100
85 AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
86 # Make sure there is resonable distribution to all three ports.
87 # We don't want to make this check precise, in case hash function changes.
88 AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
89 AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
90 AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
91 OVS_VSWITCHD_STOP
92 AT_CLEANUP
93
94 AT_SETUP([ofproto-dpif, balance-tcp bonding])
95 # Create br0 with interfaces bond0(p1, p2, p3) and p7,
96 #    and br1 with interfaces bond1(p4, p5, p6) and p8.
97 #    bond0 <-> bond1
98 # Send some traffic, make sure the traffic are spread based on L4 headers.
99 OVS_VSWITCHD_START(
100   [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
101         other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
102    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
103    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
104    set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
105    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
106    add-br br1 -- \
107    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
108    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
109                   fail-mode=secure -- \
110    add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
111         other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
112    set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
113    set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
114    set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
115    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
116 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
117 ])
118 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
119 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
120 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
121 ], [])
122 sleep 1;
123 ovs-appctl time/stop
124 ovs-appctl time/warp 100
125 ovs-appctl lacp/show > lacp.txt
126 ovs-appctl bond/show > bond.txt
127 (
128 for i in `seq 0 255` ;
129     do
130     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(0x010)"
131     AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
132     done
133 )
134 ovs-appctl time/warp 100
135 ovs-appctl time/warp 100
136 ovs-appctl time/warp 100
137 AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
138 AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
139 # Make sure there is resonable distribution to all three ports.
140 # We don't want to make this check precise, in case hash function changes.
141 AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
142 AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
143 AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
144 OVS_VSWITCHD_STOP()
145 AT_CLEANUP
146
147 AT_SETUP([ofproto-dpif - resubmit])
148 OVS_VSWITCHD_START
149 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13], [14], [15],
150                     [16], [17], [18], [19], [20], [21])
151 AT_DATA([flows.txt], [dnl
152 table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
153 table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
154 table=0 in_port=3 priority=2000 icmp actions=output(20)
155 table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
156 table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
157 table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
158 ])
159 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
160 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])
161 AT_CHECK([tail -1 stdout], [0],
162   [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
163 ])
164 OVS_VSWITCHD_STOP
165 AT_CLEANUP
166
167 AT_SETUP([ofproto-dpif - goto table])
168 OVS_VSWITCHD_START
169 ADD_OF_PORTS([br0], [1], [10], [11])
170 echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
171 for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
172 echo "table=64 actions=output(11)" >> flows.txt
173 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
174 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])
175 AT_CHECK([tail -1 stdout], [0],
176   [Datapath actions: 10,11
177 ])
178 OVS_VSWITCHD_STOP
179 AT_CLEANUP
180
181 AT_SETUP([ofproto-dpif - write actions])
182 OVS_VSWITCHD_START
183 ADD_OF_PORTS([br0], [1], [10], [11], [12], [13])
184 AT_DATA([flows.txt], [dnl
185 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
186 table=1 ip actions=write_actions(output(13)),goto_table(2)
187 table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
188 ])
189 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
190 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])
191 AT_CHECK([tail -2 stdout], [0],
192   [Megaflow: recirc_id=0,skb_priority=0,icmp,in_port=1,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128
193 Datapath actions: 10,set(ipv4(src=192.168.3.91,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),11,set(ipv4(src=192.168.3.90,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),13
194 ])
195 OVS_VSWITCHD_STOP
196 AT_CLEANUP
197
198 AT_SETUP([ofproto-dpif - clear actions])
199 OVS_VSWITCHD_START
200 ADD_OF_PORTS([br0], [1], [10], [11], [12])
201 AT_DATA([flows.txt], [dnl
202 table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
203 table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
204 ])
205 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
206 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])
207 AT_CHECK([tail -2 stdout], [0],
208   [Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_frag=no,tp_src=8,tp_dst=9
209 Datapath actions: 10,set(tcp(src=91,dst=9)),11
210 ])
211 OVS_VSWITCHD_STOP
212 AT_CLEANUP
213
214 AT_SETUP([ofproto-dpif - group chaining not supported])
215 OVS_VSWITCHD_START
216 ADD_OF_PORTS([br0], [1], [10], [11])
217 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'],
218   [1], [], [stderr])
219 AT_CHECK([STRIP_XIDS stderr | sed 1q], [0],
220   [OFPT_ERROR (OF1.2): OFPGMFC_CHAINING_UNSUPPORTED
221 ])
222 OVS_VSWITCHD_STOP
223 AT_CLEANUP
224
225 AT_SETUP([ofproto-dpif - all group in action list])
226 OVS_VSWITCHD_START
227 ADD_OF_PORTS([br0], [1], [10], [11])
228 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'])
229 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
230 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])
231 AT_CHECK([tail -2 stdout], [0],
232   [Megaflow: recirc_id=0,skb_priority=0,icmp,in_port=1,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128
233 Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),11
234 ])
235 OVS_VSWITCHD_STOP
236 AT_CLEANUP
237
238 AT_SETUP([ofproto-dpif - indirect group in action list])
239 OVS_VSWITCHD_START
240 ADD_OF_PORTS([br0], [1], [10])
241 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
242 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
243 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])
244 AT_CHECK([tail -1 stdout], [0],
245   [Datapath actions: 10
246 ])
247 OVS_VSWITCHD_STOP
248 AT_CLEANUP
249
250 AT_SETUP([ofproto-dpif - all group in action set])
251 OVS_VSWITCHD_START
252 ADD_OF_PORTS([br0], [1], [10], [11])
253 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'])
254 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
255 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])
256 AT_CHECK([tail -2 stdout], [0],
257   [Megaflow: recirc_id=0,skb_priority=0,icmp,in_port=1,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=128
258 Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no)),11
259 ])
260 OVS_VSWITCHD_STOP
261 AT_CLEANUP
262
263 AT_SETUP([ofproto-dpif - indirect group in action set])
264 OVS_VSWITCHD_START
265 ADD_OF_PORTS([br0], [1], [10])
266 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
267 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
268 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])
269 AT_CHECK([tail -1 stdout], [0],
270   [Datapath actions: 10
271 ])
272 OVS_VSWITCHD_STOP
273 AT_CLEANUP
274
275 AT_SETUP([ofproto-dpif - select group])
276 OVS_VSWITCHD_START
277 ADD_OF_PORTS([br0], [1], [10], [11])
278 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
279 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
280
281 # Try a bunch of different flows and make sure that they get distributed
282 # at least somewhat.
283 for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
284     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])
285     tail -1 stdout >> results
286 done
287 sort results | uniq -c
288 AT_CHECK([sort results | uniq], [0],
289   [Datapath actions: 10
290 Datapath actions: 11
291 ])
292 OVS_VSWITCHD_STOP
293 AT_CLEANUP
294
295 AT_SETUP([ofproto-dpif - select group with watch port])
296 OVS_VSWITCHD_START
297 ADD_OF_PORTS([br0], [1], [10], [11])
298 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
299 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
300 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])
301 AT_CHECK([tail -1 stdout], [0],
302   [Datapath actions: 11
303 ])
304 OVS_VSWITCHD_STOP
305 AT_CLEANUP
306
307 AT_SETUP([ofproto-dpif - select group with weight])
308 OVS_VSWITCHD_START
309 ADD_OF_PORTS([br0], [1], [10], [11], [12])
310 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'])
311 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
312 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])
313 AT_CHECK([tail -1 stdout], [0],
314   [Datapath actions: 11
315 ])
316 OVS_VSWITCHD_STOP
317 AT_CLEANUP
318
319 AT_SETUP([ofproto-dpif - fast failover group])
320 OVS_VSWITCHD_START
321 ADD_OF_PORTS([br0], [1], [10], [11])
322 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'])
323 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
324 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])
325 AT_CHECK([tail -1 stdout], [0],
326   [Datapath actions: drop
327 ])
328 OVS_VSWITCHD_STOP
329 AT_CLEANUP
330
331 AT_SETUP([ofproto-dpif - group stats single bucket])
332 OVS_VSWITCHD_START
333 ADD_OF_PORTS([br0], [1], [10], [11])
334 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
335 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
336 (
337 for i in `seq 0 2`;
338     do
339     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)"
340     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
341     done
342 )
343 ovs-appctl time/warp 100
344 sleep 1  # wait for forwarders process packets
345 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
346 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
347  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
348 OFPST_GROUP reply (OF1.2):
349 ])
350 OVS_VSWITCHD_STOP
351 AT_CLEANUP
352
353 AT_SETUP([ofproto-dpif - group stats all buckets])
354 OVS_VSWITCHD_START
355 ADD_OF_PORTS([br0], [1], [10], [11])
356 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
357 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
358 (
359 for i in `seq 0 2`;
360     do
361     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)"
362     AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
363     done
364 )
365 ovs-appctl time/warp 100
366 sleep 1  # wait for forwarders process packets
367 AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
368 AT_CHECK([STRIP_XIDS stdout | sort], [0], [dnl
369  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
370 OFPST_GROUP reply (OF1.2):
371 ])
372 OVS_VSWITCHD_STOP
373 AT_CLEANUP
374
375 AT_SETUP([ofproto-dpif - registers])
376 OVS_VSWITCHD_START
377 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
378 AT_DATA([flows.txt], [dnl
379 in_port=90                 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
380 in_port=91                 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
381 in_port=92                 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
382 in_port=93                 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
383
384 in_port=2                  actions=load:0x000db000->NXM_NX_REG0[[]]
385 in_port=3                  actions=load:0xdea->NXM_NX_REG0[[20..31]]
386 in_port=4                  actions=load:0xeef->NXM_NX_REG0[[0..11]]
387 in_port=5                  actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
388 in_port=6                  actions=load:0x22222222->NXM_NX_REG2[[]]
389 in_port=7                  actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
390 in_port=8                  actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
391 in_port=9,reg0=0xdeadbeef  actions=output:20
392 in_port=10,reg1=0xdeadbeef actions=output:21
393 in_port=11,reg2=0xeef22dea actions=output:22
394
395 dnl Sanilty check all registers
396 in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
397 in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
398 in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
399 in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
400
401 ])
402 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
403 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])
404 AT_CHECK([tail -1 stdout], [0],
405   [Datapath actions: 20,21,22,33
406 ])
407 OVS_VSWITCHD_STOP
408 AT_CLEANUP
409
410 AT_SETUP([ofproto-dpif - push-pop])
411 OVS_VSWITCHD_START
412 ADD_OF_PORTS([br0], [20], [21], [22], [33], [90])
413 AT_DATA([flows.txt], [dnl
414 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
415 in_port=2            actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
416 in_port=3            actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
417 in_port=4            actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
418 in_port=5            actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
419
420 ])
421 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
422 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])
423 AT_CHECK([tail -1 stdout], [0],
424   [Datapath actions: 33,22,21,20
425 ])
426 OVS_VSWITCHD_STOP
427 AT_CLEANUP
428
429 AT_SETUP([ofproto-dpif - output])
430 OVS_VSWITCHD_START
431 ADD_OF_PORTS([br0], [1], [9], [10], [11], [55], [66], [77], [88])
432 AT_DATA([flows.txt], [dnl
433 in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
434 in_port=2 actions=output:9
435 in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
436 in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
437 in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
438 in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
439 in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
440 in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
441 ])
442 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
443 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])
444 AT_CHECK([tail -1 stdout], [0],
445   [Datapath actions: 9,55,10,55,66,11,77,88,9,1
446 ])
447 OVS_VSWITCHD_STOP
448 AT_CLEANUP
449
450 AT_SETUP([ofproto-dpif - dec_ttl])
451 OVS_VSWITCHD_START
452 ADD_OF_PORTS([br0], [1], [2], [3], [4])
453 AT_DATA([flows.txt], [dnl
454 table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
455 table=1 in_port=1 action=dec_ttl,output:3
456 ])
457 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
458 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])
459 AT_CHECK([tail -4 stdout], [0],
460   [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=1,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=2
461 Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=1,frag=no)),2,4
462 This flow is handled by the userspace slow path because it:
463         - Sends "packet-in" messages to the OpenFlow controller.
464 ])
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=111,tos=0,ttl=3,frag=no)'], [0], [stdout])
466 AT_CHECK([tail -2 stdout], [0],
467   [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=1,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=111,nw_tos=0,nw_ecn=0,nw_ttl=3
468 Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=2,frag=no)),2,set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=111,tos=0,ttl=1,frag=no)),3,4
469 ])
470 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])
471 AT_CHECK([tail -2 stdout], [0],
472   [Megaflow: recirc_id=0,skb_priority=0,ipv6,in_port=1,ipv6_src=::1,ipv6_dst=::2,ipv6_label=0x00000,nw_proto=10,nw_tos=112,nw_ecn=0,nw_ttl=128
473 Datapath actions: set(ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=127,frag=no)),2,set(ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=126,frag=no)),3,4
474 ])
475
476 AT_CAPTURE_FILE([ofctl_monitor.log])
477 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
478 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])
479 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
480 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
481 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
482 ip,metadata=0,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
483 ])
484 OVS_VSWITCHD_STOP
485 AT_CLEANUP
486
487 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
488 dnl buffer to be resized just before pushing the id of the dec_ttl action.
489 dnl Thus the implementation must account for this by using the
490 dnl reallocated buffer rather than the original buffer.
491 dnl
492 dnl A number of similar rules are added to try and exercise
493 dnl xrealloc sufficiently that it returns a different base pointer
494 AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
495 OVS_VSWITCHD_START
496 ADD_OF_PORTS([br0], [1])
497 (for i in `seq 0 255`; do
498   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
499  done) > flows.txt
500 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
501 OVS_VSWITCHD_STOP
502 AT_CLEANUP
503
504 dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
505 dnl buffer to be resized just before pushing the id of the dec_ttl action.
506 dnl Thus the implementation must account for this by using the
507 dnl reallocated buffer rather than the original buffer.
508 dnl
509 dnl A number of similar rules are added to try and exercise
510 dnl xrealloc sufficiently that it returns a different base pointer
511 AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
512 OVS_VSWITCHD_START
513 ADD_OF_PORTS([br0], [1])
514 (for i in `seq 0 255`; do
515   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
516  done) > flows.txt
517 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
518 OVS_VSWITCHD_STOP
519 AT_CLEANUP
520
521 dnl A note action at offset 24 in ofpacts will cause the ofpacts
522 dnl buffer to be resized just before pushing the id of the dec_ttl action.
523 dnl Thus the implementation must account for this by using the
524 dnl reallocated buffer rather than the original buffer.
525 dnl
526 dnl A number of similar rules are added to try and exercise
527 dnl xrealloc sufficiently that it returns a different base pointer
528 AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
529 OVS_VSWITCHD_START
530 ADD_OF_PORTS([br0], [1])
531 (for i in `seq 0 255`; do
532   printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
533  done) > flows.txt
534 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
535 OVS_VSWITCHD_STOP
536 AT_CLEANUP
537
538 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
539 OVS_VSWITCHD_START
540 ADD_OF_PORTS([br0], [1], [2])
541
542 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
543
544 # "in_port" defaults to OFPP_NONE if it's not specified.
545 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"
546 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
547 AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
548 1
549 2
550 100
551 ])
552
553 OVS_VSWITCHD_STOP
554 AT_CLEANUP
555
556 AT_SETUP([ofproto-dpif - DSCP])
557 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
558 ADD_OF_PORTS([br0], [9])
559 AT_DATA([flows.txt], [dnl
560 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
561 ])
562 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
563 AT_CHECK([ovs-vsctl -- \
564         set Port p1 qos=@newqos --\
565         --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
566         --id=@q1 create Queue dscp=1 --\
567         --id=@q2 create Queue dscp=2], [0], [ignore])
568 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])
569 AT_CHECK([tail -2 stdout], [0],
570   [Megaflow: recirc_id=0,skb_priority=0,icmp,in_port=9,nw_src=1.1.1.1,nw_dst=2.2.2.2,nw_tos=252,nw_ecn=3,nw_ttl=128
571 Datapath actions: dnl
572 100,dnl
573 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(skb_priority(0x1)),1,dnl
574 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xb,ttl=128,frag=no)),set(skb_priority(0x2)),1,dnl
575 1,dnl
576 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(skb_priority(0x1)),1,dnl
577 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no)),set(skb_priority(0)),1,dnl
578 set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x3,ttl=128,frag=no)),1,dnl
579 100
580 ])
581 OVS_VSWITCHD_STOP
582 AT_CLEANUP
583
584 AT_SETUP([ofproto-dpif - output/flood flags])
585 OVS_VSWITCHD_START
586 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [7])
587
588 AT_DATA([flows.txt], [dnl
589 in_port=local actions=local,flood
590 in_port=1 actions=flood
591 in_port=2 actions=all
592 in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
593 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
594 ])
595 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
596 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
597 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
598
599 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])
600 AT_CHECK([tail -1 stdout \
601 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
602 1
603 2
604 3
605 4
606 7
607 ])
608
609 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])
610 AT_CHECK([tail -1 stdout \
611 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
612 100
613 2
614 3
615 4
616 7
617 ])
618
619 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])
620 AT_CHECK([tail -1 stdout \
621 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
622 1
623 100
624 3
625 4
626 6
627 7
628 ])
629
630 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])
631 AT_CHECK([tail -1 stdout], [0],
632   [Datapath actions: 100,1,2,4,6,7
633 ])
634
635 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])
636 AT_CHECK([tail -1 stdout], [0],
637   [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
638 ])
639 OVS_VSWITCHD_STOP
640 AT_CLEANUP
641
642 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
643 OVS_VSWITCHD_START([dnl
644    add-port br0 p1 -- set Interface p1 type=dummy
645 ])
646 ON_EXIT([kill `cat ovs-ofctl.pid`])
647
648 AT_CAPTURE_FILE([ofctl_monitor.log])
649
650 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
651
652 for i in 1 2 3 ; do
653     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)'
654 done
655 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
656 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
657 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
658 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
659 tcp,metadata=0,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=0x010 tcp_csum:0
660 dnl
661 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
662 tcp,metadata=0,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=0x010 tcp_csum:0
663 dnl
664 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
665 tcp,metadata=0,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=0x010 tcp_csum:0
666 ])
667
668 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
669 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
670 NXST_FLOW reply:
671 ])
672
673 OVS_VSWITCHD_STOP
674 AT_CLEANUP
675
676 AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
677 OVS_VSWITCHD_START([dnl
678    add-port br0 p1 -- set Interface p1 type=dummy
679 ])
680 ON_EXIT([kill `cat ovs-ofctl.pid`])
681
682 AT_CAPTURE_FILE([ofctl_monitor.log])
683 AT_CHECK([ovs-ofctl del-flows br0])
684
685 AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
686
687 dnl Test that missed packets are droped
688 for i in 1 2 3 ; do
689     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)'
690 done
691 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
692
693 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
694 ])
695
696 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
697 AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
698 OFPST_FLOW reply (OF1.3):
699 ])
700
701 OVS_VSWITCHD_STOP
702 AT_CLEANUP
703
704 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
705 OVS_VSWITCHD_START([dnl
706    add-port br0 p1 -- set Interface p1 type=dummy
707 ])
708 ON_EXIT([kill `cat ovs-ofctl.pid`])
709
710 AT_CAPTURE_FILE([ofctl_monitor.log])
711 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
712
713 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
714
715 for i in 1 2 3 ; do
716     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)'
717 done
718 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
719 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
720 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
721 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
722 tcp,metadata=0,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=0x010 tcp_csum:0
723 dnl
724 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
725 tcp,metadata=0,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=0x010 tcp_csum:0
726 dnl
727 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
728 tcp,metadata=0,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=0x010 tcp_csum:0
729 ])
730
731 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
732 sleep 1  # wait for revalidator to update stats
733 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
734  n_packets=3, n_bytes=180, actions=goto_table:1
735 OFPST_FLOW reply (OF1.2):
736 ])
737
738 OVS_VSWITCHD_STOP
739 AT_CLEANUP
740
741 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
742 OVS_VSWITCHD_START([dnl
743    add-port br0 p1 -- set Interface p1 type=dummy
744 ])
745 ON_EXIT([kill `cat ovs-ofctl.pid`])
746
747 AT_CAPTURE_FILE([ofctl_monitor.log])
748 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
749
750 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
751
752 for i in 1 2 3 ; do
753     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)'
754 done
755
756 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
757 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
758 ])
759
760 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
761 sleep 1  # wait for revalidator to update stats
762 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
763  n_packets=3, n_bytes=180, actions=resubmit(1,1)
764 OFPST_FLOW reply (OF1.2):
765 ])
766
767 OVS_VSWITCHD_STOP
768 AT_CLEANUP
769
770 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
771 OVS_VSWITCHD_START([dnl
772    add-port br0 p1 -- set Interface p1 type=dummy
773 ])
774 ON_EXIT([kill `cat ovs-ofctl.pid`])
775
776 AT_CAPTURE_FILE([ofctl_monitor.log])
777 AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
778 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
779
780 dnl Miss table 0, Hit table 1
781 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
782
783 for i in 1 2 3 ; do
784     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)'
785 done
786 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
787 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
788
789 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
790 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
791 tcp,metadata=0,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=0x010 tcp_csum:0
792 dnl
793 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
794 tcp,metadata=0,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=0x010 tcp_csum:0
795 dnl
796 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
797 tcp,metadata=0,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=0x010 tcp_csum:0
798 ])
799
800 dnl Hit table 0, Miss all other tables, sent to controller
801 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
802
803 for i in 1 2 3 ; do
804     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)'
805 done
806 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
807 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
808
809 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
810 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
811 tcp,metadata=0,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=0x010 tcp_csum:0
812 dnl
813 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
814 tcp,metadata=0,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=0x010 tcp_csum:0
815 dnl
816 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
817 tcp,metadata=0,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=0x010 tcp_csum:0
818 ])
819
820 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
821 sleep 1  # wait for revalidator to update stats
822 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
823  table=1, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
824 OFPST_FLOW reply (OF1.2):
825 ])
826
827 OVS_VSWITCHD_STOP
828 AT_CLEANUP
829
830 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
831 OVS_VSWITCHD_START([dnl
832    add-port br0 p1 -- set Interface p1 type=dummy
833 ])
834 ON_EXIT([kill `cat ovs-ofctl.pid`])
835
836 AT_CAPTURE_FILE([ofctl_monitor.log])
837 AT_DATA([flows.txt], [dnl
838 table=0 actions=goto_table(1)
839 table=2 dl_src=10:11:11:11:11:11 actions=controller
840 ])
841 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
842 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
843
844 dnl Hit table 0, Miss table 1, Hit table 2
845 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
846
847 for i in 1 2 3 ; do
848     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)'
849 done
850 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
851 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
852
853 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
854 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
855 tcp,metadata=0,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=0x010 tcp_csum:0
856 dnl
857 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
858 tcp,metadata=0,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=0x010 tcp_csum:0
859 dnl
860 NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
861 tcp,metadata=0,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=0x010 tcp_csum:0
862 ])
863
864 dnl Hit table 1, Miss all other tables, sent to controller
865 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
866
867 for i in 1 2 3 ; do
868     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)'
869 done
870 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
871 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
872
873 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
874 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
875 tcp,metadata=0,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=0x010 tcp_csum:0
876 dnl
877 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
878 tcp,metadata=0,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=0x010 tcp_csum:0
879 dnl
880 NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
881 tcp,metadata=0,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=0x010 tcp_csum:0
882 ])
883
884 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
885 sleep 1  # wait for revalidator to update stats
886 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
887  n_packets=6, n_bytes=360, actions=goto_table:1
888  table=2, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
889 OFPST_FLOW reply (OF1.2):
890 ])
891
892 OVS_VSWITCHD_STOP
893 AT_CLEANUP
894
895 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
896 OVS_VSWITCHD_START([dnl
897    add-port br0 p1 -- set Interface p1 type=dummy
898 ])
899 ON_EXIT([kill `cat ovs-ofctl.pid`])
900
901 AT_CAPTURE_FILE([ofctl_monitor.log])
902 AT_DATA([flows.txt], [dnl
903 table=0 actions=resubmit(1,1)
904 table=2 dl_src=10:11:11:11:11:11 actions=controller
905 ])
906 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
907 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
908
909 dnl Hit table 0, Miss table 1, Dropped
910 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
911
912 for i in 1 2 3 ; do
913     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)'
914 done
915 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
916
917 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
918 ])
919
920 dnl Hit table 1, Dropped
921 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
922
923 for i in 1 2 3 ; do
924     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)'
925 done
926 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
927
928 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
929 ])
930
931 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
932 sleep 1  # wait for revalidator to update stats
933 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
934  n_packets=6, n_bytes=360, actions=resubmit(1,1)
935  table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
936 OFPST_FLOW reply (OF1.2):
937 ])
938
939 OVS_VSWITCHD_STOP
940 AT_CLEANUP
941
942 AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
943 OVS_VSWITCHD_START([dnl
944    add-port br0 p1 -- set Interface p1 type=dummy
945 ])
946 ON_EXIT([kill `cat ovs-ofctl.pid`])
947
948 AT_CAPTURE_FILE([ofctl_monitor.log])
949 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
950
951 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
952
953 dnl Test that missed packets are droped
954 for i in 1 2 3 ; do
955     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)'
956 done
957 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
958
959 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
960 ])
961
962 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
963 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
964 NXST_FLOW reply:
965 ])
966
967 OVS_VSWITCHD_STOP
968 AT_CLEANUP
969
970 AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
971 OVS_VSWITCHD_START([dnl
972    add-port br0 p1 -- set Interface p1 type=dummy
973 ])
974 ON_EXIT([kill `cat ovs-ofctl.pid`])
975
976 AT_CAPTURE_FILE([ofctl_monitor.log])
977 AT_CHECK([ovs-ofctl del-flows br0])
978 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
979 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
980
981 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
982
983 dnl Test that missed packets are droped
984 for i in 1 2 3 ; do
985     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)'
986 done
987 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
988
989 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
990 ])
991
992 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
993 sleep 1  # wait for revalidator to update stats
994 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
995  n_packets=3, n_bytes=180, actions=goto_table:1
996 OFPST_FLOW reply (OF1.2):
997 ])
998
999 OVS_VSWITCHD_STOP
1000 AT_CLEANUP
1001
1002 AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1003 OVS_VSWITCHD_START([dnl
1004    add-port br0 p1 -- set Interface p1 type=dummy
1005 ])
1006 ON_EXIT([kill `cat ovs-ofctl.pid`])
1007
1008 AT_CAPTURE_FILE([ofctl_monitor.log])
1009 AT_CHECK([ovs-ofctl del-flows br0])
1010 AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1011 AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1012
1013 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1014
1015 dnl Test that missed packets are droped
1016 for i in 1 2 3 ; do
1017     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)'
1018 done
1019 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1020
1021 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1022 ])
1023
1024 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1025 sleep 1  # wait for revalidator to update stats
1026 AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1027  n_packets=3, n_bytes=180, actions=resubmit(1,1)
1028 OFPST_FLOW reply (OF1.2):
1029 ])
1030
1031 OVS_VSWITCHD_STOP
1032 AT_CLEANUP
1033
1034 AT_SETUP([ofproto-dpif - controller])
1035 OVS_VSWITCHD_START([dnl
1036    add-port br0 p1 -- set Interface p1 type=dummy
1037 ])
1038 ON_EXIT([kill `cat ovs-ofctl.pid`])
1039
1040 AT_CAPTURE_FILE([ofctl_monitor.log])
1041 AT_DATA([flows.txt], [dnl
1042 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
1043 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
1044 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1045
1046 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1047 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)
1048 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)
1049 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1050 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)
1051 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1052 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
1053 cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
1054 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
1055 ])
1056 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1057
1058 dnl Flow miss.
1059 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1060
1061 for i in 1 2 3 ; do
1062     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)'
1063 done
1064 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1065 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1066
1067 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1068 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1069 tcp,metadata=0,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=0x010 tcp_csum:0
1070 dnl
1071 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1072 tcp,metadata=0,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=0x010 tcp_csum:0
1073 dnl
1074 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1075 tcp,metadata=0,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=0x010 tcp_csum:0
1076 ])
1077
1078 dnl Singleton controller action.
1079 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1080
1081 for i in 1 2 3 ; do
1082     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)'
1083 done
1084 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1085 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1086
1087 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1088 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1089 tcp,metadata=0,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=0x002 tcp_csum:0
1090 dnl
1091 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1092 tcp,metadata=0,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=0x002 tcp_csum:0
1093 dnl
1094 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1095 tcp,metadata=0,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=0x002 tcp_csum:0
1096 ])
1097
1098 dnl Modified controller action.
1099 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1100
1101 for i in 1 2 3 ; do
1102     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)'
1103 done
1104 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1105 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1106
1107 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1108 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1109 tcp,metadata=0,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=0x001 tcp_csum:0
1110 dnl
1111 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1112 tcp,metadata=0,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=0x001 tcp_csum:0
1113 dnl
1114 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1115 tcp,metadata=0,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=0x001 tcp_csum:0
1116 ])
1117
1118 dnl Modified VLAN controller action.
1119 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1120
1121 for i in 1 2 3; do
1122     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)'
1123 done
1124 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1125 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1126
1127 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1128 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1129 ip,metadata=0,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
1130 dnl
1131 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1132 ip,metadata=0,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
1133 dnl
1134 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1135 ip,metadata=0,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
1136 ])
1137
1138 dnl Checksum TCP.
1139 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1140
1141 for i in 1 ; do
1142     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)'
1143 done
1144 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1145 ovs-appctl -t ovs-ofctl exit
1146
1147 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1148 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1149 tcp,metadata=0,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=0x001 tcp_csum:0
1150 dnl
1151 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
1152 tcp,metadata=0,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=0x001 tcp_csum:0
1153 dnl
1154 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)
1155 tcp,metadata=0,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=0x001 tcp_csum:0
1156 dnl
1157 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)
1158 tcp,metadata=0,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=0x001 tcp_csum:0
1159 dnl
1160 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)
1161 tcp,metadata=0,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=0x001 tcp_csum:1a03
1162 dnl
1163 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)
1164 tcp,metadata=0,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=0x001 tcp_csum:3205
1165 dnl
1166 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)
1167 tcp,metadata=0,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=0x001 tcp_csum:31b8
1168 dnl
1169 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)
1170 tcp,metadata=0,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=0x001 tcp_csum:316d
1171 dnl
1172 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)
1173 tcp,metadata=0,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=0x001 tcp_csum:316d
1174 ])
1175
1176 dnl Checksum UDP.
1177 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1178
1179 for i in 1 ; do
1180     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'
1181 done
1182 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1183 ovs-appctl -t ovs-ofctl exit
1184
1185 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1186 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1187 udp,metadata=0,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
1188 dnl
1189 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 reg0=0x1 (via action) data_len=64 (unbuffered)
1190 udp,metadata=0,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
1191 dnl
1192 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)
1193 udp,metadata=0,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
1194 dnl
1195 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)
1196 udp,metadata=0,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
1197 dnl
1198 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)
1199 udp,metadata=0,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
1200 dnl
1201 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)
1202 udp,metadata=0,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
1203 dnl
1204 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)
1205 udp,metadata=0,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
1206 dnl
1207 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)
1208 udp,metadata=0,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
1209 dnl
1210 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)
1211 udp,metadata=0,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
1212 ])
1213
1214 dnl Modified ARP controller action.
1215 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1216
1217 for i in 1 2 3; do
1218     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)'
1219 done
1220
1221 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1222 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1223 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1224 arp,metadata=0,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
1225 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1226 arp,metadata=0,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
1227 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1228 arp,metadata=0,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
1229 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1230 arp,metadata=0,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
1231 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1232 arp,metadata=0,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
1233 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1234 arp,metadata=0,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
1235 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1236 arp,metadata=0,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
1237 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1238 arp,metadata=0,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
1239 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1240 arp,metadata=0,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
1241 ])
1242
1243 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1244
1245 dnl Checksum SCTP.
1246 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1247
1248 for i in 1 ; do
1249     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'
1250 done
1251
1252 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1253 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1254 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1255 NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
1256 sctp,metadata=0,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
1257 dnl
1258 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 in_port=1 reg0=0x1 (via action) data_len=102 (unbuffered)
1259 sctp,metadata=0,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
1260 dnl
1261 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)
1262 sctp,metadata=0,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
1263 dnl
1264 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)
1265 sctp,metadata=0,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
1266 dnl
1267 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)
1268 sctp,metadata=0,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
1269 dnl
1270 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)
1271 sctp,metadata=0,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
1272 dnl
1273 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)
1274 sctp,metadata=0,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
1275 dnl
1276 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)
1277 sctp,metadata=0,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
1278 dnl
1279 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)
1280 sctp,metadata=0,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
1281 ])
1282
1283 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1284  cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1285  cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1286  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)
1287  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)
1288  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)
1289  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)
1290  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)
1291  cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1292  cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1293  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
1294  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
1295  n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1296 NXST_FLOW reply:
1297 ])
1298
1299 OVS_VSWITCHD_STOP
1300 AT_CLEANUP
1301
1302 AT_SETUP([ofproto-dpif - MPLS handling])
1303 OVS_VSWITCHD_START([dnl
1304    add-port br0 p1 -- set Interface p1 type=dummy
1305 ])
1306 ON_EXIT([kill `cat ovs-ofctl.pid`])
1307
1308 AT_CAPTURE_FILE([ofctl_monitor.log])
1309 AT_DATA([flows.txt], [dnl
1310 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
1311 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
1312 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
1313 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
1314 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
1315 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
1316 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
1317 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
1318 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1319 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1320 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
1321 ])
1322 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1323
1324 dnl Modified MPLS controller action.
1325 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1326
1327 for i in 1 2 3; do
1328     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=16,tos=0,ttl=64,frag=no)'
1329 done
1330 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1331 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1332
1333 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1334 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1335 mpls,metadata=0,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
1336 dnl
1337 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1338 mpls,metadata=0,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
1339 dnl
1340 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1341 mpls,metadata=0,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
1342 ])
1343
1344 dnl Modified MPLS controller action.
1345 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1346
1347 for i in 1 2 3; do
1348     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)'
1349 done
1350 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1351 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1352
1353 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1354 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1355 ip,metadata=0,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
1356 dnl
1357 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1358 ip,metadata=0,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
1359 dnl
1360 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1361 ip,metadata=0,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
1362 ])
1363
1364 dnl Modified MPLS controller action.
1365 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1366
1367 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)
1368
1369 for i in 1 2 3; do
1370     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)'
1371 done
1372 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1373 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1374
1375 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1376 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1377 mpls,metadata=0,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
1378 dnl
1379 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1380 mpls,metadata=0,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
1381 dnl
1382 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1383 mpls,metadata=0,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
1384 ])
1385
1386 dnl Modified MPLS controller action.
1387 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1388
1389 for i in 1 2 3; do
1390     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))'
1391 done
1392 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1393 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1394
1395 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1396 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1397 mpls,metadata=0,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
1398 dnl
1399 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1400 mpls,metadata=0,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
1401 dnl
1402 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1403 mpls,metadata=0,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
1404 ])
1405
1406 dnl Modified MPLS controller action.
1407 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1408
1409 for i in 1 2 3; do
1410     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)'
1411 done
1412 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1413 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1414
1415 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1416 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1417 mpls,metadata=0,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
1418 dnl
1419 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1420 mpls,metadata=0,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
1421 dnl
1422 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1423 mpls,metadata=0,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
1424 ])
1425
1426 dnl Modified MPLS controller action.
1427 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1428
1429 for i in 1 2 3; do
1430     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)'
1431 done
1432 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1433 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1434
1435 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1436 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1437 mpls,metadata=0,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
1438 dnl
1439 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1440 mpls,metadata=0,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
1441 dnl
1442 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1443 mpls,metadata=0,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
1444 ])
1445
1446 dnl Modified MPLS controller action.
1447 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1448
1449 for i in 1 2 3; do
1450     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)'
1451 done
1452 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1453 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1454
1455 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1456 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1457 mpls,metadata=0,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
1458 dnl
1459 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1460 mpls,metadata=0,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
1461 dnl
1462 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1463 mpls,metadata=0,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
1464 ])
1465
1466 dnl Modified MPLS controller action.
1467 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1468
1469 for i in 1 2 3; do
1470     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)'
1471 done
1472 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1473 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1474
1475 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1476 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1477 mpls,metadata=0,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
1478 dnl
1479 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1480 mpls,metadata=0,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
1481 dnl
1482 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1483 mpls,metadata=0,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
1484 ])
1485
1486 dnl Modified MPLS actions.
1487 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1488
1489 for i in 1 2 3; do
1490     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)'
1491 done
1492 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1493 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1494
1495 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1496 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1497 mpls,metadata=0,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
1498 dnl
1499 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1500 mpls,metadata=0,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
1501 dnl
1502 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1503 mpls,metadata=0,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
1504 ])
1505
1506 dnl Modified MPLS ipv6 controller action.
1507 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1508
1509 for i in 1 2 3; do
1510     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)'
1511 done
1512 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1513 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1514
1515 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1516 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1517 mplsm,metadata=0,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
1518 dnl
1519 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1520 mplsm,metadata=0,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
1521 dnl
1522 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1523 mplsm,metadata=0,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
1524 ])
1525
1526
1527 dnl Modified MPLS pop action.
1528 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1529 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)
1530 dnl             (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1531
1532 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1533
1534 for i in 1 2 3; do
1535     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'
1536 done
1537 #for i in 2 3; do
1538 #    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)'
1539 #done
1540 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1541 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1542
1543 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1544 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1545 tcp,metadata=0,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=0x000 tcp_csum:7744
1546 dnl
1547 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1548 tcp,metadata=0,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=0x000 tcp_csum:7744
1549 dnl
1550 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1551 tcp,metadata=0,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=0x000 tcp_csum:7744
1552 ])
1553
1554 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1555
1556 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1557  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
1558  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
1559  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
1560  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
1561  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
1562  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
1563  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
1564  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
1565  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
1566  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
1567  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1568 NXST_FLOW reply:
1569 ])
1570
1571 OVS_VSWITCHD_STOP
1572 AT_CLEANUP
1573
1574
1575 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
1576 OVS_VSWITCHD_START([dnl
1577    add-port br0 p1 -- set Interface p1 type=dummy
1578 ])
1579 ON_EXIT([kill `cat ovs-ofctl.pid`])
1580
1581 AT_CAPTURE_FILE([ofctl_monitor.log])
1582 # A table-miss flow has priority 0 and no match
1583 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
1584
1585 dnl Singleton controller action.
1586 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1587
1588 for i in 1 2 3 ; do
1589     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)'
1590 done
1591 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1592 ovs-appctl -t ovs-ofctl exit
1593
1594 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1595 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1596 tcp,metadata=0,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=0x002 tcp_csum:0
1597 dnl
1598 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1599 tcp,metadata=0,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=0x002 tcp_csum:0
1600 dnl
1601 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1602 tcp,metadata=0,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=0x002 tcp_csum:0
1603 ])
1604
1605 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1606
1607 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1608  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
1609 NXST_FLOW reply:
1610 ])
1611
1612 OVS_VSWITCHD_STOP
1613 AT_CLEANUP
1614
1615
1616 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
1617 OVS_VSWITCHD_START([dnl
1618    add-port br0 p1 -- set Interface p1 type=dummy
1619 ])
1620 ON_EXIT([kill `cat ovs-ofctl.pid`])
1621
1622 AT_CAPTURE_FILE([ofctl_monitor.log])
1623 # A table-miss flow has priority 0 and no match
1624 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
1625
1626 dnl Singleton controller action.
1627 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
1628
1629 for i in 1 2 3 ; do
1630     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)'
1631 done
1632 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1633 ovs-appctl -t ovs-ofctl exit
1634
1635 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1636
1637 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1638 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1639 tcp,metadata=0,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=0x002 tcp_csum:0
1640 dnl
1641 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1642 tcp,metadata=0,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=0x002 tcp_csum:0
1643 dnl
1644 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
1645 tcp,metadata=0,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=0x002 tcp_csum:0
1646 ])
1647
1648 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1649
1650 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1651  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
1652 OFPST_FLOW reply (OF1.3):
1653 ])
1654
1655 OVS_VSWITCHD_STOP
1656 AT_CLEANUP
1657
1658 AT_SETUP([ofproto-dpif - ARP modification slow-path])
1659 OVS_VSWITCHD_START
1660 ADD_OF_PORTS([br0], [1], [2])
1661
1662 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
1663 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'
1664
1665 # Input some packets that should follow the arp modification slow-path.
1666 for i in 1 2 3; do
1667     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)'
1668 done
1669 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1670
1671 # Check the packets that were output.
1672 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
1673 arp,metadata=0,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
1674 arp,metadata=0,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
1675 arp,metadata=0,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
1676 arp,metadata=0,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
1677 arp,metadata=0,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
1678 arp,metadata=0,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
1679 arp,metadata=0,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
1680 arp,metadata=0,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
1681 arp,metadata=0,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
1682 ])
1683
1684 OVS_VSWITCHD_STOP
1685 AT_CLEANUP
1686
1687 AT_SETUP([ofproto-dpif - VLAN handling])
1688 OVS_VSWITCHD_START(
1689   [set Bridge br0 fail-mode=standalone -- \
1690    add-port br0 p1                                  trunks=10,12 -- \
1691    add-port br0 p2                           tag=10              -- \
1692    add-port br0 p3                           tag=12              \
1693                    other-config:priority-tags=true               -- \
1694    add-port br0 p4                           tag=12              -- \
1695    add-port br0 p5 vlan_mode=native-tagged   tag=10              -- \
1696    add-port br0 p6 vlan_mode=native-tagged   tag=10 trunks=10,12 -- \
1697    add-port br0 p7 vlan_mode=native-untagged tag=12              -- \
1698    add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
1699                    other-config:priority-tags=true               -- \
1700    set Interface p1 type=dummy -- \
1701    set Interface p2 type=dummy -- \
1702    set Interface p3 type=dummy -- \
1703    set Interface p4 type=dummy -- \
1704    set Interface p5 type=dummy -- \
1705    set Interface p6 type=dummy -- \
1706    set Interface p7 type=dummy -- \
1707    set Interface p8 type=dummy --])
1708
1709 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
1710 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
1711 dnl actions.
1712 for tuple in \
1713         "100 none 0 drop" \
1714         "100 0    0 drop" \
1715         "100 0    1 drop" \
1716         "100 10   0 1,5,6,7,8,pop_vlan,2" \
1717         "100 10   1 1,5,6,7,8,pop_vlan,2" \
1718         "100 11   0 5,7" \
1719         "100 11   1 5,7" \
1720         "100 12   0 1,5,6,pop_vlan,3,4,7,8" \
1721         "100 12   1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
1722         "1  none 0 drop" \
1723         "1  0    0 drop" \
1724         "1  0    1 drop" \
1725         "1  10   0 5,6,7,8,100,pop_vlan,2" \
1726         "1  10   1 5,6,7,8,100,pop_vlan,2" \
1727         "1  11   0 drop" \
1728         "1  11   1 drop" \
1729         "1  12   0 5,6,100,pop_vlan,3,4,7,8" \
1730         "1  12   1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
1731         "2  none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
1732         "2  0    0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
1733         "2  0    1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
1734         "2  10   0 drop" \
1735         "2  10   1 drop" \
1736         "2  11   0 drop" \
1737         "2  11   1 drop" \
1738         "2  12   0 drop" \
1739         "2  12   1 drop" \
1740         "3  none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1741         "3  0    0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1742         "3  0    1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
1743         "3  10   0 drop" \
1744         "3  10   1 drop" \
1745         "3  11   0 drop" \
1746         "3  11   1 drop" \
1747         "3  12   0 drop" \
1748         "3  12   1 drop" \
1749         "4  none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1750         "4  0    0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1751         "4  0    1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
1752         "4  10   0 drop" \
1753         "4  10   1 drop" \
1754         "4  11   0 drop" \
1755         "4  11   1 drop" \
1756         "4  12   0 drop" \
1757         "4  12   1 drop" \
1758         "5  none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
1759         "5  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
1760         "5  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
1761         "5  10   0 1,6,7,8,100,pop_vlan,2" \
1762         "5  10   1 1,6,7,8,100,pop_vlan,2" \
1763         "5  11   0 7,100" \
1764         "5  11   1 7,100" \
1765         "5  12   0 1,6,100,pop_vlan,3,4,7,8" \
1766         "5  12   1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
1767         "6  none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
1768         "6  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
1769         "6  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
1770         "6  10   0 1,5,7,8,100,pop_vlan,2" \
1771         "6  10   1 1,5,7,8,100,pop_vlan,2" \
1772         "6  11   0 drop" \
1773         "6  11   1 drop" \
1774         "6  12   0 1,5,100,pop_vlan,3,4,7,8" \
1775         "6  12   1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
1776         "7  none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1777         "7  0    0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
1778         "7  0    1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
1779         "7  10   0 1,5,6,8,100,pop_vlan,2" \
1780         "7  10   1 1,5,6,8,100,pop_vlan,2" \
1781         "7  11   0 5,100" \
1782         "7  11   1 5,100" \
1783         "7  12   0 1,5,6,100,pop_vlan,3,4,8" \
1784         "7  12   1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
1785         "8  none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
1786         "8  0    0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
1787         "8  0    1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
1788         "8  10   0 1,5,6,7,100,pop_vlan,2" \
1789         "8  10   1 1,5,6,7,100,pop_vlan,2" \
1790         "8  11   0 drop" \
1791         "8  11   1 drop" \
1792         "8  12   0 1,5,6,100,pop_vlan,3,4,7" \
1793         "8  12   1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
1794 do
1795   set $tuple
1796   in_port=$1
1797   vlan=$2
1798   pcp=$3
1799   expected=$4
1800
1801   if test $vlan = none; then
1802     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
1803   else
1804     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))"
1805   fi
1806
1807   echo "----------------------------------------------------------------------"
1808   echo "in_port=$in_port vlan=$vlan pcp=$pcp"
1809
1810   AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
1811   actual=`tail -1 stdout | sed 's/Datapath actions: //'`
1812
1813   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
1814   mv stdout expout
1815   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
1816 done
1817
1818 OVS_VSWITCHD_STOP
1819 AT_CLEANUP
1820
1821 AT_SETUP([ofproto-dpif - MPLS handling])
1822 OVS_VSWITCHD_START([dnl
1823    add-port br0 p1 -- set Interface p1 type=dummy
1824 ])
1825 ON_EXIT([kill `cat ovs-ofctl.pid`])
1826
1827 AT_CAPTURE_FILE([ofctl_monitor.log])
1828 AT_DATA([flows.txt], [dnl
1829 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
1830 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
1831 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
1832 ])
1833 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
1834
1835 dnl In this test, we push an MPLS tag to an ethernet packet.
1836 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
1837
1838 for i in 1 2 3; do
1839     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)'
1840 done
1841 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
1842 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1843
1844 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
1845 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1846 mpls,metadata=0,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
1847 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
1848 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
1849 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
1850 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
1851 dnl
1852 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1853 mpls,metadata=0,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
1854 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
1855 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
1856 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
1857 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
1858 dnl
1859 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1860 mpls,metadata=0,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
1861 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
1862 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
1863 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
1864 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
1865 ])
1866
1867 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
1868 dnl copied exactly, except for the BOS bit.
1869 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
1870
1871 for i in 1 2 3; do
1872     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)'
1873 done
1874 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
1875 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1876
1877 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
1878 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1879 mpls,metadata=0,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
1880 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
1881 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1882 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1883 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1884 dnl
1885 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1886 mpls,metadata=0,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
1887 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
1888 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1889 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1890 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1891 dnl
1892 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1893 mpls,metadata=0,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
1894 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
1895 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1896 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1897 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1898 ])
1899
1900 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
1901 dnl copied exactly, except for the BOS bit. The ethertype should be updated
1902 dnl to the MPLS ethertype of the MPLS push action which differs to that
1903 dnl of the input packet.
1904 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
1905
1906 for i in 1 2 3; do
1907     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)'
1908 done
1909 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
1910 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1911
1912 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
1913 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1914 mplsm,metadata=0,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
1915 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
1916 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1917 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1918 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1919 dnl
1920 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1921 mplsm,metadata=0,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
1922 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
1923 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1924 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1925 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1926 dnl
1927 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1928 mplsm,metadata=0,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
1929 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
1930 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
1931 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1932 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
1933 ])
1934
1935 OVS_VSWITCHD_STOP
1936 AT_CLEANUP
1937
1938 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
1939 OVS_VSWITCHD_START([dnl
1940    add-port br0 p1 -- set Interface p1 type=dummy
1941 ])
1942 ON_EXIT([kill `cat ovs-ofctl.pid`])
1943
1944 AT_CAPTURE_FILE([ofctl_monitor.log])
1945 AT_DATA([flows.txt], [dnl
1946 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
1947 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
1948 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
1949 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
1950 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
1951 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
1952 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
1953 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
1954 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
1955 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
1956 ])
1957 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
1958
1959 dnl Modified MPLS controller action.
1960 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
1961 dnl both of these in the final flow
1962 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
1963
1964 for i in 1 2 3; do
1965     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)'
1966 done
1967 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
1968 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1969
1970 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
1971 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
1972 mpls,metadata=0,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
1973 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
1974 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
1975 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
1976 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
1977 00000040  00 00 00 00
1978 dnl
1979 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
1980 mpls,metadata=0,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
1981 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
1982 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
1983 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
1984 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
1985 00000040  00 00 00 00
1986 dnl
1987 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
1988 mpls,metadata=0,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
1989 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
1990 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
1991 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
1992 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
1993 00000040  00 00 00 00
1994 ])
1995
1996 dnl Modified MPLS controller action.
1997 dnl In this test, the input packet in vlan-tagged, which should be stripped
1998 dnl before we push the MPLS and VLAN tags.
1999 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2000
2001 for i in 1 2 3; do
2002     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))'
2003 done
2004 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2005 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2006
2007 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2008 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2009 mpls,metadata=0,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
2010 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2011 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2012 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2013 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2014 dnl
2015 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2016 mpls,metadata=0,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
2017 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2018 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2019 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2020 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2021 dnl
2022 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2023 mpls,metadata=0,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
2024 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2025 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2026 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2027 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2028 ])
2029
2030 dnl Modified MPLS controller action.
2031 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
2032 dnl both of these in the final flow
2033 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2034
2035 for i in 1 2 3; do
2036     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)'
2037 done
2038 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2039 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2040
2041 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2042 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2043 mpls,metadata=0,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
2044 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2045 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2046 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2047 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2048 00000040  00 00 00 00
2049 dnl
2050 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2051 mpls,metadata=0,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
2052 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2053 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2054 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2055 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2056 00000040  00 00 00 00
2057 dnl
2058 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2059 mpls,metadata=0,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
2060 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2061 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2062 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2063 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2064 00000040  00 00 00 00
2065 ])
2066
2067 dnl Modified MPLS controller action.
2068 dnl In this test, the input packet in vlan-tagged, which should be stripped
2069 dnl before we push the MPLS and VLAN tags.
2070 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2071
2072 for i in 1 2 3; do
2073     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))'
2074 done
2075 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2076 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2077
2078 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2079 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2080 mpls,metadata=0,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
2081 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2082 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2083 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2084 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2085 dnl
2086 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2087 mpls,metadata=0,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
2088 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2089 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2090 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2091 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2092 dnl
2093 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2094 mpls,metadata=0,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
2095 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2096 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2097 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2098 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2099 ])
2100
2101 dnl Modified MPLS controller action.
2102 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
2103 dnl actions are reordered, so we see both of these in the final flow.
2104 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2105
2106 for i in 1 2 3; do
2107     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)'
2108 done
2109 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2110 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2111
2112 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2113 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2114 mpls,metadata=0,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
2115 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
2116 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2117 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2118 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2119 00000040  00 00 00 00
2120 dnl
2121 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2122 mpls,metadata=0,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
2123 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
2124 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2125 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2126 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2127 00000040  00 00 00 00
2128 dnl
2129 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2130 mpls,metadata=0,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
2131 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
2132 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2133 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2134 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2135 00000040  00 00 00 00
2136 ])
2137
2138 dnl Modified MPLS controller action.
2139 dnl In this test, the input packet in vlan-tagged, which should be stripped
2140 dnl before we push the MPLS and VLAN tags.
2141 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2142
2143 for i in 1 2 3; do
2144     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))'
2145 done
2146 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2147 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
2148
2149 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2150 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2151 mpls,metadata=0,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
2152 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
2153 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2154 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2155 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2156 dnl
2157 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2158 mpls,metadata=0,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
2159 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
2160 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2161 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2162 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2163 dnl
2164 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2165 mpls,metadata=0,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
2166 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
2167 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2168 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2169 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2170 ])
2171
2172 dnl Modified MPLS controller action.
2173 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
2174 dnl actions are reordered, so we see both of these in the final flow.
2175 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2176
2177 for i in 1 2 3; do
2178     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)'
2179 done
2180 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2181 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2182
2183 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2184 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2185 mpls,metadata=0,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
2186 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
2187 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2188 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2189 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2190 00000040  00 00 00 00
2191 dnl
2192 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2193 mpls,metadata=0,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
2194 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
2195 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2196 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2197 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2198 00000040  00 00 00 00
2199 dnl
2200 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2201 mpls,metadata=0,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
2202 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
2203 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2204 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2205 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2206 00000040  00 00 00 00
2207 ])
2208
2209 dnl Modified MPLS controller action.
2210 dnl In this test, the input packet in vlan-tagged, which should be stripped
2211 dnl before we push the MPLS and VLAN tags.
2212 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2213
2214 for i in 1 2 3; do
2215     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))'
2216 done
2217 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2218 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2219
2220 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2221 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2222 mpls,metadata=0,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
2223 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
2224 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2225 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2226 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2227 dnl
2228 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2229 mpls,metadata=0,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
2230 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
2231 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2232 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2233 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2234 dnl
2235 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2236 mpls,metadata=0,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
2237 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
2238 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2239 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2240 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2241 ])
2242
2243 dnl Modified MPLS controller action.
2244 dnl In this test, the input packet in vlan-tagged, which should be stripped
2245 dnl before we push the MPLS and VLAN tags.
2246 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2247
2248 for i in 1 2 3; do
2249     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))'
2250 done
2251 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2252 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2253
2254 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2255 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2256 mpls,metadata=0,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
2257 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
2258 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2259 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2260 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2261 dnl
2262 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2263 mpls,metadata=0,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
2264 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
2265 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2266 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2267 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2268 dnl
2269 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2270 mpls,metadata=0,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
2271 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
2272 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2273 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2274 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2275 ])
2276
2277 dnl Modified MPLS controller action.
2278 dnl In this test, the input packet in vlan-tagged, which should be modified
2279 dnl before we push MPLS and VLAN tags.
2280 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2281
2282 for i in 1 2 3; do
2283     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))'
2284 done
2285 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2286 ovs-appctl -t ovs-ofctl exit
2287
2288 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2289 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2290 mpls,metadata=0,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
2291 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
2292 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2293 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2294 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2295 dnl
2296 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2297 mpls,metadata=0,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
2298 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
2299 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2300 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2301 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2302 dnl
2303 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2304 mpls,metadata=0,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
2305 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
2306 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2307 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2308 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2309 ])
2310
2311 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2312 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2313  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
2314  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
2315  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
2316  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
2317  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
2318  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
2319  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
2320  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
2321  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
2322  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
2323 OFPST_FLOW reply (OF1.2):
2324 ])
2325
2326 OVS_VSWITCHD_STOP
2327 AT_CLEANUP
2328
2329 AT_SETUP([ofproto-dpif - fragment handling])
2330 OVS_VSWITCHD_START
2331 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
2332 AT_DATA([flows.txt], [dnl
2333 priority=75 tcp ip_frag=no    tp_dst=80 actions=output:1
2334 priority=75 tcp ip_frag=first tp_dst=80 actions=output:2
2335 priority=75 tcp ip_frag=later tp_dst=80 actions=output:3
2336 priority=50 tcp ip_frag=no              actions=output:4
2337 priority=50 tcp ip_frag=first           actions=output:5
2338 priority=50 tcp ip_frag=later           actions=output:6
2339 ])
2340 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
2341
2342 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"
2343 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
2344 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
2345 later_flow="$base_flow,frag=later)"
2346
2347     # mode    no  first  later
2348 for tuple in \
2349     'normal    1     5      6' \
2350     'drop      1  drop   drop' \
2351     'nx-match  1     2      6'
2352 do
2353   set $tuple
2354   mode=$1
2355   no=$2
2356   first=$3
2357   later=$4
2358
2359   AT_CHECK([ovs-ofctl set-frags br0 $mode])
2360   for type in no first later; do
2361     eval flow=\$${type}_flow exp_output=\$$type
2362     printf "\n%s\n" "----$mode $type-----"
2363     AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2364     : > expout
2365     if test $mode = drop && test $type != no; then
2366         echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
2367     fi
2368     echo "Datapath actions: $exp_output" >> expout
2369     AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
2370   done
2371 done
2372 OVS_VSWITCHD_STOP
2373 AT_CLEANUP
2374
2375 AT_SETUP([ofproto-dpif - exit])
2376 OVS_VSWITCHD_START
2377 ADD_OF_PORTS([br0], [1], [2], [3], [10], [11], [12], [13], [14])
2378 AT_DATA([flows.txt], [dnl
2379 in_port=1 actions=output:10,exit,output:11
2380 in_port=2 actions=output:12,resubmit:1,output:12
2381 in_port=3 actions=output:13,resubmit:2,output:14
2382 ])
2383 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2384 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])
2385 AT_CHECK([tail -1 stdout], [0],
2386   [Datapath actions: 10
2387 ])
2388 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])
2389 AT_CHECK([tail -1 stdout], [0],
2390   [Datapath actions: 12,10
2391 ])
2392 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])
2393 AT_CHECK([tail -1 stdout], [0],
2394   [Datapath actions: 13,12,10
2395 ])
2396 OVS_VSWITCHD_STOP
2397 AT_CLEANUP
2398
2399
2400 AT_SETUP([ofproto-dpif - mirroring, select_all])
2401 OVS_VSWITCHD_START
2402 ADD_OF_PORTS([br0], 1, 2, 3)
2403 ovs-vsctl \
2404         set Bridge br0 mirrors=@m --\
2405         --id=@p3 get Port p3 --\
2406         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
2407
2408 AT_DATA([flows.txt], [dnl
2409 in_port=1 actions=output:2
2410 in_port=2 actions=output:1
2411 ])
2412 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2413
2414 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)"
2415 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2416 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2417   [Datapath actions: 2,3
2418 ])
2419
2420 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)"
2421 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2422 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2423   [Datapath actions: 1,3
2424 ])
2425
2426 OVS_VSWITCHD_STOP
2427 AT_CLEANUP
2428
2429
2430 AT_SETUP([ofproto-dpif - mirroring, select_src])
2431 OVS_VSWITCHD_START
2432 ADD_OF_PORTS([br0], 1, 2, 3)
2433 ovs-vsctl \
2434         set Bridge br0 mirrors=@m --\
2435         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
2436         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
2437
2438 AT_DATA([flows.txt], [dnl
2439 in_port=1 actions=output:2
2440 in_port=2 actions=output:1
2441 ])
2442 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2443
2444 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)"
2445 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2446 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2447   [Datapath actions: 2,3
2448 ])
2449
2450 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)"
2451 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2452 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2453   [Datapath actions: 1
2454 ])
2455 OVS_VSWITCHD_STOP
2456 AT_CLEANUP
2457
2458 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2459 OVS_VSWITCHD_START
2460 ADD_OF_PORTS([br0], 1, 2)
2461 ovs-vsctl \
2462         set Bridge br0 mirrors=@m --\
2463         --id=@p2 get Port p2 --\
2464         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
2465
2466 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
2467
2468 # "in_port" defaults to OFPP_NONE if it's not specified.
2469 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"
2470 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
2471 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2472   [Datapath actions: 1,2
2473 ])
2474
2475 OVS_VSWITCHD_STOP
2476 AT_CLEANUP
2477
2478
2479 AT_SETUP([ofproto-dpif - mirroring, select_dst])
2480 OVS_VSWITCHD_START
2481 ADD_OF_PORTS([br0], 1, 2, 3)
2482 ovs-vsctl \
2483         set Bridge br0 mirrors=@m --\
2484         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
2485         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
2486
2487 AT_DATA([flows.txt], [dnl
2488 in_port=1 actions=output:2
2489 in_port=2 actions=output:1
2490 ])
2491 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2492
2493 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)"
2494 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2495 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2496   [Datapath actions: 2,3
2497 ])
2498
2499 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)"
2500 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2501 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2502   [Datapath actions: 1
2503 ])
2504
2505 OVS_VSWITCHD_STOP
2506 AT_CLEANUP
2507
2508
2509 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2510 OVS_VSWITCHD_START
2511 ADD_OF_PORTS([br0], 1, 2, 3)
2512 ovs-vsctl \
2513         set Bridge br0 mirrors=@m --\
2514         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
2515         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
2516
2517 AT_DATA([flows.txt], [dnl
2518 in_port=1, actions=output:2
2519 ])
2520 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2521
2522 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)"
2523 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2524 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2525   [Datapath actions: 2
2526 ])
2527
2528 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))"
2529 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2530 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2531   [Datapath actions: 2
2532 ])
2533
2534 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))"
2535 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2536 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2537   [Datapath actions: 2,3
2538 ])
2539
2540 OVS_VSWITCHD_STOP
2541 AT_CLEANUP
2542
2543
2544 AT_SETUP([ofproto-dpif - mirroring, output_port])
2545 OVS_VSWITCHD_START
2546 ADD_OF_PORTS([br0], 1, 2, 3)
2547 ovs-vsctl \
2548         set Bridge br0 mirrors=@m --\
2549         --id=@p3 get Port p3 --\
2550         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
2551
2552 AT_DATA([flows.txt], [dnl
2553 in_port=1 actions=mod_vlan_vid:17,output:2
2554 in_port=2 actions=output:1
2555 ])
2556 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2557
2558 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)"
2559 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2560 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2561   [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
2562 ])
2563
2564 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)"
2565 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2566 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
2567   [Datapath actions: 1,3
2568 ])
2569
2570 OVS_VSWITCHD_STOP
2571 AT_CLEANUP
2572
2573 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2574 OVS_VSWITCHD_START
2575 ADD_OF_PORTS([br0], 1, 2)
2576 ovs-vsctl \
2577         set Bridge br0 mirrors=@m --\
2578         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
2579
2580 AT_DATA([flows.txt], [dnl
2581 in_port=1 actions=output:2
2582 in_port=2 actions=mod_vlan_vid:17,output:1
2583 ])
2584 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2585
2586 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)"
2587 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2588 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
2589
2590 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
2591 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
2592 mv stdout expout
2593 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
2594
2595 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)"
2596 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2597 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
2598
2599 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
2600 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
2601 mv stdout expout
2602 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
2603
2604 OVS_VSWITCHD_STOP
2605 AT_CLEANUP
2606
2607 # Two testcases below are for the ofproto/trace command
2608 # The first one tests all correct syntax:
2609 # ofproto/trace [dp_name] odp_flow [-generate|packet]
2610 # ofproto/trace br_name br_flow [-generate|packet]
2611 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
2612 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
2613 ADD_OF_PORTS([br0], 1, 2, 3)
2614
2615 AT_DATA([flows.txt], [dnl
2616 in_port=1 actions=output:2
2617 in_port=2 actions=output:1
2618 ])
2619 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2620
2621 odp_flow="in_port(1)"
2622 br_flow="in_port=1"
2623 # Test command: ofproto/trace odp_flow with in_port as a name.
2624 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
2625 AT_CHECK([tail -1 stdout], [0], [dnl
2626 Datapath actions: 2
2627 ])
2628
2629 odp_flow="in_port(1)"
2630 # Test command: ofproto/trace odp_flow
2631 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
2632 AT_CHECK([tail -1 stdout], [0], [dnl
2633 Datapath actions: 2
2634 ])
2635
2636 # Test command: ofproto/trace dp_name odp_flow
2637 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
2638 AT_CHECK([tail -1 stdout], [0], [dnl
2639 Datapath actions: 2
2640 ])
2641 # Test commmand: ofproto/trace br_name br_flow
2642 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
2643 AT_CHECK([tail -1 stdout], [0], [dnl
2644 Datapath actions: 2
2645 ])
2646
2647 # Delete the inserted flows
2648 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
2649 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
2650
2651 # This section beflow tests the [-generate] option
2652 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
2653 br_flow="arp,metadata=0,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
2654
2655 # Test command: ofproto/trace odp_flow
2656 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
2657 # Check for no MAC learning entry
2658 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2659  port  VLAN  MAC                Age
2660 ])
2661
2662 # Test command: ofproto/trace br_name br_flow
2663 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
2664 # Check for no MAC learning entry
2665 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2666  port  VLAN  MAC                Age
2667 ])
2668
2669 # Test command: ofproto/trace odp_flow -generate
2670 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
2671 # Check for the MAC learning entry
2672 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2673  port  VLAN  MAC                Age
2674     3     0  50:54:00:00:00:05    ?
2675 ])
2676
2677 # Test command: ofproto/trace dp_name odp_flow -generate
2678 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
2679   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
2680   -generate], [0], [stdout])
2681 # Check for both MAC learning entries
2682 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2683  port  VLAN  MAC                Age
2684     3     0  50:54:00:00:00:05    ?
2685     1     0  50:54:00:00:00:06    ?
2686 ])
2687
2688 # Test command: ofproto/trace br_name br_flow -generate
2689 AT_CHECK([ovs-appctl ofproto/trace br0 \
2690   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
2691   -generate], [0], [stdout])
2692 # Check for both MAC learning entries.
2693 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2694  port  VLAN  MAC                Age
2695     3     0  50:54:00:00:00:05    ?
2696     1     0  50:54:00:00:00:06    ?
2697     2     0  50:54:00:00:00:07    ?
2698 ])
2699
2700 # This section beflow tests the [packet] option
2701 # The ovs-tcpundump of packets between port1 and port2
2702 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
2703 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
2704
2705 # Construct the MAC learning table
2706 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
2707   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
2708   -generate], [0], [stdout])
2709
2710 # Construct the MAC learning table
2711 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
2712   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
2713   -generate], [0], [stdout])
2714
2715 # Test command: ofproto/trace odp_flow packet
2716 AT_CHECK([ovs-appctl ofproto/trace \
2717   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
2718 AT_CHECK([tail -1 stdout], [0], [dnl
2719 Datapath actions: 2
2720 ])
2721 AT_CHECK([head -n 2 stdout], [0], [dnl
2722 Bridge: br0
2723 Flow: pkt_mark=0x2,skb_priority=0x1,arp,metadata=0,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_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
2724 ])
2725
2726 # Test command: ofproto/trace dp_name odp_flow packet
2727 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
2728   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
2729 AT_CHECK([tail -1 stdout], [0], [dnl
2730 Datapath actions: 2
2731 ])
2732 AT_CHECK([head -n 2 stdout], [0], [dnl
2733 Bridge: br0
2734 Flow: pkt_mark=0x2,skb_priority=0x1,arp,metadata=0,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_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
2735 ])
2736
2737 # Test command: ofproto/trace br_name br_flow packet
2738 AT_CHECK([ovs-appctl ofproto/trace br0 \
2739   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
2740 AT_CHECK([tail -1 stdout], [0], [dnl
2741 Datapath actions: 1
2742 ])
2743 AT_CHECK([head -n 2 stdout], [0], [dnl
2744 Bridge: br0
2745 Flow: pkt_mark=0x1,skb_priority=0x2,arp,metadata=0,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_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
2746 ])
2747
2748 OVS_VSWITCHD_STOP
2749 AT_CLEANUP
2750
2751 # The second test tests the corner cases
2752 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
2753 OVS_VSWITCHD_START
2754 ADD_OF_PORTS([br0], 1, 2)
2755
2756 # Define flows
2757 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
2758 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
2759 # Define options
2760 generate="-generate"
2761 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
2762
2763 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
2764 m4_foreach(
2765 [option],
2766 [[],
2767 ["$generate"],
2768 ["$pkt"]],
2769 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
2770   [2], [], [stderr])
2771 AT_CHECK([tail -2 stderr], [0], [dnl
2772 Cannot find the datapath
2773 ovs-appctl: ovs-vswitchd: server returned an error
2774 ])])
2775
2776 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
2777 m4_foreach(
2778 [option],
2779 [[],
2780 ["$generate"],
2781 ["$pkt"]],
2782 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
2783   [2], [], [stderr])
2784 AT_CHECK([tail -2 stderr], [0], [dnl
2785 Cannot find the datapath
2786 ovs-appctl: ovs-vswitchd: server returned an error
2787 ])])
2788
2789 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
2790 m4_foreach(
2791 [option],
2792 [[],
2793 ["$generate"],
2794 ["$pkt"]],
2795 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
2796   [2], [], [stderr])
2797 AT_CHECK([tail -2 stderr], [0], [dnl
2798 Cannot find the datapath
2799 ovs-appctl: ovs-vswitchd: server returned an error
2800 ])])
2801
2802 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
2803 m4_foreach(
2804 [option],
2805 [[],
2806 ["$generate"],
2807 ["$pkt"]],
2808 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
2809   [2], [], [stderr])
2810 AT_CHECK([tail -2 stderr], [0], [dnl
2811 Cannot find the datapath
2812 ovs-appctl: ovs-vswitchd: server returned an error
2813 ])])
2814
2815 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
2816 m4_foreach(
2817 [option],
2818 [[],
2819 ["$generate"],
2820 ["$pkt"]],
2821 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
2822   [2], [], [stderr])
2823 AT_CHECK([tail -2 stderr], [0], [dnl
2824 Unknown bridge name
2825 ovs-appctl: ovs-vswitchd: server returned an error
2826 ])])
2827
2828 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
2829 m4_foreach(
2830 [option],
2831 [[],
2832 ["$generate"],
2833 ["$pkt"]],
2834 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
2835   [2], [], [stderr])
2836 AT_CHECK([tail -2 stderr], [0], [dnl
2837 Must specify bridge name
2838 ovs-appctl: ovs-vswitchd: server returned an error
2839 ])])
2840
2841 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
2842 AT_CHECK([ovs-appctl ofproto/trace \
2843   ovs-dummy "$odp_flow" garbage_option],
2844   [2], [stdout],[stderr])
2845 AT_CHECK([tail -2 stderr], [0], [dnl
2846 Trailing garbage in packet data
2847 ovs-appctl: ovs-vswitchd: server returned an error
2848 ])
2849
2850 # Test incorrect command: ofproto/trace with 4 arguments
2851 AT_CHECK([ovs-appctl ofproto/trace \
2852   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
2853 AT_CHECK([tail -2 stderr], [0], [dnl
2854 "ofproto/trace" command takes at most 3 arguments
2855 ovs-appctl: ovs-vswitchd: server returned an error
2856 ])
2857
2858 # Test incorrect command: ofproto/trace with 0 argument
2859 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
2860 AT_CHECK([tail -2 stderr], [0], [dnl
2861 "ofproto/trace" command requires at least 1 arguments
2862 ovs-appctl: ovs-vswitchd: server returned an error
2863 ])
2864
2865 OVS_VSWITCHD_STOP
2866 AT_CLEANUP
2867
2868 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
2869 OVS_VSWITCHD_START
2870 ADD_OF_PORTS([br0], 1, 2, 3)
2871
2872 AT_DATA([flows.txt], [dnl
2873 in_port=1 actions=output:2
2874 in_port=2 actions=output:1
2875 ])
2876 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2877
2878 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
2879 AT_CHECK([tail -1 stdout], [0], [dnl
2880 Datapath actions: push_vlan(vid=123,pcp=0),2
2881 ])
2882
2883 OVS_VSWITCHD_STOP
2884 AT_CLEANUP
2885
2886
2887 m4_define([OFPROTO_TRACE],
2888   [flow="$2"
2889    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
2890    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
2891    expected="$4"
2892    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
2893      [0], [stdout])
2894    mv stdout expout
2895    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
2896      [0], [expout])])
2897
2898 AT_SETUP([ofproto-dpif - MAC learning])
2899 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
2900 ADD_OF_PORTS([br0], 1, 2, 3)
2901
2902 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)'
2903
2904 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
2905 OFPROTO_TRACE(
2906   [ovs-dummy],
2907   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
2908   [-generate],
2909   [1,2,100])
2910
2911 # Check for the MAC learning entry.
2912 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2913  port  VLAN  MAC                Age
2914     3     0  50:54:00:00:00:05    ?
2915 ])
2916
2917 # Trace a packet arrival destined for the learned MAC.
2918 # (This will also learn a MAC.)
2919 OFPROTO_TRACE(
2920   [ovs-dummy],
2921   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
2922   [-generate],
2923   [3])
2924
2925 # Check for both MAC learning entries.
2926 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2927  port  VLAN  MAC                Age
2928     3     0  50:54:00:00:00:05    ?
2929     1     0  50:54:00:00:00:06    ?
2930 ])
2931
2932 # Trace a packet arrival that updates the first learned MAC entry.
2933 OFPROTO_TRACE(
2934   [ovs-dummy],
2935   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
2936   [-generate],
2937   [1,3,100])
2938
2939 # Check that the MAC learning entry was updated.
2940 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2941  port  VLAN  MAC                Age
2942     1     0  50:54:00:00:00:06    ?
2943     2     0  50:54:00:00:00:05    ?
2944 ])
2945
2946 # Add another bridge.
2947 AT_CHECK(
2948   [ovs-vsctl \
2949      -- add-br br1 \
2950      -- set bridge br1 datapath-type=dummy])
2951 ADD_OF_PORTS([br1], 4, 5)
2952
2953 # Trace some packet arrivals in br1 to create MAC learning entries there too.
2954 OFPROTO_TRACE(
2955   [ovs-dummy],
2956   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
2957   [-generate],
2958   [5,101])
2959 OFPROTO_TRACE(
2960   [ovs-dummy],
2961   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
2962   [-generate],
2963   [4,101])
2964
2965 # Check that the MAC learning entries were added.
2966 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2967  port  VLAN  MAC                Age
2968     4     0  50:54:00:00:00:06    ?
2969     5     0  50:54:00:00:00:07    ?
2970 ])
2971
2972 # Delete port p1 and see that its MAC learning entry disappeared, and
2973 # that the MAC learning entry for the same MAC was also deleted from br1.
2974 AT_CHECK([ovs-vsctl del-port p1])
2975 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2976  port  VLAN  MAC                Age
2977     2     0  50:54:00:00:00:05    ?
2978 ])
2979 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
2980  port  VLAN  MAC                Age
2981     5     0  50:54:00:00:00:07    ?
2982 ])
2983
2984 OVS_VSWITCHD_STOP
2985 AT_CLEANUP
2986
2987 AT_SETUP([ofproto-dpif - MAC table overflow])
2988 OVS_VSWITCHD_START(
2989   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
2990 ADD_OF_PORTS([br0], 1, 2, 3)
2991
2992 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)'
2993
2994 AT_CHECK([ovs-appctl time/stop])
2995
2996 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
2997 for i in 0 1 2 3 4 5 6 7 8 9; do
2998     OFPROTO_TRACE(
2999       [ovs-dummy],
3000       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
3001       [-generate],
3002       [1,2,100])
3003     ovs-appctl time/warp 1000
3004 done
3005
3006 # Check for the MAC learning entries.
3007 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
3008   [0], [dnl
3009     3     0  50:54:00:00:00:00
3010     3     0  50:54:00:00:00:01
3011     3     0  50:54:00:00:00:02
3012     3     0  50:54:00:00:00:03
3013     3     0  50:54:00:00:00:04
3014     3     0  50:54:00:00:00:05
3015     3     0  50:54:00:00:00:06
3016     3     0  50:54:00:00:00:07
3017     3     0  50:54:00:00:00:08
3018     3     0  50:54:00:00:00:09
3019  port  VLAN  MAC                Age
3020 ])
3021
3022 # Trace another ARP packet on another MAC.
3023 OFPROTO_TRACE(
3024   [ovs-dummy],
3025   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
3026   [-generate],
3027   [1,2,100])
3028
3029 # Check that the new one chased the oldest one out of the table.
3030 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
3031   [0], [dnl
3032     3     0  50:54:00:00:00:01    ?
3033     3     0  50:54:00:00:00:02    ?
3034     3     0  50:54:00:00:00:03    ?
3035     3     0  50:54:00:00:00:04    ?
3036     3     0  50:54:00:00:00:05    ?
3037     3     0  50:54:00:00:00:06    ?
3038     3     0  50:54:00:00:00:07    ?
3039     3     0  50:54:00:00:00:08    ?
3040     3     0  50:54:00:00:00:09    ?
3041     3     0  50:54:00:00:00:10    ?
3042  port  VLAN  MAC                Age
3043 ])
3044 OVS_VSWITCHD_STOP
3045 AT_CLEANUP
3046
3047 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR, ADDR_WITHOUT_BRACKETS)
3048 #
3049 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
3050 #
3051 # IP_VERSION_TYPE is used in AT_SETUP
3052 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
3053   [AT_SETUP([ofproto-dpif - sFlow packet sampling - $2 collector])
3054   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
3055
3056   ON_EXIT([kill `cat test-sflow.pid`])
3057   AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
3058   AT_CAPTURE_FILE([sflow.log])
3059   SFLOW_PORT=`parse_listening_port test-sflow.log`
3060   ovs-appctl time/stop
3061
3062   ADD_OF_PORTS([br0], 1, 2)
3063   ovs-vsctl \
3064      set Interface br0 options:ifindex=1002 -- \
3065      set Interface p1 options:ifindex=1004 -- \
3066      set Interface p2 options:ifindex=1003 -- \
3067      set Bridge br0 sflow=@sf -- \
3068      --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
3069        header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
3070
3071   dnl open with ARP packets to seed the bridge-learning.  The output
3072   dnl ifIndex numbers should be reported predictably after that.
3073   dnl Since we set sampling=1 we should see all of these packets
3074   dnl reported. Sorting the output by data-source and seqNo makes
3075   dnl it deterministic. Ensuring that we send at least two packets
3076   dnl into each port means we get to check the seq nos are
3077   dnl incrementing correctly.
3078   dnl because packets from different ports can be handled by separate
3079   dnl threads, put some sleeps
3080
3081   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)'
3082   sleep 1
3083   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)'
3084   sleep 1
3085   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)'
3086   sleep 1
3087   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)'
3088   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)'
3089
3090   dnl sleep long enough to get more than one counter sample
3091   dnl from each datasource so we can check sequence numbers
3092   for i in `seq 1 30`; do
3093       ovs-appctl time/warp 100
3094   done
3095   OVS_VSWITCHD_STOP
3096   ovs-appctl -t test-sflow exit
3097
3098   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
3099         /g']], [0], [dnl
3100 HEADER
3101         dgramSeqNo=1
3102         ds=127.0.0.1>2:1000
3103         fsSeqNo=1
3104         in_vlan=0
3105         in_priority=0
3106         out_vlan=0
3107         out_priority=0
3108         meanSkip=1
3109         samplePool=1
3110         dropEvents=0
3111         in_ifindex=1004
3112         in_format=0
3113         out_ifindex=2
3114         out_format=2
3115         hdr_prot=1
3116         pkt_len=64
3117         stripped=4
3118         hdr_len=60
3119         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
3120 HEADER
3121         dgramSeqNo=1
3122         ds=127.0.0.1>2:1000
3123         fsSeqNo=2
3124         in_vlan=0
3125         in_priority=0
3126         out_vlan=0
3127         out_priority=0
3128         meanSkip=1
3129         samplePool=2
3130         dropEvents=0
3131         in_ifindex=1003
3132         in_format=0
3133         out_ifindex=2
3134         out_format=2
3135         hdr_prot=1
3136         pkt_len=64
3137         stripped=4
3138         hdr_len=60
3139         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
3140 HEADER
3141         dgramSeqNo=1
3142         ds=127.0.0.1>2:1000
3143         fsSeqNo=3
3144         in_vlan=0
3145         in_priority=0
3146         out_vlan=0
3147         out_priority=0
3148         meanSkip=1
3149         samplePool=3
3150         dropEvents=0
3151         in_ifindex=1004
3152         in_format=0
3153         out_ifindex=1003
3154         out_format=0
3155         hdr_prot=1
3156         pkt_len=64
3157         stripped=4
3158         hdr_len=60
3159         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
3160 HEADER
3161         dgramSeqNo=1
3162         ds=127.0.0.1>2:1000
3163         fsSeqNo=4
3164         in_vlan=0
3165         in_priority=0
3166         out_vlan=0
3167         out_priority=0
3168         meanSkip=1
3169         samplePool=4
3170         dropEvents=0
3171         in_ifindex=1003
3172         in_format=0
3173         out_ifindex=1004
3174         out_format=0
3175         hdr_prot=1
3176         pkt_len=64
3177         stripped=4
3178         hdr_len=60
3179         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
3180 HEADER
3181         dgramSeqNo=1
3182         ds=127.0.0.1>2:1000
3183         fsSeqNo=5
3184         in_vlan=0
3185         in_priority=0
3186         out_vlan=0
3187         out_priority=0
3188         meanSkip=1
3189         samplePool=5
3190         dropEvents=0
3191         in_ifindex=1003
3192         in_format=0
3193         out_ifindex=1004
3194         out_format=0
3195         hdr_prot=1
3196         pkt_len=64
3197         stripped=4
3198         hdr_len=60
3199         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
3200 ])
3201
3202   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR' | head -6 | sed 's/ /\
3203         /g']], [0], [dnl
3204 IFCOUNTERS
3205         dgramSeqNo=2
3206         ds=127.0.0.1>0:1002
3207         csSeqNo=1
3208         ifindex=1002
3209         type=6
3210         ifspeed=100000000
3211         direction=0
3212         status=0
3213         in_octets=0
3214         in_unicasts=0
3215         in_multicasts=0
3216         in_broadcasts=4294967295
3217         in_discards=0
3218         in_errors=0
3219         in_unknownprotos=4294967295
3220         out_octets=120
3221         out_unicasts=2
3222         out_multicasts=4294967295
3223         out_broadcasts=4294967295
3224         out_discards=0
3225         out_errors=0
3226         promiscuous=0
3227 IFCOUNTERS
3228         dgramSeqNo=2
3229         ds=127.0.0.1>0:1003
3230         csSeqNo=1
3231         ifindex=1003
3232         type=6
3233         ifspeed=100000000
3234         direction=0
3235         status=0
3236         in_octets=138
3237         in_unicasts=3
3238         in_multicasts=0
3239         in_broadcasts=4294967295
3240         in_discards=0
3241         in_errors=0
3242         in_unknownprotos=4294967295
3243         out_octets=120
3244         out_unicasts=2
3245         out_multicasts=4294967295
3246         out_broadcasts=4294967295
3247         out_discards=0
3248         out_errors=0
3249         promiscuous=0
3250 IFCOUNTERS
3251         dgramSeqNo=2
3252         ds=127.0.0.1>0:1004
3253         csSeqNo=1
3254         ifindex=1004
3255         type=6
3256         ifspeed=100000000
3257         direction=0
3258         status=0
3259         in_octets=84
3260         in_unicasts=2
3261         in_multicasts=0
3262         in_broadcasts=4294967295
3263         in_discards=0
3264         in_errors=0
3265         in_unknownprotos=4294967295
3266         out_octets=180
3267         out_unicasts=3
3268         out_multicasts=4294967295
3269         out_broadcasts=4294967295
3270         out_discards=0
3271         out_errors=0
3272         promiscuous=0
3273 IFCOUNTERS
3274         dgramSeqNo=3
3275         ds=127.0.0.1>0:1002
3276         csSeqNo=2
3277         ifindex=1002
3278         type=6
3279         ifspeed=100000000
3280         direction=0
3281         status=0
3282         in_octets=0
3283         in_unicasts=0
3284         in_multicasts=0
3285         in_broadcasts=4294967295
3286         in_discards=0
3287         in_errors=0
3288         in_unknownprotos=4294967295
3289         out_octets=120
3290         out_unicasts=2
3291         out_multicasts=4294967295
3292         out_broadcasts=4294967295
3293         out_discards=0
3294         out_errors=0
3295         promiscuous=0
3296 IFCOUNTERS
3297         dgramSeqNo=3
3298         ds=127.0.0.1>0:1003
3299         csSeqNo=2
3300         ifindex=1003
3301         type=6
3302         ifspeed=100000000
3303         direction=0
3304         status=0
3305         in_octets=138
3306         in_unicasts=3
3307         in_multicasts=0
3308         in_broadcasts=4294967295
3309         in_discards=0
3310         in_errors=0
3311         in_unknownprotos=4294967295
3312         out_octets=120
3313         out_unicasts=2
3314         out_multicasts=4294967295
3315         out_broadcasts=4294967295
3316         out_discards=0
3317         out_errors=0
3318         promiscuous=0
3319 IFCOUNTERS
3320         dgramSeqNo=3
3321         ds=127.0.0.1>0:1004
3322         csSeqNo=2
3323         ifindex=1004
3324         type=6
3325         ifspeed=100000000
3326         direction=0
3327         status=0
3328         in_octets=84
3329         in_unicasts=2
3330         in_multicasts=0
3331         in_broadcasts=4294967295
3332         in_discards=0
3333         in_errors=0
3334         in_unknownprotos=4294967295
3335         out_octets=180
3336         out_unicasts=3
3337         out_multicasts=4294967295
3338         out_broadcasts=4294967295
3339         out_discards=0
3340         out_errors=0
3341         promiscuous=0
3342 ])
3343   AT_CLEANUP])
3344
3345 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1], [IPv4])
3346 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]], [IPv6])
3347
3348 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
3349 #
3350 # Test that basic NetFlow reports flow statistics correctly:
3351 # The initial packet of a flow are correctly accounted.
3352 # Later packets within a flow are correctly accounted.
3353 # Flow actions changing (in this case, due to MAC learning)
3354 # cause a record to be sent.
3355 #
3356 # IP_VERSION_TYPE is used in AT_SETUP
3357 m4_define([CHECK_NETFLOW_EXPIRATION],
3358   [AT_SETUP([ofproto-dpif - NetFlow flow expiration - $2 collector])
3359   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
3360   ADD_OF_PORTS([br0], 1, 2)
3361
3362   ovs-appctl time/stop
3363   ON_EXIT([kill `cat test-netflow.pid`])
3364   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
3365   AT_CAPTURE_FILE([netflow.log])
3366   NETFLOW_PORT=`parse_listening_port test-netflow.log`
3367
3368   ovs-vsctl \
3369      set Bridge br0 netflow=@nf -- \
3370      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
3371        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
3372
3373   for delay in 1000 30000; do
3374       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)'
3375       sleep 1  # ensure the order in which these two packets are processed
3376       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)'
3377
3378       ovs-appctl time/warp $delay
3379   done
3380
3381   ovs-appctl time/warp 6000
3382   sleep 1
3383   OVS_VSWITCHD_STOP
3384   ovs-appctl -t test-netflow exit
3385
3386   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])
3387
3388   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])
3389
3390   combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
3391   separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
3392   AT_CHECK([test $separate = 2 || test $combined = 1], [0])
3393
3394   AT_CLEANUP])
3395
3396 CHECK_NETFLOW_EXPIRATION([127.0.0.1], [IPv4])
3397 CHECK_NETFLOW_EXPIRATION([[[::1]]], [IPv6])
3398
3399 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
3400 #
3401 # Test that basic NetFlow reports active expirations correctly.
3402 #
3403 # IP_VERSION_TYPE is used in AT_SETUP
3404 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
3405   [AT_SETUP([ofproto-dpif - NetFlow active expiration - $2 collector])
3406
3407   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
3408   ADD_OF_PORTS([br0], 1, 2)
3409
3410   ON_EXIT([kill `cat test-netflow.pid`])
3411   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
3412   AT_CAPTURE_FILE([netflow.log])
3413   NETFLOW_PORT=`parse_listening_port test-netflow.log`
3414
3415   ovs-vsctl \
3416      set Bridge br0 netflow=@nf -- \
3417      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
3418        engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
3419
3420   AT_CHECK([ovs-appctl time/stop])
3421   n=1
3422   while test $n -le 60; do
3423       n=`expr $n + 1`
3424
3425       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)'
3426       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)'
3427
3428       ovs-appctl time/warp 1000
3429   done
3430
3431   ovs-appctl time/warp 10000
3432
3433   sleep 1
3434   OVS_VSWITCHD_STOP
3435   ovs-appctl -t test-netflow exit
3436
3437   # Count the number of reported packets:
3438   # - From source to destination before MAC learning kicks in (just one).
3439   # - From source to destination after that.
3440   # - From destination to source.
3441   n_learn=0
3442   n_in=0
3443   n_out=0
3444   n_other=0
3445   n_recs=0
3446   none=0
3447   while read line; do
3448       pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
3449       case $pkts in
3450            [[0-9]]*) ;;
3451        *) continue ;;
3452       esac
3453
3454       case $line in
3455           "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
3456               counter=n_learn
3457           ;;
3458       "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
3459           counter=n_in
3460           ;;
3461       "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
3462           counter=n_out
3463           ;;
3464       *)
3465           counter=n_other
3466           ;;
3467       esac
3468       eval $counter=\`expr \$$counter + \$pkts\`
3469       n_recs=`expr $n_recs + 1`
3470   done < netflow.log
3471
3472   # There should be exactly 1 MAC learning packet,
3473   # exactly 59 other packets in that direction,
3474   # and exactly 60 packets in the other direction.
3475   AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
3476 ])
3477
3478   AT_CLEANUP])
3479
3480 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1], [IPv4])
3481 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]], [IPv6])
3482
3483 AT_SETUP([ofproto-dpif - flow stats])
3484 OVS_VSWITCHD_START
3485 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
3486 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
3487
3488 ovs-appctl time/stop
3489
3490 for i in `seq 1 10`; do
3491     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)'
3492 done
3493
3494 ovs-appctl time/warp 1000
3495 sleep 1  # wait for revalidator to update stats
3496
3497 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
3498 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
3499  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
3500  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
3501 ])
3502 OVS_VSWITCHD_STOP
3503 AT_CLEANUP
3504
3505 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
3506 OVS_VSWITCHD_START
3507 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
3508 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
3509
3510 ovs-appctl time/stop
3511
3512 for i in `seq 1 10`; do
3513     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)'
3514 done
3515
3516 ovs-appctl time/warp 100
3517 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
3518 ovs-appctl time/warp 1000
3519
3520 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
3521 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
3522  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
3523  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
3524 ])
3525 OVS_VSWITCHD_STOP
3526 AT_CLEANUP
3527
3528 AT_SETUP([idle_age and hard_age increase over time])
3529 OVS_VSWITCHD_START
3530
3531 # get_ages DURATION HARD IDLE
3532 #
3533 # Fetch the flow duration, hard age, and idle age into the variables
3534 # whose names are given as arguments.  Rounds DURATION down to the
3535 # nearest integer.  If hard_age doesn't appear in the output, sets
3536 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
3537 # to 0.
3538 get_ages () {
3539     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
3540
3541     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
3542     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
3543     AS_VAR_COPY([$1], [duration])
3544
3545     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
3546     if test X"$hard" = X; then
3547         hard=none
3548     else
3549         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
3550     fi
3551     AS_VAR_COPY([$2], [hard])
3552
3553     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
3554     if test X"$idle" = X; then
3555         idle=0
3556     else
3557         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
3558     fi
3559     AS_VAR_COPY([$3], [idle])
3560 }
3561
3562 # Add a flow and get its initial hard and idle age.
3563 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
3564 get_ages duration1 hard1 idle1
3565
3566 ovs-appctl time/stop
3567 # Warp time forward by 10 seconds, then modify the flow's actions.
3568 ovs-appctl time/warp 10000
3569 get_ages duration2 hard2 idle2
3570 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
3571
3572 # Warp time forward by 10 seconds.
3573 ovs-appctl time/warp 10000
3574 get_ages duration3 hard3 idle3
3575
3576 # Warp time forward 10 more seconds, then pass some packets through the flow,
3577 # then warp forward a few more times because idle times are only updated
3578 # occasionally.
3579 ovs-appctl time/warp 10000
3580 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)'
3581 ovs-appctl time/warp 1000
3582 ovs-appctl time/warp 1000
3583 ovs-appctl time/warp 1000
3584 sleep 1
3585 get_ages duration4 hard4 idle4
3586
3587 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
3588 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
3589 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
3590
3591 # Duration should increase steadily over time.
3592 AT_CHECK([test $duration1 -lt $duration2])
3593 AT_CHECK([test $duration2 -lt $duration3])
3594 AT_CHECK([test $duration3 -lt $duration4])
3595
3596 # Hard age should be "none" initially because it's the same as flow_duration,
3597 # then it should increase.
3598 AT_CHECK([test $hard1 = none])
3599 AT_CHECK([test $hard2 = none])
3600 AT_CHECK([test $hard3 != none])
3601 AT_CHECK([test $hard4 != none])
3602 AT_CHECK([test $hard3 -lt $hard4])
3603
3604 # Idle age should increase from 1 to 2 to 3, then decrease.
3605 AT_CHECK([test $idle1 -lt $idle2])
3606 AT_CHECK([test $idle2 -lt $idle3])
3607 AT_CHECK([test $idle3 -gt $idle4])
3608
3609 # Check some invariant relationships.
3610 AT_CHECK([test $duration1 = $idle1])
3611 AT_CHECK([test $duration2 = $idle2])
3612 AT_CHECK([test $duration3 = $idle3])
3613 AT_CHECK([test $idle3 -gt $hard3])
3614 AT_CHECK([test $idle4 -lt $hard4])
3615 AT_CHECK([test $hard4 -lt $duration4])
3616
3617 OVS_VSWITCHD_STOP
3618 AT_CLEANUP
3619
3620 AT_SETUP([ofproto-dpif - fin_timeout])
3621 OVS_VSWITCHD_START
3622 AT_DATA([flows.txt], [dnl
3623 in_port=1 actions=output:2
3624 in_port=2 actions=mod_vlan_vid:17,output:1
3625 ])
3626 ovs-appctl time/stop
3627 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
3628 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
3629 [NXST_FLOW reply:
3630  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
3631 ])
3632
3633 # Check that a TCP SYN packet does not change the timeout.  (Because
3634 # flow stats updates are mainly what implements the fin_timeout
3635 # feature, we warp forward a couple of times to ensure that flow stats
3636 # run before re-checking the flow table.)
3637 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
3638 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
3639 warped
3640 ])
3641 sleep 1
3642 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
3643 [NXST_FLOW reply:
3644  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
3645 ])
3646 # Check that a TCP FIN packet does change the timeout.
3647 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
3648 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
3649 warped
3650 ])
3651 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
3652 [NXST_FLOW reply:
3653  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
3654 ])
3655 OVS_VSWITCHD_STOP
3656 AT_CLEANUP
3657
3658 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
3659 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
3660 ADD_OF_PORTS([br0], [1], [2])
3661 ADD_OF_PORTS([br1], [3])
3662
3663 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
3664 dummy@br0
3665 dummy@br1
3666 ])
3667 OVS_VSWITCHD_STOP
3668 AT_CLEANUP
3669
3670 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
3671 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
3672 ADD_OF_PORTS([br0], [1], [2])
3673 ADD_OF_PORTS([br1], [3])
3674
3675 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
3676 dummy@ovs-dummy: hit:0 missed:0
3677         br0:
3678                 br0 65534/100: (dummy)
3679                 p1 1/1: (dummy)
3680                 p2 2/2: (dummy)
3681         br1:
3682                 br1 65534/101: (dummy)
3683                 p3 3/3: (dummy)
3684 ])
3685 OVS_VSWITCHD_STOP
3686 AT_CLEANUP
3687
3688 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
3689 # bump max-idle to avoid the flows being reclaimed behind us
3690 OVS_VSWITCHD_START([add-br br1 -- \
3691                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
3692                     set Open_vSwitch . other_config:max-idle=10000])
3693 ADD_OF_PORTS([br0], [1], [2])
3694 ADD_OF_PORTS([br1], [3])
3695
3696 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)'])
3697 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)'])
3698 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)'])
3699 sleep 1  # wait for upcall handlers
3700 AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl
3701 skb_priority(0),recirc_id(0),in_port(1),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/0xff), packets:0, bytes:0, used:never, actions:drop
3702 skb_priority(0),recirc_id(0),in_port(2),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/0xff), packets:0, bytes:0, used:never, actions:drop
3703 ])
3704
3705 AT_CHECK([ovs-appctl dpif/dump-flows br1 | sort | STRIP_USED], [0], [dnl
3706 skb_priority(0),recirc_id(0),in_port(3),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/0xff), packets:0, bytes:0, used:never, actions:drop
3707 ])
3708
3709 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sort | STRIP_USED], [0], [dnl
3710 skb_priority(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/0xff),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
3711 skb_priority(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/0xff),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
3712 ])
3713
3714 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | sort | STRIP_USED], [0], [dnl
3715 skb_priority(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/0xff),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
3716 ])
3717
3718 OVS_VSWITCHD_STOP
3719 AT_CLEANUP
3720
3721 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
3722 OVS_VSWITCHD_START([dnl
3723    add-port br0 p1 -- set Interface p1 type=dummy
3724 ])
3725 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3726 ON_EXIT([kill `cat ovs-ofctl.pid`])
3727
3728 AT_CAPTURE_FILE([ofctl_monitor.log])
3729 AT_DATA([flows.txt], [dnl
3730 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3731 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
3732 ])
3733 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3734
3735 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
3736 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
3737 dnl
3738 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
3739 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)
3740 dnl         (label 20, exp 0, [S], ttl 32)
3741 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
3742 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
3743
3744 for dl_src in 00 01; do
3745     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"])
3746 done
3747 sleep 1  # wait for the datapath flow installed
3748 for dl_src in 00 01; do
3749     AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep ":$dl_src/" | STRIP_USED], [0], [dnl
3750 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=60:66:66:66:66:$dl_src/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x8847),mpls(lse0=0x14020,lse1=0x14120), actions:userspace(pid=0,slow_path(controller))
3751 ])
3752 done
3753
3754 OVS_VSWITCHD_STOP
3755 AT_CLEANUP
3756
3757
3758 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
3759 OVS_VSWITCHD_START([dnl
3760    add-port br0 p1 -- set Interface p1 type=dummy
3761 ])
3762 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3763 ON_EXIT([kill `cat ovs-ofctl.pid`])
3764
3765 AT_CAPTURE_FILE([ofctl_monitor.log])
3766 AT_DATA([flows.txt], [dnl
3767 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3768 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
3769 ])
3770 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3771
3772 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
3773 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
3774 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
3775 dnl
3776 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
3777 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)
3778 dnl         (label 20, exp 0, ttl 32)
3779 dnl         (label 20, exp 0, ttl 32)
3780 dnl         (label 20, exp 0, [S], ttl 32)
3781 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
3782 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
3783
3784 for dl_src in 00 01; do
3785     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"])
3786 done
3787 sleep 1  # wait for the datapath flow installed
3788 for dl_src in 00 01; do
3789     AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep ":$dl_src/" | STRIP_USED], [0], [dnl
3790 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=60:66:66:66:66:$dl_src/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x8847),mpls(lse0=0x14020,lse1=0x14120), actions:userspace(pid=0,slow_path(controller))
3791 ])
3792 done
3793
3794 OVS_VSWITCHD_STOP
3795 AT_CLEANUP
3796
3797 AT_SETUP([ofproto-dpif - patch ports])
3798 OVS_VSWITCHD_START([add-br br1 \
3799 -- set bridge br1 datapath-type=dummy fail-mode=secure \
3800 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
3801 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
3802
3803 ADD_OF_PORTS([br0], [2])
3804 ADD_OF_PORTS([br1], [3])
3805
3806 AT_CHECK([ovs-appctl time/stop])
3807 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3808
3809 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
3810 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
3811
3812 for i in $(seq 1 10); do
3813     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)'
3814     if [[ $i -eq 1 ]]; then
3815         sleep 1
3816     fi
3817 done
3818
3819 for i in $(seq 1 5); do
3820     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)'
3821     if [[ $i -eq 1 ]]; then
3822         sleep 1
3823     fi
3824 done
3825
3826 AT_CHECK([ovs-appctl time/warp 500], [0],
3827 [warped
3828 ])
3829 sleep 1  # wait for log writer
3830
3831 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
3832 dummy@ovs-dummy: hit:13 missed:2
3833         br0:
3834                 br0 65534/100: (dummy)
3835                 p2 2/2: (dummy)
3836                 pbr0 1/none: (patch: peer=pbr1)
3837         br1:
3838                 br1 65534/101: (dummy)
3839                 p3 3/3: (dummy)
3840                 pbr1 1/none: (patch: peer=pbr0)
3841 ])
3842
3843 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
3844 skb_priority(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/0xff),icmp(type=8/0,code=0/0), actions:101,3,2
3845 skb_priority(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/0xff),icmp(type=8/0,code=0/0), actions:100,2,3
3846 ])
3847
3848 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | FILTER_FLOW_DUMP], [0], [dnl
3849 skb_priority(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/0xff),icmp(type=8/0,code=0/0), packets:9, bytes:540, used:0.0s, actions:101,3,2
3850 ])
3851 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | FILTER_FLOW_DUMP], [0], [dnl
3852 skb_priority(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/0xff),icmp(type=8/0,code=0/0), packets:4, bytes:240, used:0.0s, actions:100,2,3
3853 ])
3854
3855 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
3856 OFPST_PORT reply (xid=0x4): 1 ports
3857   port  1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
3858            tx pkts=10, bytes=600, drop=0, errs=0, coll=0
3859 ])
3860
3861 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
3862 OFPST_PORT reply (xid=0x4): 1 ports
3863   port  1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
3864            tx pkts=5, bytes=300, drop=0, errs=0, coll=0
3865 ])
3866
3867 OVS_VSWITCHD_STOP
3868 AT_CLEANUP
3869
3870 AT_SETUP([ofproto-dpif - port duration])
3871 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
3872 ADD_OF_PORTS([br0], 1, 2)
3873
3874 ovs-appctl time/stop
3875 ovs-appctl time/warp 10000
3876
3877 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
3878 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
3879 [dnl
3880            duration=?s
3881            duration=?s
3882            duration=?s
3883 ])
3884 OVS_VSWITCHD_STOP
3885 AT_CLEANUP
3886
3887 dnl ----------------------------------------------------------------------
3888 AT_BANNER([ofproto-dpif -- megaflows])
3889
3890 AT_SETUP([ofproto-dpif megaflow - port classification])
3891 OVS_VSWITCHD_START
3892 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3893 ADD_OF_PORTS([br0], [1], [2])
3894 AT_DATA([flows.txt], [dnl
3895 table=0 in_port=1 actions=output(2)
3896 ])
3897 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3898 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)'])
3899 sleep 1
3900 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)'])
3901 sleep 1
3902 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3903 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/0xff),icmp(type=8/0,code=0/0), actions: <del>
3904 ])
3905 OVS_VSWITCHD_STOP
3906 AT_CLEANUP
3907
3908 AT_SETUP([ofproto-dpif megaflow - L2 classification])
3909 OVS_VSWITCHD_START
3910 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3911 ADD_OF_PORTS([br0], [1], [2])
3912 AT_DATA([flows.txt], [dnl
3913 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
3914 ])
3915 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3916 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)'])
3917 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)'])
3918 sleep 1
3919 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3920 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,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/0xff),icmp(type=8/0,code=0/0), actions: <del>
3921 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
3922 ])
3923 OVS_VSWITCHD_STOP
3924 AT_CLEANUP
3925
3926 AT_SETUP([ofproto-dpif megaflow - L3 classification])
3927 OVS_VSWITCHD_START
3928 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3929 ADD_OF_PORTS([br0], [1], [2])
3930 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], [])
3931 AT_DATA([flows.txt], [dnl
3932 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
3933 ])
3934 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3935 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)'])
3936 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)'])
3937 sleep 1
3938 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3939 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/255.255.255.252,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
3940 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/255.255.255.255,dst=10.0.0.3/0.0.0.0,proto=1/0xff,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
3941 ])
3942 OVS_VSWITCHD_STOP
3943 AT_CLEANUP
3944
3945 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
3946 OVS_VSWITCHD_START
3947 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3948 ADD_OF_PORTS([br0], [1], [2])
3949 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], [])
3950 AT_DATA([flows.txt], [dnl
3951 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
3952 ])
3953 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3954 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)'])
3955 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)'])
3956 sleep 1
3957 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3958 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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(0x86dd),ipv6(src=2001:db8:3c4d:1:2:3:4:5/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff,dst=fe80::2/::,label=0/0,proto=10/0,tclass=0x70/0,hlimit=128/0,frag=no/0xff), actions: <del>
3959 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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(0x86dd),ipv6(src=2001:db8:3c4d:5:4:3:2:1/ffff:ffff:ffff:fffc::,dst=2001:db8:3c4d:1:2:3:4:1/::,label=0/0,proto=99/0,tclass=0x70/0,hlimit=64/0,frag=no/0xff), actions: <del>
3960 ])
3961 OVS_VSWITCHD_STOP
3962 AT_CLEANUP
3963
3964 AT_SETUP([ofproto-dpif megaflow - L4 classification])
3965 OVS_VSWITCHD_START
3966 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3967 ADD_OF_PORTS([br0], [1], [2])
3968 AT_DATA([flows.txt], [dnl
3969 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
3970 ])
3971 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3972 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)'])
3973 sleep 1
3974 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)'])
3975 sleep 1
3976 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3977 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/0xff,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0xff,code=0/0), actions: <del>
3978 ])
3979 OVS_VSWITCHD_STOP
3980 AT_CLEANUP
3981
3982 AT_SETUP([ofproto-dpif megaflow - normal])
3983 OVS_VSWITCHD_START
3984 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
3985 ADD_OF_PORTS([br0], [1], [2])
3986 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
3987 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)'])
3988 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)'])
3989 sleep 1
3990 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
3991 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
3992 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
3993 ])
3994 OVS_VSWITCHD_STOP
3995 AT_CLEANUP
3996
3997 AT_SETUP([ofproto-dpif megaflow - mpls])
3998 OVS_VSWITCHD_START
3999 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4000 ADD_OF_PORTS([br0], [1], [2])
4001 AT_DATA([flows.txt], [dnl
4002 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
4003 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
4004 ])
4005 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4006 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)'])
4007 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)'])
4008 sleep 1
4009 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4010 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions: <del>
4011 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x8847),mpls(label=11,tc=3,ttl=64,bos=1), actions: <del>
4012 ])
4013 OVS_VSWITCHD_STOP
4014 AT_CLEANUP
4015
4016 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR, IP_VERSION_TYPE)
4017 #
4018 # IP_VERSION_TYPE is used in AT_SETUP
4019 m4_define([CHECK_MEGAFLOW_NETFLOW],
4020   [AT_SETUP([ofproto-dpif megaflow - netflow - $2 collector])
4021   OVS_VSWITCHD_START
4022   AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4023   ADD_OF_PORTS([br0], [1], [2])
4024
4025   dnl NetFlow configuration disables wildcarding relevant fields
4026   ON_EXIT([kill `cat test-netflow.pid`])
4027   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4028   AT_CAPTURE_FILE([netflow.log])
4029   NETFLOW_PORT=`parse_listening_port test-netflow.log`
4030   ovs-vsctl \
4031      set Bridge br0 netflow=@nf -- \
4032      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4033        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
4034
4035   AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4036   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)'])
4037   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)'])
4038   sleep 1
4039   AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4040 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/255.255.255.255,dst=10.0.0.1/255.255.255.255,proto=1/0xff,tos=0/0xfc,ttl=64/0,frag=no/0xff),icmp(type=8,code=0), actions: <del>
4041 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/255.255.255.255,dst=10.0.0.3/255.255.255.255,proto=1/0xff,tos=0/0xfc,ttl=64/0,frag=no/0xff),icmp(type=8,code=0), actions: <del>
4042 ])
4043   OVS_VSWITCHD_STOP
4044   AT_CLEANUP])
4045
4046 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4047 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4048
4049 AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
4050 OVS_VSWITCHD_START(
4051   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
4052    add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
4053    set interface p2 type=dummy ofport_request=2 -- \
4054    set interface p3 type=dummy ofport_request=3])
4055 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4056 ])
4057 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4058
4059 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4060 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)'])
4061 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)'])
4062 sleep 1
4063 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4064 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4065 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4066 ])
4067 OVS_VSWITCHD_STOP
4068 AT_CLEANUP
4069
4070 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
4071 OVS_VSWITCHD_START(
4072   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
4073    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
4074    set interface p2 type=dummy ofport_request=2 -- \
4075    set interface p3 type=dummy ofport_request=3])
4076 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4077 ])
4078 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4079
4080 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4081 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)'])
4082 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)'])
4083 sleep 1
4084 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4085 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4086 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4087 ])
4088 OVS_VSWITCHD_STOP
4089 AT_CLEANUP
4090
4091 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
4092 # Create bond0 on br0 with interfaces p0 and p1
4093 #    and bond1 on br1 with interfaces p2 and p3
4094 # with p0 patched to p2 and p1 patched to p3.
4095 OVS_VSWITCHD_START(
4096   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
4097                             other-config:lacp-time=fast \
4098                             other-config:bond-rebalance-interval=0 -- \
4099    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
4100    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
4101    add-br br1 -- \
4102    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
4103    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
4104                   fail-mode=secure -- \
4105    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
4106                             other-config:lacp-time=fast \
4107                             other-config:bond-rebalance-interval=0 -- \
4108    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
4109    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
4110
4111 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4112 ])
4113 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4114 ADD_OF_PORTS([br0], [7])
4115 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4116 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
4117 ovs-appctl time/stop
4118 ovs-appctl time/warp 5000
4119 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)'])
4120 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)'])
4121 sleep 1
4122 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4123 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),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/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4124 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),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.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4125 ])
4126 OVS_VSWITCHD_STOP
4127 AT_CLEANUP
4128
4129 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
4130 OVS_VSWITCHD_START
4131 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4132 ADD_OF_PORTS([br0], [1], [2])
4133 AT_DATA([flows.txt], [dnl
4134 table=0 in_port=1,ip actions=resubmit(90)
4135 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
4136 ])
4137 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4138 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)'])
4139 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)'])
4140 sleep 1
4141 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4142 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,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/0xff),icmp(type=8/0,code=0/0), actions: <del>
4143 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4144 ])
4145 OVS_VSWITCHD_STOP
4146 AT_CLEANUP
4147
4148 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
4149 OVS_VSWITCHD_START
4150 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4151 ADD_OF_PORTS([br0], [1], [2])
4152 AT_DATA([flows.txt], [dnl
4153 table=0 in_port=1,ip actions=resubmit(,1)
4154 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
4155 ])
4156 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4157 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)'])
4158 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=
4159 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
4160 sleep 1
4161 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4162 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,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/0xff),icmp(type=8/0,code=0/0), actions: <del>
4163 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4164 ])
4165 OVS_VSWITCHD_STOP
4166 AT_CLEANUP
4167
4168 AT_SETUP([ofproto-dpif megaflow - goto_table action])
4169 OVS_VSWITCHD_START
4170 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4171 ADD_OF_PORTS([br0], [1], [2])
4172 AT_DATA([flows.txt], [dnl
4173 table=0 in_port=1,ip actions=goto_table(1)
4174 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
4175 ])
4176 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
4177 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)'])
4178 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)'])
4179 sleep 1
4180 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4181 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,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/0xff),icmp(type=8/0,code=0/0), actions: <del>
4182 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4183 ])
4184 OVS_VSWITCHD_STOP
4185 AT_CLEANUP
4186
4187 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
4188 OVS_VSWITCHD_START
4189 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4190 ADD_OF_PORTS([br0], [1], [2], [3])
4191 ovs-vsctl \
4192         set Bridge br0 mirrors=@m --\
4193         --id=@p3 get Port p3 --\
4194         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4195
4196 AT_DATA([flows.txt], [dnl
4197 in_port=1 actions=output:2
4198 ])
4199 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4200 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)'])
4201 sleep 1
4202 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)'])
4203 sleep 1
4204 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4205 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/0xff),icmp(type=8/0,code=0/0), actions: <del>
4206 ])
4207 OVS_VSWITCHD_STOP
4208 AT_CLEANUP
4209
4210 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
4211 OVS_VSWITCHD_START
4212 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4213 ADD_OF_PORTS([br0], [1], [2], [3])
4214 ovs-vsctl \
4215         set Bridge br0 mirrors=@m --\
4216         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
4217         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
4218
4219 AT_DATA([flows.txt], [dnl
4220 in_port=1 actions=output:2
4221 ])
4222 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4223 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))'])
4224 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)'])
4225 sleep 1
4226 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4227 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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(0x8100),vlan(vid=11/0xfff,pcp=7/0x0,cfi=1/1),encap(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/0xff),icmp(type=8/0,code=0/0)), actions: <del>
4228 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4229 ])
4230 OVS_VSWITCHD_STOP
4231 AT_CLEANUP
4232
4233 AT_SETUP([ofproto-dpif megaflow - move action])
4234 OVS_VSWITCHD_START
4235 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4236 ADD_OF_PORTS([br0], [1], [2])
4237 AT_DATA([flows.txt], [dnl
4238 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
4239 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
4240 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
4241 ])
4242 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4243 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)'])
4244 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)'])
4245 sleep 1
4246 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4247 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/255.255.255.255,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4248 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/255.255.255.255,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4249 ])
4250 OVS_VSWITCHD_STOP
4251 AT_CLEANUP
4252
4253 AT_SETUP([ofproto-dpif megaflow - push action])
4254 OVS_VSWITCHD_START
4255 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4256 ADD_OF_PORTS([br0], [1], [2])
4257 AT_DATA([flows.txt], [dnl
4258 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
4259 ])
4260 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4261 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)'])
4262 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)'])
4263 sleep 1
4264 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4265 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/255.255.255.255,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4266 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/255.255.255.255,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4267 ])
4268 OVS_VSWITCHD_STOP
4269 AT_CLEANUP
4270
4271 AT_SETUP([ofproto-dpif megaflow - learning])
4272 OVS_VSWITCHD_START
4273 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4274 ADD_OF_PORTS([br0], [1], [2])
4275 AT_DATA([flows.txt], [dnl
4276 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
4277 ])
4278 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4279 ovs-appctl time/stop
4280 # We send each packet twice because the first packet in each flow causes the
4281 # flow table to change and thus revalidations, which (depending on timing)
4282 # can keep a megaflow from being installed.  The revalidations are done by
4283 # the second iteration, allowing the flows to be installed.
4284 for i in 1 2; do
4285     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)'])
4286     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)'])
4287     ovs-appctl time/warp 100
4288 done
4289 sleep 1
4290 dnl The original flow is missing due to a revalidation.
4291 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4292 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/ff:ff:ff:ff:ff:ff,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/0xff),icmp(type=8/0,code=0/0), actions: <del>
4293 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/ff:ff:ff:ff:ff:ff,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4294 ])
4295 OVS_VSWITCHD_STOP
4296 AT_CLEANUP
4297
4298 AT_SETUP([ofproto-dpif megaflow - tunnels])
4299 OVS_VSWITCHD_START(
4300   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
4301 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4302 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
4303      options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
4304 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
4305           ofport_request=3])
4306 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
4307      options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
4308      ofport_request=4 options:key=flow])
4309 AT_DATA([flows.txt], [dnl
4310 in_port=1,actions=output(2)
4311 in_port=3,actions=output(4)
4312 ])
4313 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4314 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
4315 dnl will cause the packet to be dropped.
4316 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)'])
4317 sleep 1
4318 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)'])
4319 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)'])
4320 sleep 1
4321 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)'])
4322 sleep 1
4323 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4324 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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=0xfd/0x3,ttl=128/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4325 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(3),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=0xfd/0xff,ttl=128/0xff,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4326 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(3),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.4/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0x1/0xff,ttl=64/0xff,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4327 ])
4328 OVS_VSWITCHD_STOP
4329 AT_CLEANUP
4330
4331 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
4332 OVS_VSWITCHD_START
4333 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4334 ADD_OF_PORTS([br0], [1], [2])
4335 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], [])
4336 AT_DATA([flows.txt], [dnl
4337 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
4338 ])
4339 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4340 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)'])
4341 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)'])
4342 sleep 1
4343 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4344 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),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/255.255.255.252,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions: <del>
4345 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:0b/00:00:00:00:00:00,dst=50:54:00:00:00:0c/00:00:00:00:00:00),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/0,code=0/0), actions: <del>
4346 ])
4347 OVS_VSWITCHD_STOP
4348 AT_CLEANUP
4349
4350 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
4351 OVS_VSWITCHD_START
4352 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4353 ADD_OF_PORTS([br0], [1], [2])
4354 AT_DATA([flows.txt], [dnl
4355 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
4356 ])
4357 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4358 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)'])
4359 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)'])
4360 sleep 1
4361 dnl The megaflows do not match the same fields, since the first packet
4362 dnl is essentially a no-op.  (The new destination MAC is the same as the
4363 dnl original.) The ofproto-dpif library un-wildcards the destination MAC
4364 dnl so that a packet that doesn't need its MAC address changed doesn't
4365 dnl hide one that does.  Since the first entry doesn't need to change,
4366 dnl only the destination MAC address is matched (as decided by
4367 dnl ofproto-dpif).  The second entry actually updates the destination
4368 dnl MAC, so both the source and destination MAC addresses are
4369 dnl un-wildcarded, since the ODP commit functions update both the source
4370 dnl and destination MAC addresses.
4371 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
4372 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/ff:ff:ff:ff:ff:ff),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/0xff),icmp(type=8/0,code=0/0), actions:2
4373 skb_priority(0),skb_mark(0/0),recirc_id(0),dp_hash(0/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/0.0.0.0,dst=10.0.0.3/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no/0xff),icmp(type=8/0,code=0/0), actions:set(eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0a)),2
4374 ])
4375 OVS_VSWITCHD_STOP
4376 AT_CLEANUP
4377
4378 AT_SETUP([ofproto-dpif megaflow - disabled])
4379 OVS_VSWITCHD_START
4380 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4381 ADD_OF_PORTS([br0], [1], [2])
4382 AT_DATA([flows.txt], [dnl
4383 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
4384 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
4385 ])
4386 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
4387 ], [])
4388 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
4389 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4390 for i in 1 2 3 4; do
4391     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)'])
4392     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)'])
4393     if [[ $i -eq 1 ]]; then
4394         sleep 1
4395     fi
4396 done
4397 sleep 1
4398 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
4399 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), actions:2
4400 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), actions:drop
4401 ])
4402 AT_CHECK([cat ovs-vswitchd.log | grep '00:09.*packets:3' | FILTER_FLOW_DUMP], [0], [dnl
4403 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
4404 ])
4405 AT_CHECK([cat ovs-vswitchd.log | grep '00:0b.*packets:3' | FILTER_FLOW_DUMP], [0], [dnl
4406 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
4407 ])
4408 OVS_VSWITCHD_STOP
4409 AT_CLEANUP
4410
4411 AT_SETUP([ofproto-dpif - datapath port number change])
4412 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4413 ADD_OF_PORTS([br0], 1)
4414
4415 # Trace a flow that should output to p1.
4416 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
4417   [0], [stdout])
4418 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
4419 ])
4420
4421 # Change p1's port number to 5.
4422 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
4423
4424 # Trace a flow that should output to p1 in its new location.
4425 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
4426   [0], [stdout])
4427 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
4428 ])
4429 OVS_VSWITCHD_STOP
4430 AT_CLEANUP
4431
4432 # Tests the bundling with various bfd and cfm configurations.
4433 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
4434 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
4435                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
4436                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
4437                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
4438                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
4439                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
4440                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
4441                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
4442                     set Interface p0 cfm_mpid=1 -- \
4443                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
4444
4445 ovs-appctl time/stop
4446 # advance the clock to stablize everything.
4447 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
4448 # cfm/show should show 'recv' fault.
4449 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
4450         fault: recv
4451 ])
4452 # bfd/show should show 'up'.
4453 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
4454         Local Session State: up
4455         Remote Session State: up
4456         Local Session State: up
4457         Remote Session State: up
4458 ])
4459 # bond/show should show 'may-enable: true' for all slaves.
4460 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
4461         may_enable: true
4462         may_enable: true
4463         may_enable: true
4464         may_enable: true
4465 ])
4466
4467 # now disable the bfd on p1.
4468 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
4469 # advance the clock to stablize everything.
4470 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
4471 # cfm/show should show 'recv' fault.
4472 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
4473         fault: recv
4474 ])
4475 # bfd/show should show 'down'.
4476 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
4477         Local Session State: down
4478         Remote Session State: down
4479 ])
4480 # bond/show should show 'may-enable: false' for p0.
4481 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
4482         may_enable: false
4483         may_enable: true
4484 ])
4485
4486 # now enable the bfd on p1 and disable bfd on p0.
4487 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
4488 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
4489 # advance the clock to stablize everything.
4490 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
4491 # cfm/show should show 'recv' fault.
4492 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
4493         fault: recv
4494 ])
4495 # bfd/show should show 'down'.
4496 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
4497         Local Session State: down
4498         Remote Session State: down
4499 ])
4500 # bond/show should show 'may-enable: false' for p0 and p1.
4501 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
4502         may_enable: false
4503         may_enable: true
4504         may_enable: false
4505         may_enable: true
4506 ])
4507
4508 OVS_VSWITCHD_STOP
4509 AT_CLEANUP
4510
4511 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
4512 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
4513
4514 # enable bfd on p0.
4515 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
4516 # check log.
4517 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
4518 # disable bfd on p0.
4519 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
4520 # check log.
4521 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
4522 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
4523
4524 # enable cfm on p0.
4525 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
4526 # check log.
4527 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
4528 # disable cfm on p0.
4529 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
4530 # check log.
4531 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
4532 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
4533
4534 # enable both bfd and cfm on p0.
4535 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
4536 # check log.
4537 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
4538 # disable bfd on p0.
4539 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
4540 # check log, there should not be the log of thread terminated.
4541 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
4542 ])
4543 # reenable bfd on p0.
4544 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
4545 # check log, should still be on log of thread created.
4546 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
4547 monitor thread created
4548 ])
4549 # disable bfd and cfm together.
4550 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
4551 # check log.
4552 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
4553
4554 OVS_VSWITCHD_STOP
4555 AT_CLEANUP
4556
4557 # this test helps avoid the deadlock between the main thread and monitor thread.
4558 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
4559 OVS_VSWITCHD_START
4560
4561 for i in `seq 1 199`
4562 do
4563     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])
4564 done
4565
4566 OVS_VSWITCHD_STOP
4567 AT_CLEANUP
4568 \f
4569 AT_BANNER([ofproto-dpif - flow translation resource limits])
4570
4571 AT_SETUP([ofproto-dpif - infinite resubmit])
4572 OVS_VSWITCHD_START
4573 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
4574 AT_CHECK([ovs-appctl ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
4575   [0], [stdout])
4576 AT_CHECK([tail -1 stdout], [0], [Datapath actions: drop
4577 ])
4578 AT_CHECK([grep -c 'resubmit actions recursed over 64 times' ovs-vswitchd.log],
4579   [0], [1
4580 ])
4581 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
4582 AT_CLEANUP
4583
4584 AT_SETUP([ofproto-dpif - exponential resubmit chain])
4585 OVS_VSWITCHD_START
4586 ADD_OF_PORTS([br0], 1)
4587 (for i in `seq 1 64`; do
4588      j=`expr $i + 1`
4589      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
4590  done
4591  echo "in_port=65, actions=local") > flows
4592  AT_CHECK([ovs-ofctl add-flows br0 flows])
4593 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
4594 AT_CHECK([grep -c 'over 4096 resubmit actions' ovs-vswitchd.log], [0], [1
4595 ])
4596 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
4597 AT_CLEANUP
4598
4599 AT_SETUP([ofproto-dpif - too many output actions])
4600 OVS_VSWITCHD_START
4601 ADD_OF_PORTS([br0], 1)
4602 (for i in `seq 1 12`; do
4603      j=`expr $i + 1`
4604      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
4605  done
4606  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
4607 AT_CHECK([ovs-ofctl add-flows br0 flows])
4608 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
4609 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
4610   [0], [1
4611 ])
4612 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' ovs-vswitchd.log], [0], [1
4613 ])
4614 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
4615 AT_CLEANUP
4616
4617 AT_SETUP([ofproto-dpif - stack too deep])
4618 OVS_VSWITCHD_START
4619 ADD_OF_PORTS([br0], 1)
4620 (for i in `seq 1 12`; do
4621      j=`expr $i + 1`
4622      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
4623  done
4624  push="push:NXM_NX_REG0[[]]"
4625  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
4626  AT_CHECK([ovs-ofctl add-flows br0 flows])
4627 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
4628 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' ovs-vswitchd.log], [0], [1
4629 ])
4630 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
4631 AT_CLEANUP
4632
4633
4634 AT_SETUP([ofproto-if packet-out controller])
4635 OVS_VSWITCHD_START
4636 ADD_OF_PORTS([br0], 1, 2)
4637
4638 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
4639
4640 AT_CAPTURE_FILE([ofctl_monitor.log])
4641 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4642
4643 for i in 1 2 3; do
4644         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
4645 done
4646
4647 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
4648 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
4649 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4650 metadata=0,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
4651 dnl
4652 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4653 metadata=0,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
4654 dnl
4655 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
4656 metadata=0,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
4657 ])
4658
4659 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
4660  dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
4661 NXST_FLOW reply:
4662 ])
4663
4664 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
4665  echo "  0: active=1, lookup=0, matched=0"
4666  x=1
4667  while test $x -lt 254; do
4668    echo "  $x: active=0, lookup=0, matched=0"
4669    x=`expr $x + 1`
4670  done) > expout
4671 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
4672
4673 OVS_VSWITCHD_STOP
4674 AT_CLEANUP
4675
4676
4677 AT_SETUP([ofproto-if packet-out controller (patch port)])
4678 OVS_VSWITCHD_START(
4679   [-- \
4680    add-port br0 p1 -- \
4681    set interface p1 type=patch options:peer=p2 -- \
4682    add-br br1 -- \
4683    set bridge br1 datapath-type=dummy -- \
4684    set bridge br1 fail-mode=secure -- \
4685    set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
4686    add-port br1 p2 -- \
4687    set interface p2 type=patch options:peer=p1 --])
4688
4689 AT_CAPTURE_FILE([ofctl_monitor.log])
4690 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4691
4692 for i in 1 2 3; do
4693         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
4694 done
4695
4696 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
4697 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
4698 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
4699 metadata=0,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
4700 dnl
4701 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
4702 metadata=0,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
4703 dnl
4704 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
4705 metadata=0,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
4706 ])
4707
4708 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
4709  x=0
4710  while test $x -lt 254; do
4711    echo "  $x: active=0, lookup=0, matched=0"
4712    x=`expr $x + 1`
4713  done) > expout
4714 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
4715
4716 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
4717  echo "  0: active=0, lookup=3, matched=0"
4718  x=1
4719  while test $x -lt 254; do
4720    echo "  $x: active=0, lookup=0, matched=0"
4721    x=`expr $x + 1`
4722  done) > expout
4723 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
4724
4725 OVS_VSWITCHD_STOP
4726 AT_CLEANUP
4727
4728
4729 AT_SETUP([ofproto-if packet-out goto_table])
4730 OVS_VSWITCHD_START
4731 ADD_OF_PORTS([br0], 1, 2)
4732
4733 AT_DATA([flows.txt], [dnl
4734 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
4735 table=1 dl_dst=50:54:00:00:00:0a actions=controller
4736 ])
4737 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
4738
4739 AT_CAPTURE_FILE([ofctl_monitor.log])
4740 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4741
4742 for i in 1 2 3; do
4743     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)'
4744 done
4745
4746 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
4747 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
4748 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
4749 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4750 metadata=0,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
4751 dnl
4752 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4753 metadata=0,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
4754 dnl
4755 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4756 metadata=0,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
4757 ])
4758
4759 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
4760
4761 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
4762  n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
4763  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
4764 OFPST_FLOW reply (OF1.3):
4765 ])
4766
4767 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
4768  echo "  0: active=1, lookup=3, matched=3"
4769  echo "  1: active=1, lookup=3, matched=3"
4770  x=2
4771  while test $x -lt 254; do
4772    echo "  $x: active=0, lookup=0, matched=0"
4773    x=`expr $x + 1`
4774  done) > expout
4775 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
4776
4777 OVS_VSWITCHD_STOP
4778 AT_CLEANUP
4779
4780
4781 AT_SETUP([ofproto-if packet-out table-miss (continue)])
4782 OVS_VSWITCHD_START
4783 ADD_OF_PORTS([br0], 1, 2)
4784
4785 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
4786 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 all continue])
4787
4788 AT_CAPTURE_FILE([ofctl_monitor.log])
4789 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
4790
4791 for i in 1 2 3; do
4792     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)'
4793 done
4794
4795 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
4796 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
4797 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
4798 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4799 metadata=0,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
4800 dnl
4801 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4802 metadata=0,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
4803 dnl
4804 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
4805 metadata=0,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
4806 ])
4807
4808 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
4809
4810 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
4811  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
4812 OFPST_FLOW reply (OF1.3):
4813 ])
4814
4815 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
4816  echo "  0: active=0, lookup=3, matched=0"
4817  echo "  1: active=1, lookup=3, matched=3"
4818  x=2
4819  while test $x -lt 254; do
4820    echo "  $x: active=0, lookup=0, matched=0"
4821    x=`expr $x + 1`
4822  done) > expout
4823 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
4824
4825 OVS_VSWITCHD_STOP
4826 AT_CLEANUP