lib/classifier: Optimize megaflows for single rule case.
[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 WAIT_FOR_DUMMY_PORTS([p3], [p4])
20 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
21
22 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
23 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
24 ovs-appctl netdev-dummy/set-admin-state up
25 ovs-appctl time/warp 100
26 ovs-appctl netdev-dummy/set-admin-state p2 down
27 ovs-appctl time/stop
28 ovs-appctl time/warp 100
29 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)'])
30 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)'])
31 ovs-appctl time/warp 100
32 ovs-appctl netdev-dummy/set-admin-state p2 up
33 ovs-appctl netdev-dummy/set-admin-state p1 down
34 ovs-appctl time/warp 100
35 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00: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)'])
36 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)'])
37 ovs-appctl time/warp 100
38 ovs-appctl time/warp 100
39 sleep 1
40 AT_CHECK([cat ovs-vswitchd.log | grep 'in_port([[348]])' | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
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: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>
42 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>
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: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>
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=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>
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: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>
46 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>
47 ])
48 OVS_VSWITCHD_STOP
49 AT_CLEANUP
50
51 AT_SETUP([ofproto-dpif, balance-slb bonding])
52 # Create br0 with interfaces bond0(p1, p2, p3) and p7,
53 #    and br1 with interfaces p4, p5, p6 and p8.
54 #    p1 <-> p4, p2 <-> p5, p3 <-> p6
55 # Send some traffic, make sure the traffic are spread based on source mac.
56 OVS_VSWITCHD_START(
57   [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
58    set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
59    set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
60    set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
61    add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
62    add-br br1 -- \
63    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
64    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
65                   fail-mode=secure -- \
66    add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
67    add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
68    add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
69    add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
70 WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
71 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
72 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
73 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
74 ])
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 WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
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=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
1319 cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1320 cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1321 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
1322
1323 cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1324 cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1325 cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1326 cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
1327 cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,256,0,OXM_OF_IPV4_SRC[[0..7]]),controller
1328 cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],slaves:1,2),controller
1329 cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller
1330
1331 cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1332 cookie=0xd table=1 arp actions=controller
1333
1334 cookie=0xd dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48,controller
1335 cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1336 cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1337
1338 cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1339 cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1340 cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1341
1342 cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
1343 cookie=0xd dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1344 cookie=0xd dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1345
1346 cookie=0xd dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1347 cookie=0xd dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1348 cookie=0xd dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1349
1350 cookie=0xd dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1351 cookie=0xd dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1352 cookie=0xd dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1353
1354 cookie=0xd dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1355 cookie=0xd dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1356 cookie=0xd dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
1357 ])
1358 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1359
1360 dnl Modified MPLS controller action.
1361 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1362
1363 for i in 1 2 3; do
1364     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:42,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=17,tos=0,ttl=64,frag=no),udp(src=7777,dst=80)'
1365 done
1366 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1367 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1368
1369 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1370 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1371 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
1372 dnl
1373 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1374 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
1375 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:42,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=1
1378 ])
1379
1380 dnl Modified MPLS controller action.
1381 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1382
1383 for i in 1 2 3; do
1384     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)'
1385 done
1386 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1387 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1388
1389 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1390 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1391 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
1392 dnl
1393 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1394 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
1395 dnl
1396 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1397 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
1398 ])
1399
1400 dnl Modified MPLS controller action.
1401 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1402
1403 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)
1404
1405 for i in 1 2 3; do
1406     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)'
1407 done
1408 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1409 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1410
1411 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1412 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1413 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
1414 dnl
1415 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1416 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
1417 dnl
1418 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1419 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
1420 ])
1421
1422 dnl Modified MPLS controller action.
1423 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1424
1425 for i in 1 2 3; do
1426     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))'
1427 done
1428 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1429 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1430
1431 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1432 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1433 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
1434 dnl
1435 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1436 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
1437 dnl
1438 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1439 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
1440 ])
1441
1442 dnl Modified MPLS controller action.
1443 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1444
1445 for i in 1 2 3; do
1446     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)'
1447 done
1448 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1449 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1450
1451 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1452 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1453 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
1454 dnl
1455 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1456 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
1457 dnl
1458 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1459 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
1460 ])
1461
1462 dnl Modified MPLS controller action.
1463 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1464
1465 for i in 1 2 3; do
1466     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)'
1467 done
1468 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1469 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1470
1471 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1472 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1473 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
1474 dnl
1475 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1476 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
1477 dnl
1478 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1479 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
1480 ])
1481
1482 dnl Modified MPLS controller action.
1483 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1484
1485 for i in 1 2 3; do
1486     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)'
1487 done
1488 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1489 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1490
1491 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1492 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1493 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
1494 dnl
1495 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1496 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
1497 dnl
1498 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1499 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
1500 ])
1501
1502 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1503
1504 dnl Modified MPLS controller action.
1505 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1506
1507 for i in 1 2 3; do
1508     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44:49,dst=50:54:00:00:00:07),eth_type(0x8847),mpls(label=10,tc=3,ttl=64,bos=1)'
1509 done
1510 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1511 ovs-appctl -t ovs-ofctl exit
1512
1513 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1514 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1515 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
1516 dnl
1517 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1518 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
1519 dnl
1520 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1521 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=40:44:44:44:44:49,dl_dst=50:54:00:00:00:07,mpls_label=10,mpls_tc=3,mpls_ttl=64,mpls_bos=0,mpls_lse1=42816
1522 ])
1523
1524 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1525
1526 dnl Modified MPLS controller action.
1527 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1528
1529 for i in 1 2 3; do
1530     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44:44: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)'
1531 done
1532 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1533 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1534
1535 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1536 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1537 mpls,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
1538 dnl
1539 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1540 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
1541 dnl
1542 NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1543 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
1544 ])
1545
1546 dnl Modified MPLS actions.
1547 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1548
1549 for i in 1 2 3; do
1550     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=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)'
1551 done
1552 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1553 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1554
1555 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1556 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1557 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
1558 dnl
1559 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1560 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
1561 dnl
1562 NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
1563 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
1564 ])
1565
1566 dnl Modified MPLS ipv6 controller action.
1567 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1568
1569 for i in 1 2 3; do
1570     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=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)'
1571 done
1572 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1573 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1574
1575 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1576 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1577 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
1578 dnl
1579 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1580 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
1581 dnl
1582 NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
1583 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
1584 ])
1585
1586
1587 dnl Modified MPLS pop action.
1588 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1589 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)
1590 dnl             (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1591
1592 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1593
1594 for i in 1 2 3; do
1595     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'
1596 done
1597 #for i in 2 3; do
1598 #    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)'
1599 #done
1600 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1601 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1602
1603 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1604 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1605 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
1606 dnl
1607 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1608 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
1609 dnl
1610 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1611 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
1612 ])
1613
1614 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1615
1616 dnl Modified MPLS pop action.
1617 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1618 dnl 60:66:66:66:00:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1619 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1620 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1621 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1622
1623 for i in 1 2 3; do
1624     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1625 done
1626 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1627 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1628
1629 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1630 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1631 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1632 dnl
1633 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1634 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1635 dnl
1636 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1637 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1638 ])
1639
1640 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1641
1642 dnl Modified MPLS pop action.
1643 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1644 dnl 60:66:66:66:00:02 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1645 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1646 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1647 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1648
1649 for i in 1 2 3; do
1650     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 02 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1651 done
1652 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1653 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1654
1655 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1656 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1657 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1658 dnl
1659 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1660 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1661 dnl
1662 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1663 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1664 ])
1665
1666 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1667
1668 dnl Modified MPLS pop action.
1669 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1670 dnl 60:66:66:66:00:03 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1671 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1672 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1673 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1674
1675 for i in 1 2 3; do
1676     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 03 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1677 done
1678 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1679 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1680
1681 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1682 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1683 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1684 dnl
1685 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1686 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1687 dnl
1688 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1689 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1690 ])
1691
1692 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1693
1694 dnl Modified MPLS pop action.
1695 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1696 dnl 60:66:66:66:00:04 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1697 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1698 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1699 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1700
1701 for i in 1 2 3; do
1702     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 04 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1703 done
1704 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1705 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1706
1707 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1708 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1709 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1710 dnl
1711 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1712 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1713 dnl
1714 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1715 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7743
1716 ])
1717
1718 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1719
1720 dnl Modified MPLS pop action.
1721 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1722 dnl 60:66:66:66:00:05 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1723 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1724 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1725 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1726
1727 for i in 1 2 3; do
1728     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 05 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1729 done
1730 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1731 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1732
1733 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1734 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1735 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:76db
1736 dnl
1737 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1738 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:76db
1739 dnl
1740 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1741 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:76db
1742 ])
1743
1744 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1745
1746 dnl Modified MPLS pop action.
1747 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1748 dnl 60:66:66:66:00:06 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1749 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1750 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1751 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1752
1753 for i in 1 2 3; do
1754     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 06 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1755 done
1756 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1757 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1758
1759 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1760 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1761 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7745
1762 dnl
1763 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1764 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7745
1765 dnl
1766 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1767 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7745
1768 ])
1769
1770 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1771
1772 dnl Modified MPLS pop action.
1773 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1774 dnl 60:66:66:66:00:07 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1775 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1776 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1777 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1778
1779 for i in 1 2 3; do
1780     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 07 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1781 done
1782 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1783 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1784
1785 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1786 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1787 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1788 dnl
1789 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1790 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1791 dnl
1792 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1793 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1794 ])
1795
1796 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1797
1798 dnl Modified MPLS pop action.
1799 dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
1800 dnl 60:66:66:66:00:08 > ff:ff:ff:ff:ff:ff, ethertype MPLS unicast (0x8847), length 46: MPLS (label 20, exp 0, [S], ttl 32)
1801 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1802
1803 for i in 1 2 3; do
1804     ovs-appctl netdev-dummy/receive p1 'ff ff ff ff ff ff 60 66 66 66 00 08 88 47 00 01 41 20 00 01 08 00 06 04 00 02 60 66 66 66 00 08 c0 a8 00 01 ff ff ff ff ff ff ff ff ff ff'
1805 done
1806 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1807 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1808
1809 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1810 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1811 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
1812 dnl
1813 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1814 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
1815 dnl
1816 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
1817 arp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=ff:ff:ff:ff:ff:ff,arp_spa=192.168.0.1,arp_tpa=255.255.255.255,arp_op=2,arp_sha=60:66:66:66:00:08,arp_tha=ff:ff:ff:ff:ff:ff
1818 ])
1819
1820 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1821
1822 dnl Modified MPLS pop action.
1823 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1824 dnl 60:66:66:66:00:09 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1825 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1826 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1827 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1828
1829 for i in 1 2 3; do
1830     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 09 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1831 done
1832 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1833 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1834
1835 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1836 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1837 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1838 dnl
1839 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1840 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1841 dnl
1842 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1843 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1844 ])
1845
1846 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1847
1848 dnl Modified MPLS pop action.
1849 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1850 dnl 60:66:66:66:00:0a > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1851 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1852 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1853 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1854
1855 for i in 1 2 3; do
1856     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0a 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1857 done
1858 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1859 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1860
1861 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1862 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1863 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1864 dnl
1865 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1866 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1867 dnl
1868 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1869 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2dee
1870 ])
1871
1872 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1873
1874 dnl Modified MPLS pop action.
1875 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1876 dnl 60:66:66:66:00:0b > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
1877 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1878 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
1879 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1880
1881 for i in 1 2 3; do
1882     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 00 0b 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1883 done
1884 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1885 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1886
1887 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
1888 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1889 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2ded
1890 dnl
1891 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1892 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2ded
1893 dnl
1894 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1895 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:2ded
1896 ])
1897
1898 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1899
1900 dnl Modified MPLS pop action.
1901 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
1902 dnl 60:66:66:66:01:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
1903 dnl             (label 20, exp 0, [S], ttl 31)
1904 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1905 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
1906 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1907
1908 for i in 1 2 3; do
1909     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 00 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1910 done
1911 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1912 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1913
1914 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1915 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1916 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
1917 dnl
1918 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1919 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
1920 dnl
1921 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1922 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
1923 ])
1924
1925 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1926
1927 dnl Modified MPLS pop action.
1928 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
1929 dnl 60:66:66:66:01:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
1930 dnl             (label 20, exp 0, [S], ttl 31)
1931 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1932 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
1933 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1934
1935 for i in 1 2 3; do
1936     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 01 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1937 done
1938 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1939 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1940
1941 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1942 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1943 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
1944 dnl
1945 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1946 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
1947 dnl
1948 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1949 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
1950 ])
1951
1952 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1953
1954 dnl Modified MPLS pop action.
1955 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
1956 dnl 60:66:66:66:01:02 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
1957 dnl             (label 20, exp 0, [S], ttl 31)
1958 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1959 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
1960 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1961
1962 for i in 1 2 3; do
1963     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 01 02 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1964 done
1965 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1966 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1967
1968 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1969 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1970 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
1971 dnl
1972 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1973 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
1974 dnl
1975 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
1976 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:01:02,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=3,mpls_ttl=31,mpls_bos=1
1977 ])
1978
1979 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1980
1981 dnl Modified MPLS pop action.
1982 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
1983 dnl 60:66:66:66:02:00 > 50:54:00:00:02:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
1984 dnl             (label 20, exp 0, [S], ttl 31)
1985 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
1986 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
1987 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
1988
1989 for i in 1 2 3; do
1990     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 00 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
1991 done
1992 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1993 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1994
1995 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1996 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
1997 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
1998 dnl
1999 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2000 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2001 dnl
2002 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2003 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2004 ])
2005
2006 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2007
2008 dnl Modified MPLS pop action.
2009 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2010 dnl 60:66:66:66:02:01 > 50:54:00:00:02:01, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2011 dnl             (label 20, exp 0, [S], ttl 31)
2012 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2013 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2014 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2015
2016 for i in 1 2 3; do
2017     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 01 88 48 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2018 done
2019 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2020 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2021
2022 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2023 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2024 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2025 dnl
2026 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2027 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2028 dnl
2029 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2030 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2031 ])
2032
2033 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2034
2035 dnl Modified MPLS pop action.
2036 dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2037 dnl 60:66:66:66:02:10 > 50:54:00:00:02:10, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2038 dnl             (label 20, exp 0, [S], ttl 31)
2039 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2040 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2041 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2042
2043 for i in 1 2 3; do
2044     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 02 10 88 47 00 01 40 20 00 01 41 1f 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2045 done
2046 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2047 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2048
2049 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2050 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2051 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2052 dnl
2053 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2054 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2055 dnl
2056 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2057 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2058 ])
2059
2060 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2061
2062 dnl Modified MPLS pop action.
2063 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2064 dnl 60:66:66:66:03:00 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2065 dnl             (label 20, exp 0, ttl 31)
2066 dnl             (label 20, exp 0, [S], ttl 30)
2067 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2068 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2069 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2070
2071 for i in 1 2 3; do
2072     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 00 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2073 done
2074 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2075 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2076
2077 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2078 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2079 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2080 dnl
2081 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2082 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2083 dnl
2084 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2085 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=30,mpls_bos=1
2086 ])
2087
2088 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2089
2090 dnl Modified MPLS pop action.
2091 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2092 dnl 60:66:66:66:03:01 > 50:54:00:00:00:00, ethertype MPLS multicast (0x8848), length 66: MPLS (label 20, exp 0, ttl 32)
2093 dnl             (label 20, exp 0, ttl 31)
2094 dnl             (label 20, exp 0, [S], ttl 30)
2095 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2096 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2097 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2098
2099 for i in 1 2 3; do
2100     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 01 88 48 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2101 done
2102 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2103 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2104
2105 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2106 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2107 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2108 dnl
2109 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2110 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2111 dnl
2112 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2113 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2114 ])
2115
2116 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2117
2118 dnl Modified MPLS pop action.
2119 dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2120 dnl 60:66:66:66:03:10 > 50:54:00:00:00:00, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
2121 dnl             (label 20, exp 0, ttl 31)
2122 dnl             (label 20, exp 0, [S], ttl 30)
2123 dnl             (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2124 dnl        192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
2125 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2126
2127 for i in 1 2 3; do
2128     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 03 10 88 47 00 01 40 20 00 01 40 1f 00 01 41 1e 45 00 00 2c 00 00 00 00 ff 06 3b 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2129 done
2130 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2131 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2132
2133 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2134 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2135 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2136 dnl
2137 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2138 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2139 dnl
2140 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2141 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:03:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=29,mpls_bos=1
2142 ])
2143
2144 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2145
2146 dnl Modified MPLS pop action.
2147 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2148 dnl 60:66:66:66:04:00 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2149 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2150 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2151 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2152
2153 for i in 1 2 3; do
2154     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 00 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2155 done
2156 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2157 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2158
2159 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2160 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2161 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2162 dnl
2163 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2164 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2165 dnl
2166 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2167 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:00,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=255,mpls_bos=1
2168 ])
2169
2170 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2171
2172 dnl Modified MPLS pop action.
2173 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2174 dnl 60:66:66:66:04:01 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2175 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2176 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2177 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2178
2179 for i in 1 2 3; do
2180     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 01 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2181 done
2182 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2183 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2184
2185 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2186 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2187 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2188 dnl
2189 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2190 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2191 dnl
2192 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2193 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:01,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=254,mpls_bos=1
2194 ])
2195
2196 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2197
2198 dnl Modified MPLS pop action.
2199 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2200 dnl 60:66:66:66:04:10 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2201 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2202 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2203 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2204
2205 for i in 1 2 3; do
2206     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 04 10 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2207 done
2208 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2209 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2210
2211 AT_CHECK([STRIP_METADATA  ofctl_monitor.log], [0], [dnl
2212 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2213 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2214 dnl
2215 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2216 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2217 dnl
2218 NXT_PACKET_IN (xid=0x0): table_id=254 cookie=0x0 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2219 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:04:10,dl_dst=50:54:00:00:00:07,mpls_label=0,mpls_tc=0,mpls_ttl=253,mpls_bos=1
2220 ])
2221
2222 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2223
2224 dnl Modified MPLS pop action.
2225 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2226 dnl 60:66:66:66:05:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2227 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2228 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2229 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2230
2231 for i in 1 2 3; do
2232     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 00 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2233 done
2234 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2235 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2236
2237 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2238 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2239 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2240 dnl
2241 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2242 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2243 dnl
2244 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2245 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:00,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=1
2246 ])
2247
2248 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2249
2250 dnl Modified MPLS pop action.
2251 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2252 dnl 60:66:66:66:05:01 > 50:54:00:00:00:07, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2253 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2254 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2255 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2256
2257 for i in 1 2 3; do
2258     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 01 88 48 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2259 done
2260 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2261 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2262
2263 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2264 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2265 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2266 dnl
2267 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2268 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2269 dnl
2270 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2271 mplsm,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:01,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2272 ])
2273
2274 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2275
2276 dnl Modified MPLS pop action.
2277 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2278 dnl 60:66:66:66:05:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2279 dnl             (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2280 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2281 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2282
2283 for i in 1 2 3; do
2284     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 07 60 66 66 66 05 10 88 47 00 01 41 20 45 00 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2285 done
2286 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2287 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2288
2289 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2290 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2291 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2292 dnl
2293 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2294 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2295 dnl
2296 NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
2297 mpls,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:05:10,dl_dst=50:54:00:00:00:07,mpls_label=20,mpls_tc=0,mpls_ttl=31,mpls_bos=1
2298 ])
2299
2300 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2301
2302 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
2303  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
2304  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
2305  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
2306  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
2307  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
2308  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
2309  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
2310  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
2311  cookie=0xa, n_packets=3, n_bytes=180, mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:0xa->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
2312  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
2313  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
2314  cookie=0xd, n_packets=3, n_bytes=180, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
2315  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl(0),CONTROLLER:65535
2316  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->NXM_OF_IP_DST[[]],CONTROLLER:65535
2317  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:NXM_OF_IP_DST[[]]->NXM_OF_IP_SRC[[]],CONTROLLER:65535
2318  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],CONTROLLER:65535
2319  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,256,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
2320  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],slaves:1,2),CONTROLLER:65535
2321  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]]),CONTROLLER:65535
2322  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48,CONTROLLER:65535
2323  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,CONTROLLER:65535
2324  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,CONTROLLER:65535
2325  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,CONTROLLER:65535
2326  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2327  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl(0),push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2328  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,CONTROLLER:65535
2329  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2330  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2331  cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
2332  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2333  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2334  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:0x3->OXM_OF_MPLS_TC[[]],CONTROLLER:65535
2335  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,CONTROLLER:65535
2336  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl(0),CONTROLLER:65535
2337  cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl(0),CONTROLLER:65535
2338  cookie=0xd, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,CONTROLLER:65535
2339  cookie=0xd, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,CONTROLLER:65535
2340  cookie=0xd, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
2341  cookie=0xd, table=1, n_packets=3, n_bytes=168, arp actions=CONTROLLER:65535
2342 NXST_FLOW reply:
2343 ])
2344
2345 OVS_VSWITCHD_STOP
2346 AT_CLEANUP
2347
2348 AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2349 OVS_VSWITCHD_START([dnl
2350    add-port br0 p1 -- set Interface p1 type=dummy
2351 ])
2352 ON_EXIT([kill `cat ovs-ofctl.pid`])
2353
2354 AT_CAPTURE_FILE([ofctl_monitor.log])
2355 AT_DATA([flows.txt], [dnl
2356 table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2357 table=1 ip,ip_dscp=8 actions=controller
2358 ])
2359 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2360
2361
2362 dnl Modified MPLS pop action.
2363 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2364 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2365 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2366 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2367 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2368
2369 for i in 1 2 3; do
2370     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2371 done
2372 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2373 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2374
2375 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2376 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2377 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2378 dnl
2379 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2380 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2381 dnl
2382 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2383 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2384 ])
2385
2386 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2387
2388 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2389  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2390  table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2391 OFPST_FLOW reply (OF1.2):
2392 ])
2393
2394 OVS_VSWITCHD_STOP
2395 AT_CLEANUP
2396
2397 AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2398 OVS_VSWITCHD_START([dnl
2399    add-port br0 p1 -- set Interface p1 type=dummy
2400 ])
2401 ON_EXIT([kill `cat ovs-ofctl.pid`])
2402
2403 dnl N.B: The first (and only) action that accesses L3 data after the
2404 dnl pop_mpls action is present in write_actions. This exercises recirculation
2405 dnl triggered in write_actions due to a previous action not in write actions.
2406 AT_CAPTURE_FILE([ofctl_monitor.log])
2407 AT_DATA([flows.txt], [dnl
2408 mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2409 ])
2410 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2411
2412 dnl Modified MPLS pop action.
2413 dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2414 dnl 60:66:66:66:00:08 > 50:54:00:00:00:01, ethertype MPLS multicast (0x8848), length 62: MPLS (label 20, exp 0, [S], ttl 32)
2415 dnl             (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2416 dnl         192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
2417 AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
2418
2419 for i in 1 2 3; do
2420     ovs-appctl netdev-dummy/receive p1 '50 54 00 00 00 01 60 66 66 66 00 08 88 48 00 01 41 20 45 20 00 2c 00 00 00 00 ff 06 3a 78 c0 a8 00 01 c0 a8 00 02 00 50 00 00 00 00 00 2a 00 00 00 2a 50 00 27 10 77 44 00 00 48 4f 47 45'
2421 done
2422 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2423 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2424
2425 AT_CHECK([STRIP_METADATA ofctl_monitor.log], [0], [dnl
2426 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2427 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2428 dnl
2429 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2430 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2431 dnl
2432 OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=254 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
2433 tcp,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0x000 tcp_csum:7744
2434 ])
2435
2436 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2437
2438 AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2439  n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2440 OFPST_FLOW reply (OF1.2):
2441 ])
2442
2443 OVS_VSWITCHD_STOP
2444 AT_CLEANUP
2445
2446 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2447 OVS_VSWITCHD_START([dnl
2448    add-port br0 p1 -- set Interface p1 type=dummy
2449 ])
2450 ON_EXIT([kill `cat ovs-ofctl.pid`])
2451
2452 AT_CAPTURE_FILE([ofctl_monitor.log])
2453 # A table-miss flow has priority 0 and no match
2454 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2455
2456 dnl Singleton controller action.
2457 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2458
2459 for i in 1 2 3 ; do
2460     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)'
2461 done
2462 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2463 ovs-appctl -t ovs-ofctl exit
2464
2465 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2466 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2467 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
2468 dnl
2469 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2470 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
2471 dnl
2472 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
2473 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
2474 ])
2475
2476 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2477
2478 AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2479  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2480 NXST_FLOW reply:
2481 ])
2482
2483 OVS_VSWITCHD_STOP
2484 AT_CLEANUP
2485
2486
2487 AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2488 OVS_VSWITCHD_START([dnl
2489    add-port br0 p1 -- set Interface p1 type=dummy
2490 ])
2491 ON_EXIT([kill `cat ovs-ofctl.pid`])
2492
2493 AT_CAPTURE_FILE([ofctl_monitor.log])
2494 # A table-miss flow has priority 0 and no match
2495 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2496
2497 dnl Singleton controller action.
2498 AT_CHECK([ovs-ofctl monitor -P openflow10 --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
2499
2500 for i in 1 2 3 ; do
2501     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)'
2502 done
2503 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2504 ovs-appctl -t ovs-ofctl exit
2505
2506 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2507
2508 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2509 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2510 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
2511 dnl
2512 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2513 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
2514 dnl
2515 OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
2516 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
2517 ])
2518
2519 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2520
2521 AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2522  n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2523 OFPST_FLOW reply (OF1.3):
2524 ])
2525
2526 OVS_VSWITCHD_STOP
2527 AT_CLEANUP
2528
2529 AT_SETUP([ofproto-dpif - ARP modification slow-path])
2530 OVS_VSWITCHD_START
2531 ADD_OF_PORTS([br0], [1], [2])
2532
2533 ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
2534 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'
2535
2536 # Input some packets that should follow the arp modification slow-path.
2537 for i in 1 2 3; do
2538     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)'
2539 done
2540 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2541
2542 # Check the packets that were output.
2543 AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
2544 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
2545 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
2546 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
2547 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
2548 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
2549 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
2550 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
2551 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
2552 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
2553 ])
2554
2555 OVS_VSWITCHD_STOP
2556 AT_CLEANUP
2557
2558 AT_SETUP([ofproto-dpif - VLAN handling])
2559 OVS_VSWITCHD_START(
2560   [set Bridge br0 fail-mode=standalone -- \
2561    add-port br0 p1                                  trunks=10,12 -- \
2562    add-port br0 p2                           tag=10              -- \
2563    add-port br0 p3                           tag=12              \
2564                    other-config:priority-tags=true               -- \
2565    add-port br0 p4                           tag=12              -- \
2566    add-port br0 p5 vlan_mode=native-tagged   tag=10              -- \
2567    add-port br0 p6 vlan_mode=native-tagged   tag=10 trunks=10,12 -- \
2568    add-port br0 p7 vlan_mode=native-untagged tag=12              -- \
2569    add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
2570                    other-config:priority-tags=true               -- \
2571    set Interface p1 type=dummy -- \
2572    set Interface p2 type=dummy -- \
2573    set Interface p3 type=dummy -- \
2574    set Interface p4 type=dummy -- \
2575    set Interface p5 type=dummy -- \
2576    set Interface p6 type=dummy -- \
2577    set Interface p7 type=dummy -- \
2578    set Interface p8 type=dummy --])
2579
2580 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
2581 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
2582 dnl actions.
2583 for tuple in \
2584         "100 none 0 drop" \
2585         "100 0    0 drop" \
2586         "100 0    1 drop" \
2587         "100 10   0 1,5,6,7,8,pop_vlan,2" \
2588         "100 10   1 1,5,6,7,8,pop_vlan,2" \
2589         "100 11   0 5,7" \
2590         "100 11   1 5,7" \
2591         "100 12   0 1,5,6,pop_vlan,3,4,7,8" \
2592         "100 12   1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2593         "1  none 0 drop" \
2594         "1  0    0 drop" \
2595         "1  0    1 drop" \
2596         "1  10   0 5,6,7,8,100,pop_vlan,2" \
2597         "1  10   1 5,6,7,8,100,pop_vlan,2" \
2598         "1  11   0 drop" \
2599         "1  11   1 drop" \
2600         "1  12   0 5,6,100,pop_vlan,3,4,7,8" \
2601         "1  12   1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2602         "2  none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
2603         "2  0    0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
2604         "2  0    1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
2605         "2  10   0 drop" \
2606         "2  10   1 drop" \
2607         "2  11   0 drop" \
2608         "2  11   1 drop" \
2609         "2  12   0 drop" \
2610         "2  12   1 drop" \
2611         "3  none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2612         "3  0    0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2613         "3  0    1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
2614         "3  10   0 drop" \
2615         "3  10   1 drop" \
2616         "3  11   0 drop" \
2617         "3  11   1 drop" \
2618         "3  12   0 drop" \
2619         "3  12   1 drop" \
2620         "4  none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2621         "4  0    0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2622         "4  0    1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
2623         "4  10   0 drop" \
2624         "4  10   1 drop" \
2625         "4  11   0 drop" \
2626         "4  11   1 drop" \
2627         "4  12   0 drop" \
2628         "4  12   1 drop" \
2629         "5  none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
2630         "5  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
2631         "5  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
2632         "5  10   0 1,6,7,8,100,pop_vlan,2" \
2633         "5  10   1 1,6,7,8,100,pop_vlan,2" \
2634         "5  11   0 7,100" \
2635         "5  11   1 7,100" \
2636         "5  12   0 1,6,100,pop_vlan,3,4,7,8" \
2637         "5  12   1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2638         "6  none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
2639         "6  0    0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
2640         "6  0    1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
2641         "6  10   0 1,5,7,8,100,pop_vlan,2" \
2642         "6  10   1 1,5,7,8,100,pop_vlan,2" \
2643         "6  11   0 drop" \
2644         "6  11   1 drop" \
2645         "6  12   0 1,5,100,pop_vlan,3,4,7,8" \
2646         "6  12   1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
2647         "7  none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2648         "7  0    0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
2649         "7  0    1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
2650         "7  10   0 1,5,6,8,100,pop_vlan,2" \
2651         "7  10   1 1,5,6,8,100,pop_vlan,2" \
2652         "7  11   0 5,100" \
2653         "7  11   1 5,100" \
2654         "7  12   0 1,5,6,100,pop_vlan,3,4,8" \
2655         "7  12   1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
2656         "8  none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
2657         "8  0    0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
2658         "8  0    1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
2659         "8  10   0 1,5,6,7,100,pop_vlan,2" \
2660         "8  10   1 1,5,6,7,100,pop_vlan,2" \
2661         "8  11   0 drop" \
2662         "8  11   1 drop" \
2663         "8  12   0 1,5,6,100,pop_vlan,3,4,7" \
2664         "8  12   1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
2665 do
2666   set $tuple
2667   in_port=$1
2668   vlan=$2
2669   pcp=$3
2670   expected=$4
2671
2672   if test $vlan = none; then
2673     flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
2674   else
2675     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))"
2676   fi
2677
2678   echo "----------------------------------------------------------------------"
2679   echo "in_port=$in_port vlan=$vlan pcp=$pcp"
2680
2681   AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
2682   actual=`tail -1 stdout | sed 's/Datapath actions: //'`
2683
2684   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
2685   mv stdout expout
2686   AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
2687 done
2688
2689 OVS_VSWITCHD_STOP
2690 AT_CLEANUP
2691
2692 AT_SETUP([ofproto-dpif - MPLS handling])
2693 OVS_VSWITCHD_START([dnl
2694    add-port br0 p1 -- set Interface p1 type=dummy
2695 ])
2696 ON_EXIT([kill `cat ovs-ofctl.pid`])
2697
2698 AT_CAPTURE_FILE([ofctl_monitor.log])
2699 AT_DATA([flows.txt], [dnl
2700 dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
2701 dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
2702 dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
2703 ])
2704 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
2705
2706 dnl In this test, we push an MPLS tag to an ethernet packet.
2707 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2708
2709 for i in 1 2 3; do
2710     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)'
2711 done
2712 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2713 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2714
2715 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2716 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2717 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
2718 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
2719 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
2720 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
2721 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
2722 dnl
2723 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2724 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
2725 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
2726 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
2727 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
2728 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
2729 dnl
2730 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2731 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
2732 00000000  50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
2733 00000010  01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
2734 00000020  00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
2735 00000030  00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
2736 ])
2737
2738 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
2739 dnl copied exactly, except for the BOS bit.
2740 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2741
2742 for i in 1 2 3; do
2743     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)'
2744 done
2745 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2746 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2747
2748 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2749 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2750 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
2751 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
2752 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2753 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2754 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2755 dnl
2756 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2757 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
2758 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
2759 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2760 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2761 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2762 dnl
2763 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2764 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
2765 00000000  50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
2766 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2767 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2768 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2769 ])
2770
2771 dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
2772 dnl copied exactly, except for the BOS bit. The ethertype should be updated
2773 dnl to the MPLS ethertype of the MPLS push action which differs to that
2774 dnl of the input packet.
2775 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2776
2777 for i in 1 2 3; do
2778     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)'
2779 done
2780 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2781 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
2782
2783 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2784 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2785 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
2786 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
2787 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2788 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2789 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2790 dnl
2791 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2792 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
2793 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
2794 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2795 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2796 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2797 dnl
2798 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2799 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
2800 00000000  50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
2801 00000010  a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
2802 00000020  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2803 00000030  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
2804 ])
2805
2806 OVS_VSWITCHD_STOP
2807 AT_CLEANUP
2808
2809 AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
2810 OVS_VSWITCHD_START([dnl
2811    add-port br0 p1 -- set Interface p1 type=dummy
2812 ])
2813 ON_EXIT([kill `cat ovs-ofctl.pid`])
2814
2815 AT_CAPTURE_FILE([ofctl_monitor.log])
2816 AT_DATA([flows.txt], [dnl
2817 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
2818 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
2819 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
2820 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
2821 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
2822 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
2823 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
2824 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
2825 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
2826 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
2827 ])
2828 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
2829
2830 dnl Modified MPLS controller action.
2831 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
2832 dnl both of these in the final flow
2833 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2834
2835 for i in 1 2 3; do
2836     ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=40:44:44:44: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)'
2837 done
2838 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2839 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2840
2841 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2842 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2843 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
2844 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
2845 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2846 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2847 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2848 00000040  00 00 00 00
2849 dnl
2850 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2851 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
2852 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
2853 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2854 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2855 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2856 00000040  00 00 00 00
2857 dnl
2858 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2859 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
2860 00000000  50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
2861 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2862 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2863 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2864 00000040  00 00 00 00
2865 ])
2866
2867 dnl Modified MPLS controller action.
2868 dnl In this test, the input packet in vlan-tagged, which should be stripped
2869 dnl before we push the MPLS and VLAN tags.
2870 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2871
2872 for i in 1 2 3; do
2873     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))'
2874 done
2875 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2876 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2877
2878 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2879 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2880 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
2881 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2882 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2883 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2884 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2885 dnl
2886 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2887 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
2888 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2889 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2890 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2891 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2892 dnl
2893 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2894 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
2895 00000000  50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
2896 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2897 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2898 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2899 ])
2900
2901 dnl Modified MPLS controller action.
2902 dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
2903 dnl both of these in the final flow
2904 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2905
2906 for i in 1 2 3; do
2907     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)'
2908 done
2909 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2910 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2911
2912 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2913 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2914 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
2915 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2916 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2917 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2918 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2919 00000040  00 00 00 00
2920 dnl
2921 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2922 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
2923 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2924 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2925 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2926 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2927 00000040  00 00 00 00
2928 dnl
2929 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2930 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
2931 00000000  52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
2932 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2933 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2934 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2935 00000040  00 00 00 00
2936 ])
2937
2938 dnl Modified MPLS controller action.
2939 dnl In this test, the input packet in vlan-tagged, which should be stripped
2940 dnl before we push the MPLS and VLAN tags.
2941 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2942
2943 for i in 1 2 3; do
2944     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))'
2945 done
2946 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2947 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2948
2949 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2950 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2951 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
2952 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2953 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2954 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2955 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2956 dnl
2957 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2958 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
2959 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2960 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2961 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2962 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2963 dnl
2964 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
2965 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
2966 00000000  50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
2967 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2968 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2969 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2970 ])
2971
2972 dnl Modified MPLS controller action.
2973 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
2974 dnl actions are reordered, so we see both of these in the final flow.
2975 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
2976
2977 for i in 1 2 3; do
2978     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)'
2979 done
2980 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
2981 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2982
2983 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
2984 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2985 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
2986 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
2987 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2988 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2989 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2990 00000040  00 00 00 00
2991 dnl
2992 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
2993 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
2994 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
2995 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
2996 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
2997 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
2998 00000040  00 00 00 00
2999 dnl
3000 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3001 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
3002 00000000  50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
3003 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3004 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3005 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3006 00000040  00 00 00 00
3007 ])
3008
3009 dnl Modified MPLS controller action.
3010 dnl In this test, the input packet in vlan-tagged, which should be stripped
3011 dnl before we push the MPLS and VLAN tags.
3012 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3013
3014 for i in 1 2 3; do
3015     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))'
3016 done
3017 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3018 OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3019
3020 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3021 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3022 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
3023 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3024 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3025 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3026 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3027 dnl
3028 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3029 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
3030 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3031 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3032 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3033 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3034 dnl
3035 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3036 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
3037 00000000  50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
3038 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3039 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3040 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3041 ])
3042
3043 dnl Modified MPLS controller action.
3044 dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3045 dnl actions are reordered, so we see both of these in the final flow.
3046 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3047
3048 for i in 1 2 3; do
3049     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)'
3050 done
3051 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3052 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3053
3054 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3055 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3056 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
3057 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3058 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3059 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3060 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3061 00000040  00 00 00 00
3062 dnl
3063 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3064 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
3065 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3066 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3067 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3068 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3069 00000040  00 00 00 00
3070 dnl
3071 OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
3072 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
3073 00000000  50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
3074 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3075 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3076 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3077 00000040  00 00 00 00
3078 ])
3079
3080 dnl Modified MPLS controller action.
3081 dnl In this test, the input packet in vlan-tagged, which should be stripped
3082 dnl before we push the MPLS and VLAN tags.
3083 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
3084
3085 for i in 1 2 3; do
3086     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))'
3087 done
3088 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3089 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3090
3091 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3092 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3093 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
3094 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3095 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3096 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3097 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3098 dnl
3099 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3100 mpls,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
3101 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3102 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3103 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3104 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3105 dnl
3106 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3107 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
3108 00000000  50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
3109 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3110 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3111 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3112 ])
3113
3114 dnl Modified MPLS controller action.
3115 dnl In this test, the input packet in vlan-tagged, which should be stripped
3116 dnl before we push the MPLS and VLAN tags.
3117 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3118
3119 for i in 1 2 3; do
3120     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))'
3121 done
3122 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3123 OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
3124
3125 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3126 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3127 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
3128 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3129 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3130 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3131 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3132 dnl
3133 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3134 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
3135 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3136 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3137 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3138 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3139 dnl
3140 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3141 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
3142 00000000  50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
3143 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3144 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3145 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3146 ])
3147
3148 dnl Modified MPLS controller action.
3149 dnl In this test, the input packet in vlan-tagged, which should be modified
3150 dnl before we push MPLS and VLAN tags.
3151 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P nxm --detach --pidfile 2> ofctl_monitor.log])
3152
3153 for i in 1 2 3; do
3154     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))'
3155 done
3156 OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
3157 ovs-appctl -t ovs-ofctl exit
3158
3159 AT_CHECK([cat ofctl_monitor.log | ofctl_strip], [0], [dnl
3160 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3161 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
3162 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3163 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3164 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3165 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3166 dnl
3167 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3168 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
3169 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3170 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3171 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3172 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3173 dnl
3174 OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
3175 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
3176 00000000  50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
3177 00000010  88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
3178 00000020  f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
3179 00000030  00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3180 ])
3181
3182 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3183 AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3184  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
3185  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
3186  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
3187  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
3188  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
3189  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
3190  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
3191  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
3192  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
3193  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
3194 OFPST_FLOW reply (OF1.2):
3195 ])
3196
3197 OVS_VSWITCHD_STOP
3198 AT_CLEANUP
3199
3200 AT_SETUP([ofproto-dpif - fragment handling])
3201 OVS_VSWITCHD_START
3202 ADD_OF_PORTS([br0], [1], [2], [3], [4], [5], [6], [90])
3203 AT_DATA([flows.txt], [dnl
3204 priority=75 tcp ip_frag=no    tp_dst=80 actions=output:1
3205 priority=75 tcp ip_frag=first tp_dst=80 actions=output:2
3206 priority=75 tcp ip_frag=later tp_dst=80 actions=output:3
3207 priority=50 tcp ip_frag=no              actions=output:4
3208 priority=50 tcp ip_frag=first           actions=output:5
3209 priority=50 tcp ip_frag=later           actions=output:6
3210 ])
3211 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3212
3213 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"
3214 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3215 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3216 later_flow="$base_flow,frag=later)"
3217
3218     # mode    no  first  later
3219 for tuple in \
3220     'normal    1     5      6' \
3221     'drop      1  drop   drop' \
3222     'nx-match  1     2      6'
3223 do
3224   set $tuple
3225   mode=$1
3226   no=$2
3227   first=$3
3228   later=$4
3229
3230   AT_CHECK([ovs-ofctl set-frags br0 $mode])
3231   for type in no first later; do
3232     eval flow=\$${type}_flow exp_output=\$$type
3233     printf "\n%s\n" "----$mode $type-----"
3234     AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3235     : > expout
3236     if test $mode = drop && test $type != no; then
3237         echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
3238     fi
3239     echo "Datapath actions: $exp_output" >> expout
3240     AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
3241   done
3242 done
3243 OVS_VSWITCHD_STOP
3244 AT_CLEANUP
3245
3246 AT_SETUP([ofproto-dpif - exit])
3247 OVS_VSWITCHD_START
3248 ADD_OF_PORTS([br0], [1], [2], [3], [10], [11], [12], [13], [14])
3249 AT_DATA([flows.txt], [dnl
3250 in_port=1 actions=output:10,exit,output:11
3251 in_port=2 actions=output:12,resubmit:1,output:12
3252 in_port=3 actions=output:13,resubmit:2,output:14
3253 ])
3254 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3255 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])
3256 AT_CHECK([tail -1 stdout], [0],
3257   [Datapath actions: 10
3258 ])
3259 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])
3260 AT_CHECK([tail -1 stdout], [0],
3261   [Datapath actions: 12,10
3262 ])
3263 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])
3264 AT_CHECK([tail -1 stdout], [0],
3265   [Datapath actions: 13,12,10
3266 ])
3267 OVS_VSWITCHD_STOP
3268 AT_CLEANUP
3269
3270
3271 AT_SETUP([ofproto-dpif - mirroring, select_all])
3272 OVS_VSWITCHD_START
3273 ADD_OF_PORTS([br0], 1, 2, 3)
3274 ovs-vsctl \
3275         set Bridge br0 mirrors=@m --\
3276         --id=@p3 get Port p3 --\
3277         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3278
3279 AT_DATA([flows.txt], [dnl
3280 in_port=1 actions=output:2
3281 in_port=2 actions=output:1
3282 ])
3283 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3284
3285 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)"
3286 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3287 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3288   [Datapath actions: 2,3
3289 ])
3290
3291 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)"
3292 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3293 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3294   [Datapath actions: 1,3
3295 ])
3296
3297 OVS_VSWITCHD_STOP
3298 AT_CLEANUP
3299
3300
3301 AT_SETUP([ofproto-dpif - mirroring, select_src])
3302 OVS_VSWITCHD_START
3303 ADD_OF_PORTS([br0], 1, 2, 3)
3304 ovs-vsctl \
3305         set Bridge br0 mirrors=@m --\
3306         --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
3307         --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
3308
3309 AT_DATA([flows.txt], [dnl
3310 in_port=1 actions=output:2
3311 in_port=2 actions=output:1
3312 ])
3313 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3314
3315 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)"
3316 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3317 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3318   [Datapath actions: 2,3
3319 ])
3320
3321 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)"
3322 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3323 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3324   [Datapath actions: 1
3325 ])
3326 OVS_VSWITCHD_STOP
3327 AT_CLEANUP
3328
3329 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
3330 OVS_VSWITCHD_START
3331 ADD_OF_PORTS([br0], 1, 2)
3332 ovs-vsctl \
3333         set Bridge br0 mirrors=@m --\
3334         --id=@p2 get Port p2 --\
3335         --id=@m create Mirror name=mymirror select_all=true output_port=@p2
3336
3337 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
3338
3339 # "in_port" defaults to OFPP_NONE if it's not specified.
3340 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"
3341 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
3342 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3343   [Datapath actions: 1,2
3344 ])
3345
3346 OVS_VSWITCHD_STOP
3347 AT_CLEANUP
3348
3349
3350 AT_SETUP([ofproto-dpif - mirroring, select_dst])
3351 OVS_VSWITCHD_START
3352 ADD_OF_PORTS([br0], 1, 2, 3)
3353 ovs-vsctl \
3354         set Bridge br0 mirrors=@m --\
3355         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3356         --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
3357
3358 AT_DATA([flows.txt], [dnl
3359 in_port=1 actions=output:2
3360 in_port=2 actions=output:1
3361 ])
3362 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3363
3364 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)"
3365 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3366 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3367   [Datapath actions: 2,3
3368 ])
3369
3370 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)"
3371 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3372 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3373   [Datapath actions: 1
3374 ])
3375
3376 OVS_VSWITCHD_STOP
3377 AT_CLEANUP
3378
3379
3380 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
3381 OVS_VSWITCHD_START
3382 ADD_OF_PORTS([br0], 1, 2, 3)
3383 ovs-vsctl \
3384         set Bridge br0 mirrors=@m --\
3385         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
3386         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
3387
3388 AT_DATA([flows.txt], [dnl
3389 in_port=1, actions=output:2
3390 ])
3391 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3392
3393 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)"
3394 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3395 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3396   [Datapath actions: 2
3397 ])
3398
3399 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))"
3400 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3401 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3402   [Datapath actions: 2
3403 ])
3404
3405 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))"
3406 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3407 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3408   [Datapath actions: 2,3
3409 ])
3410
3411 OVS_VSWITCHD_STOP
3412 AT_CLEANUP
3413
3414
3415 AT_SETUP([ofproto-dpif - mirroring, output_port])
3416 OVS_VSWITCHD_START
3417 ADD_OF_PORTS([br0], 1, 2, 3)
3418 ovs-vsctl \
3419         set Bridge br0 mirrors=@m --\
3420         --id=@p3 get Port p3 --\
3421         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
3422
3423 AT_DATA([flows.txt], [dnl
3424 in_port=1 actions=mod_vlan_vid:17,output:2
3425 in_port=2 actions=output:1
3426 ])
3427 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3428
3429 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)"
3430 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3431 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3432   [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
3433 ])
3434
3435 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)"
3436 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3437 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
3438   [Datapath actions: 1,3
3439 ])
3440
3441 OVS_VSWITCHD_STOP
3442 AT_CLEANUP
3443
3444 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
3445 OVS_VSWITCHD_START
3446 ADD_OF_PORTS([br0], 1, 2)
3447 ovs-vsctl \
3448         set Bridge br0 mirrors=@m --\
3449         --id=@m create Mirror name=mymirror select_all=true output_vlan=12
3450
3451 AT_DATA([flows.txt], [dnl
3452 in_port=1 actions=output:2
3453 in_port=2 actions=mod_vlan_vid:17,output:1
3454 ])
3455 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3456
3457 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)"
3458 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3459 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3460
3461 expected="2,push_vlan(vid=12,pcp=0),1,2,100"
3462 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3463 mv stdout expout
3464 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3465
3466 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)"
3467 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
3468 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3469
3470 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
3471 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
3472 mv stdout expout
3473 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
3474
3475 OVS_VSWITCHD_STOP
3476 AT_CLEANUP
3477
3478 # Two testcases below are for the ofproto/trace command
3479 # The first one tests all correct syntax:
3480 # ofproto/trace [dp_name] odp_flow [-generate|packet]
3481 # ofproto/trace br_name br_flow [-generate|packet]
3482 AT_SETUP([ofproto-dpif - ofproto/trace command 1])
3483 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
3484 ADD_OF_PORTS([br0], 1, 2, 3)
3485
3486 AT_DATA([flows.txt], [dnl
3487 in_port=1 actions=output:2
3488 in_port=2 actions=output:1
3489 ])
3490 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3491
3492 odp_flow="in_port(1)"
3493 br_flow="in_port=1"
3494 # Test command: ofproto/trace odp_flow with in_port as a name.
3495 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
3496 AT_CHECK([tail -1 stdout], [0], [dnl
3497 Datapath actions: 2
3498 ])
3499
3500 odp_flow="in_port(1)"
3501 # Test command: ofproto/trace odp_flow
3502 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
3503 AT_CHECK([tail -1 stdout], [0], [dnl
3504 Datapath actions: 2
3505 ])
3506
3507 # Test command: ofproto/trace dp_name odp_flow
3508 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
3509 AT_CHECK([tail -1 stdout], [0], [dnl
3510 Datapath actions: 2
3511 ])
3512 # Test commmand: ofproto/trace br_name br_flow
3513 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
3514 AT_CHECK([tail -1 stdout], [0], [dnl
3515 Datapath actions: 2
3516 ])
3517
3518 # Delete the inserted flows
3519 AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
3520 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
3521
3522 # This section beflow tests the [-generate] option
3523 odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
3524 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"
3525
3526 # Test command: ofproto/trace odp_flow
3527 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
3528 # Check for no MAC learning entry
3529 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3530  port  VLAN  MAC                Age
3531 ])
3532
3533 # Test command: ofproto/trace br_name br_flow
3534 AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
3535 # Check for no MAC learning entry
3536 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3537  port  VLAN  MAC                Age
3538 ])
3539
3540 # Test command: ofproto/trace odp_flow -generate
3541 AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
3542 # Check for the MAC learning entry
3543 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3544  port  VLAN  MAC                Age
3545     3     0  50:54:00:00:00:05    ?
3546 ])
3547
3548 # Test command: ofproto/trace dp_name odp_flow -generate
3549 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
3550   "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
3551   -generate], [0], [stdout])
3552 # Check for both MAC learning entries
3553 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3554  port  VLAN  MAC                Age
3555     3     0  50:54:00:00:00:05    ?
3556     1     0  50:54:00:00:00:06    ?
3557 ])
3558
3559 # Test command: ofproto/trace br_name br_flow -generate
3560 AT_CHECK([ovs-appctl ofproto/trace br0 \
3561   "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
3562   -generate], [0], [stdout])
3563 # Check for both MAC learning entries.
3564 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3565  port  VLAN  MAC                Age
3566     3     0  50:54:00:00:00:05    ?
3567     1     0  50:54:00:00:00:06    ?
3568     2     0  50:54:00:00:00:07    ?
3569 ])
3570
3571 # This section beflow tests the [packet] option
3572 # The ovs-tcpundump of packets between port1 and port2
3573 pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
3574 pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
3575
3576 # Construct the MAC learning table
3577 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
3578   "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
3579   -generate], [0], [stdout])
3580
3581 # Construct the MAC learning table
3582 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
3583   "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
3584   -generate], [0], [stdout])
3585
3586 # Test command: ofproto/trace odp_flow packet
3587 AT_CHECK([ovs-appctl ofproto/trace \
3588   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
3589 AT_CHECK([tail -1 stdout], [0], [dnl
3590 Datapath actions: 2
3591 ])
3592 AT_CHECK([head -n 2 stdout], [0], [dnl
3593 Bridge: br0
3594 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
3595 ])
3596
3597 # Test command: ofproto/trace dp_name odp_flow packet
3598 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
3599   "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
3600 AT_CHECK([tail -1 stdout], [0], [dnl
3601 Datapath actions: 2
3602 ])
3603 AT_CHECK([head -n 2 stdout], [0], [dnl
3604 Bridge: br0
3605 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
3606 ])
3607
3608 # Test command: ofproto/trace br_name br_flow packet
3609 AT_CHECK([ovs-appctl ofproto/trace br0 \
3610   "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
3611 AT_CHECK([tail -1 stdout], [0], [dnl
3612 Datapath actions: 1
3613 ])
3614 AT_CHECK([head -n 2 stdout], [0], [dnl
3615 Bridge: br0
3616 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
3617 ])
3618
3619 OVS_VSWITCHD_STOP
3620 AT_CLEANUP
3621
3622 # The second test tests the corner cases
3623 AT_SETUP([ofproto-dpif - ofproto/trace command 2])
3624 OVS_VSWITCHD_START
3625 ADD_OF_PORTS([br0], 1, 2)
3626
3627 # Define flows
3628 odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
3629 br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
3630 # Define options
3631 generate="-generate"
3632 pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
3633
3634 # Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
3635 m4_foreach(
3636 [option],
3637 [[],
3638 ["$generate"],
3639 ["$pkt"]],
3640 [AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
3641   [2], [], [stderr])
3642 AT_CHECK([tail -2 stderr], [0], [dnl
3643 Cannot find the datapath
3644 ovs-appctl: ovs-vswitchd: server returned an error
3645 ])])
3646
3647 # Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
3648 m4_foreach(
3649 [option],
3650 [[],
3651 ["$generate"],
3652 ["$pkt"]],
3653 [AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
3654   [2], [], [stderr])
3655 AT_CHECK([tail -2 stderr], [0], [dnl
3656 Cannot find the datapath
3657 ovs-appctl: ovs-vswitchd: server returned an error
3658 ])])
3659
3660 # Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
3661 m4_foreach(
3662 [option],
3663 [[],
3664 ["$generate"],
3665 ["$pkt"]],
3666 [AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
3667   [2], [], [stderr])
3668 AT_CHECK([tail -2 stderr], [0], [dnl
3669 Cannot find the datapath
3670 ovs-appctl: ovs-vswitchd: server returned an error
3671 ])])
3672
3673 # Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
3674 m4_foreach(
3675 [option],
3676 [[],
3677 ["$generate"],
3678 ["$pkt"]],
3679 [AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
3680   [2], [], [stderr])
3681 AT_CHECK([tail -2 stderr], [0], [dnl
3682 Cannot find the datapath
3683 ovs-appctl: ovs-vswitchd: server returned an error
3684 ])])
3685
3686 # Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
3687 m4_foreach(
3688 [option],
3689 [[],
3690 ["$generate"],
3691 ["$pkt"]],
3692 [AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
3693   [2], [], [stderr])
3694 AT_CHECK([tail -2 stderr], [0], [dnl
3695 Unknown bridge name
3696 ovs-appctl: ovs-vswitchd: server returned an error
3697 ])])
3698
3699 # Test incorrect command: ofproto/trace br_flow [-generate|packet]
3700 m4_foreach(
3701 [option],
3702 [[],
3703 ["$generate"],
3704 ["$pkt"]],
3705 [AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
3706   [2], [], [stderr])
3707 AT_CHECK([tail -2 stderr], [0], [dnl
3708 Must specify bridge name
3709 ovs-appctl: ovs-vswitchd: server returned an error
3710 ])])
3711
3712 # Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
3713 AT_CHECK([ovs-appctl ofproto/trace \
3714   ovs-dummy "$odp_flow" garbage_option],
3715   [2], [stdout],[stderr])
3716 AT_CHECK([tail -2 stderr], [0], [dnl
3717 Trailing garbage in packet data
3718 ovs-appctl: ovs-vswitchd: server returned an error
3719 ])
3720
3721 # Test incorrect command: ofproto/trace with 4 arguments
3722 AT_CHECK([ovs-appctl ofproto/trace \
3723   arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
3724 AT_CHECK([tail -2 stderr], [0], [dnl
3725 "ofproto/trace" command takes at most 3 arguments
3726 ovs-appctl: ovs-vswitchd: server returned an error
3727 ])
3728
3729 # Test incorrect command: ofproto/trace with 0 argument
3730 AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
3731 AT_CHECK([tail -2 stderr], [0], [dnl
3732 "ofproto/trace" command requires at least 1 arguments
3733 ovs-appctl: ovs-vswitchd: server returned an error
3734 ])
3735
3736 OVS_VSWITCHD_STOP
3737 AT_CLEANUP
3738
3739 AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
3740 OVS_VSWITCHD_START
3741 ADD_OF_PORTS([br0], 1, 2, 3)
3742
3743 AT_DATA([flows.txt], [dnl
3744 in_port=1 actions=output:2
3745 in_port=2 actions=output:1
3746 ])
3747 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3748
3749 AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
3750 AT_CHECK([tail -1 stdout], [0], [dnl
3751 Datapath actions: push_vlan(vid=123,pcp=0),2
3752 ])
3753
3754 OVS_VSWITCHD_STOP
3755 AT_CLEANUP
3756
3757
3758 m4_define([OFPROTO_TRACE],
3759   [flow="$2"
3760    AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
3761    actual=`tail -1 stdout | sed 's/Datapath actions: //'`
3762    expected="$4"
3763    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
3764      [0], [stdout])
3765    mv stdout expout
3766    AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
3767      [0], [expout])])
3768
3769 AT_SETUP([ofproto-dpif - MAC learning])
3770 OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
3771 ADD_OF_PORTS([br0], 1, 2, 3)
3772
3773 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)'
3774
3775 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
3776 OFPROTO_TRACE(
3777   [ovs-dummy],
3778   [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
3779   [-generate],
3780   [1,2,100])
3781
3782 # Check for the MAC learning entry.
3783 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3784  port  VLAN  MAC                Age
3785     3     0  50:54:00:00:00:05    ?
3786 ])
3787
3788 # Trace a packet arrival destined for the learned MAC.
3789 # (This will also learn a MAC.)
3790 OFPROTO_TRACE(
3791   [ovs-dummy],
3792   [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
3793   [-generate],
3794   [3])
3795
3796 # Check for both MAC learning entries.
3797 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3798  port  VLAN  MAC                Age
3799     3     0  50:54:00:00:00:05    ?
3800     1     0  50:54:00:00:00:06    ?
3801 ])
3802
3803 # Trace a packet arrival that updates the first learned MAC entry.
3804 OFPROTO_TRACE(
3805   [ovs-dummy],
3806   [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
3807   [-generate],
3808   [1,3,100])
3809
3810 # Check that the MAC learning entry was updated.
3811 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3812  port  VLAN  MAC                Age
3813     1     0  50:54:00:00:00:06    ?
3814     2     0  50:54:00:00:00:05    ?
3815 ])
3816
3817 # Add another bridge.
3818 AT_CHECK(
3819   [ovs-vsctl \
3820      -- add-br br1 \
3821      -- set bridge br1 datapath-type=dummy])
3822 ADD_OF_PORTS([br1], 4, 5)
3823
3824 # Trace some packet arrivals in br1 to create MAC learning entries there too.
3825 OFPROTO_TRACE(
3826   [ovs-dummy],
3827   [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
3828   [-generate],
3829   [5,101])
3830 OFPROTO_TRACE(
3831   [ovs-dummy],
3832   [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
3833   [-generate],
3834   [4,101])
3835
3836 # Check that the MAC learning entries were added.
3837 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3838  port  VLAN  MAC                Age
3839     4     0  50:54:00:00:00:06    ?
3840     5     0  50:54:00:00:00:07    ?
3841 ])
3842
3843 # Delete port p1 and see that its MAC learning entry disappeared, and
3844 # that the MAC learning entry for the same MAC was also deleted from br1.
3845 AT_CHECK([ovs-vsctl del-port p1])
3846 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3847  port  VLAN  MAC                Age
3848     2     0  50:54:00:00:00:05    ?
3849 ])
3850 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
3851  port  VLAN  MAC                Age
3852     5     0  50:54:00:00:00:07    ?
3853 ])
3854
3855 OVS_VSWITCHD_STOP
3856 AT_CLEANUP
3857
3858 AT_SETUP([ofproto-dpif - MAC table overflow])
3859 OVS_VSWITCHD_START(
3860   [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
3861 ADD_OF_PORTS([br0], 1, 2, 3)
3862
3863 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)'
3864
3865 AT_CHECK([ovs-appctl time/stop])
3866
3867 # Trace 10 ARP packets arriving on p3, to create MAC learning entries.
3868 for i in 0 1 2 3 4 5 6 7 8 9; do
3869     OFPROTO_TRACE(
3870       [ovs-dummy],
3871       [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
3872       [-generate],
3873       [1,2,100])
3874     ovs-appctl time/warp 1000
3875 done
3876
3877 # Check for the MAC learning entries.
3878 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
3879   [0], [dnl
3880     3     0  50:54:00:00:00:00
3881     3     0  50:54:00:00:00:01
3882     3     0  50:54:00:00:00:02
3883     3     0  50:54:00:00:00:03
3884     3     0  50:54:00:00:00:04
3885     3     0  50:54:00:00:00:05
3886     3     0  50:54:00:00:00:06
3887     3     0  50:54:00:00:00:07
3888     3     0  50:54:00:00:00:08
3889     3     0  50:54:00:00:00:09
3890  port  VLAN  MAC                Age
3891 ])
3892
3893 # Trace another ARP packet on another MAC.
3894 OFPROTO_TRACE(
3895   [ovs-dummy],
3896   [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
3897   [-generate],
3898   [1,2,100])
3899
3900 # Check that the new one chased the oldest one out of the table.
3901 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
3902   [0], [dnl
3903     3     0  50:54:00:00:00:01    ?
3904     3     0  50:54:00:00:00:02    ?
3905     3     0  50:54:00:00:00:03    ?
3906     3     0  50:54:00:00:00:04    ?
3907     3     0  50:54:00:00:00:05    ?
3908     3     0  50:54:00:00:00:06    ?
3909     3     0  50:54:00:00:00:07    ?
3910     3     0  50:54:00:00:00:08    ?
3911     3     0  50:54:00:00:00:09    ?
3912     3     0  50:54:00:00:00:10    ?
3913  port  VLAN  MAC                Age
3914 ])
3915 OVS_VSWITCHD_STOP
3916 AT_CLEANUP
3917
3918 # CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR, ADDR_WITHOUT_BRACKETS)
3919 #
3920 # Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
3921 #
3922 # IP_VERSION_TYPE is used in AT_SETUP
3923 m4_define([CHECK_SFLOW_SAMPLING_PACKET],
3924   [AT_SETUP([ofproto-dpif - sFlow packet sampling - $2 collector])
3925   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
3926
3927   ON_EXIT([kill `cat test-sflow.pid`])
3928   AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
3929   AT_CAPTURE_FILE([sflow.log])
3930   SFLOW_PORT=`parse_listening_port < test-sflow.log`
3931   ovs-appctl time/stop
3932
3933   ADD_OF_PORTS([br0], 1, 2)
3934   ovs-vsctl \
3935      set Interface br0 options:ifindex=1002 -- \
3936      set Interface p1 options:ifindex=1004 -- \
3937      set Interface p2 options:ifindex=1003 -- \
3938      set Bridge br0 sflow=@sf -- \
3939      --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
3940        header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
3941
3942   dnl open with ARP packets to seed the bridge-learning.  The output
3943   dnl ifIndex numbers should be reported predictably after that.
3944   dnl Since we set sampling=1 we should see all of these packets
3945   dnl reported. Sorting the output by data-source and seqNo makes
3946   dnl it deterministic. Ensuring that we send at least two packets
3947   dnl into each port means we get to check the seq nos are
3948   dnl incrementing correctly.
3949   dnl because packets from different ports can be handled by separate
3950   dnl threads, put some sleeps
3951
3952   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)'
3953   sleep 1
3954   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)'
3955   sleep 1
3956   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)'
3957   sleep 1
3958   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)'
3959   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)'
3960
3961   dnl sleep long enough to get more than one counter sample
3962   dnl from each datasource so we can check sequence numbers
3963   for i in `seq 1 30`; do
3964       ovs-appctl time/warp 100
3965   done
3966   OVS_VSWITCHD_STOP
3967   ovs-appctl -t test-sflow exit
3968
3969   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
3970         /g']], [0], [dnl
3971 HEADER
3972         dgramSeqNo=1
3973         ds=127.0.0.1>2:1000
3974         fsSeqNo=1
3975         in_vlan=0
3976         in_priority=0
3977         out_vlan=0
3978         out_priority=0
3979         meanSkip=1
3980         samplePool=1
3981         dropEvents=0
3982         in_ifindex=1004
3983         in_format=0
3984         out_ifindex=2
3985         out_format=2
3986         hdr_prot=1
3987         pkt_len=64
3988         stripped=4
3989         hdr_len=60
3990         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
3991 HEADER
3992         dgramSeqNo=1
3993         ds=127.0.0.1>2:1000
3994         fsSeqNo=2
3995         in_vlan=0
3996         in_priority=0
3997         out_vlan=0
3998         out_priority=0
3999         meanSkip=1
4000         samplePool=2
4001         dropEvents=0
4002         in_ifindex=1003
4003         in_format=0
4004         out_ifindex=2
4005         out_format=2
4006         hdr_prot=1
4007         pkt_len=64
4008         stripped=4
4009         hdr_len=60
4010         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
4011 HEADER
4012         dgramSeqNo=1
4013         ds=127.0.0.1>2:1000
4014         fsSeqNo=3
4015         in_vlan=0
4016         in_priority=0
4017         out_vlan=0
4018         out_priority=0
4019         meanSkip=1
4020         samplePool=3
4021         dropEvents=0
4022         in_ifindex=1004
4023         in_format=0
4024         out_ifindex=1003
4025         out_format=0
4026         hdr_prot=1
4027         pkt_len=64
4028         stripped=4
4029         hdr_len=60
4030         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
4031 HEADER
4032         dgramSeqNo=1
4033         ds=127.0.0.1>2:1000
4034         fsSeqNo=4
4035         in_vlan=0
4036         in_priority=0
4037         out_vlan=0
4038         out_priority=0
4039         meanSkip=1
4040         samplePool=4
4041         dropEvents=0
4042         in_ifindex=1003
4043         in_format=0
4044         out_ifindex=1004
4045         out_format=0
4046         hdr_prot=1
4047         pkt_len=64
4048         stripped=4
4049         hdr_len=60
4050         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
4051 HEADER
4052         dgramSeqNo=1
4053         ds=127.0.0.1>2:1000
4054         fsSeqNo=5
4055         in_vlan=0
4056         in_priority=0
4057         out_vlan=0
4058         out_priority=0
4059         meanSkip=1
4060         samplePool=5
4061         dropEvents=0
4062         in_ifindex=1003
4063         in_format=0
4064         out_ifindex=1004
4065         out_format=0
4066         hdr_prot=1
4067         pkt_len=64
4068         stripped=4
4069         hdr_len=60
4070         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
4071 ])
4072
4073   AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR' | head -6 | sed 's/ /\
4074         /g']], [0], [dnl
4075 IFCOUNTERS
4076         dgramSeqNo=2
4077         ds=127.0.0.1>0:1002
4078         csSeqNo=1
4079         ifindex=1002
4080         type=6
4081         ifspeed=100000000
4082         direction=0
4083         status=0
4084         in_octets=0
4085         in_unicasts=0
4086         in_multicasts=0
4087         in_broadcasts=4294967295
4088         in_discards=0
4089         in_errors=0
4090         in_unknownprotos=4294967295
4091         out_octets=120
4092         out_unicasts=2
4093         out_multicasts=4294967295
4094         out_broadcasts=4294967295
4095         out_discards=0
4096         out_errors=0
4097         promiscuous=0
4098 IFCOUNTERS
4099         dgramSeqNo=2
4100         ds=127.0.0.1>0:1003
4101         csSeqNo=1
4102         ifindex=1003
4103         type=6
4104         ifspeed=100000000
4105         direction=0
4106         status=0
4107         in_octets=138
4108         in_unicasts=3
4109         in_multicasts=0
4110         in_broadcasts=4294967295
4111         in_discards=0
4112         in_errors=0
4113         in_unknownprotos=4294967295
4114         out_octets=120
4115         out_unicasts=2
4116         out_multicasts=4294967295
4117         out_broadcasts=4294967295
4118         out_discards=0
4119         out_errors=0
4120         promiscuous=0
4121 IFCOUNTERS
4122         dgramSeqNo=2
4123         ds=127.0.0.1>0:1004
4124         csSeqNo=1
4125         ifindex=1004
4126         type=6
4127         ifspeed=100000000
4128         direction=0
4129         status=0
4130         in_octets=84
4131         in_unicasts=2
4132         in_multicasts=0
4133         in_broadcasts=4294967295
4134         in_discards=0
4135         in_errors=0
4136         in_unknownprotos=4294967295
4137         out_octets=180
4138         out_unicasts=3
4139         out_multicasts=4294967295
4140         out_broadcasts=4294967295
4141         out_discards=0
4142         out_errors=0
4143         promiscuous=0
4144 IFCOUNTERS
4145         dgramSeqNo=3
4146         ds=127.0.0.1>0:1002
4147         csSeqNo=2
4148         ifindex=1002
4149         type=6
4150         ifspeed=100000000
4151         direction=0
4152         status=0
4153         in_octets=0
4154         in_unicasts=0
4155         in_multicasts=0
4156         in_broadcasts=4294967295
4157         in_discards=0
4158         in_errors=0
4159         in_unknownprotos=4294967295
4160         out_octets=120
4161         out_unicasts=2
4162         out_multicasts=4294967295
4163         out_broadcasts=4294967295
4164         out_discards=0
4165         out_errors=0
4166         promiscuous=0
4167 IFCOUNTERS
4168         dgramSeqNo=3
4169         ds=127.0.0.1>0:1003
4170         csSeqNo=2
4171         ifindex=1003
4172         type=6
4173         ifspeed=100000000
4174         direction=0
4175         status=0
4176         in_octets=138
4177         in_unicasts=3
4178         in_multicasts=0
4179         in_broadcasts=4294967295
4180         in_discards=0
4181         in_errors=0
4182         in_unknownprotos=4294967295
4183         out_octets=120
4184         out_unicasts=2
4185         out_multicasts=4294967295
4186         out_broadcasts=4294967295
4187         out_discards=0
4188         out_errors=0
4189         promiscuous=0
4190 IFCOUNTERS
4191         dgramSeqNo=3
4192         ds=127.0.0.1>0:1004
4193         csSeqNo=2
4194         ifindex=1004
4195         type=6
4196         ifspeed=100000000
4197         direction=0
4198         status=0
4199         in_octets=84
4200         in_unicasts=2
4201         in_multicasts=0
4202         in_broadcasts=4294967295
4203         in_discards=0
4204         in_errors=0
4205         in_unknownprotos=4294967295
4206         out_octets=180
4207         out_unicasts=3
4208         out_multicasts=4294967295
4209         out_broadcasts=4294967295
4210         out_discards=0
4211         out_errors=0
4212         promiscuous=0
4213 ])
4214   AT_CLEANUP])
4215
4216 CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1], [IPv4])
4217 CHECK_SFLOW_SAMPLING_PACKET([[[::1]]], [IPv6])
4218
4219 # CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4220 #
4221 # Test that basic NetFlow reports flow statistics correctly:
4222 # The initial packet of a flow are correctly accounted.
4223 # Later packets within a flow are correctly accounted.
4224 # Flow actions changing (in this case, due to MAC learning)
4225 # cause a record to be sent.
4226 #
4227 # IP_VERSION_TYPE is used in AT_SETUP
4228 m4_define([CHECK_NETFLOW_EXPIRATION],
4229   [AT_SETUP([ofproto-dpif - NetFlow flow expiration - $2 collector])
4230   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4231   ADD_OF_PORTS([br0], 1, 2)
4232
4233   ovs-appctl time/stop
4234   ON_EXIT([kill `cat test-netflow.pid`])
4235   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4236   AT_CAPTURE_FILE([netflow.log])
4237   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4238
4239   ovs-vsctl \
4240      set Bridge br0 netflow=@nf -- \
4241      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4242        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
4243
4244   for delay in 1000 30000; do
4245       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)'
4246       sleep 1  # ensure the order in which these two packets are processed
4247       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)'
4248
4249       ovs-appctl time/warp $delay
4250   done
4251
4252   ovs-appctl time/warp 6000
4253   sleep 1
4254   OVS_VSWITCHD_STOP
4255   ovs-appctl -t test-netflow exit
4256
4257   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])
4258
4259   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])
4260
4261   combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
4262   separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
4263   AT_CHECK([test $separate = 2 || test $combined = 1], [0])
4264
4265   AT_CLEANUP])
4266
4267 CHECK_NETFLOW_EXPIRATION([127.0.0.1], [IPv4])
4268 CHECK_NETFLOW_EXPIRATION([[[::1]]], [IPv6])
4269
4270 # CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR, IP_VERSION_TYPE)
4271 #
4272 # Test that basic NetFlow reports active expirations correctly.
4273 #
4274 # IP_VERSION_TYPE is used in AT_SETUP
4275 m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4276   [AT_SETUP([ofproto-dpif - NetFlow active expiration - $2 collector])
4277
4278   OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4279   ADD_OF_PORTS([br0], 1, 2)
4280
4281   ON_EXIT([kill `cat test-netflow.pid`])
4282   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4283   AT_CAPTURE_FILE([netflow.log])
4284   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4285
4286   ovs-vsctl \
4287      set Bridge br0 netflow=@nf -- \
4288      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4289        engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
4290
4291   AT_CHECK([ovs-appctl time/stop])
4292   n=1
4293   while test $n -le 60; do
4294       n=`expr $n + 1`
4295
4296       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)'
4297       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)'
4298
4299       ovs-appctl time/warp 1000
4300   done
4301
4302   ovs-appctl time/warp 10000
4303
4304   sleep 1
4305   OVS_VSWITCHD_STOP
4306   ovs-appctl -t test-netflow exit
4307
4308   # Count the number of reported packets:
4309   # - From source to destination before MAC learning kicks in (just one).
4310   # - From source to destination after that.
4311   # - From destination to source.
4312   n_learn=0
4313   n_in=0
4314   n_out=0
4315   n_other=0
4316   n_recs=0
4317   none=0
4318   while read line; do
4319       pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
4320       case $pkts in
4321            [[0-9]]*) ;;
4322        *) continue ;;
4323       esac
4324
4325       case $line in
4326           "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4327               counter=n_learn
4328           ;;
4329       "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
4330           counter=n_in
4331           ;;
4332       "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
4333           counter=n_out
4334           ;;
4335       *)
4336           counter=n_other
4337           ;;
4338       esac
4339       eval $counter=\`expr \$$counter + \$pkts\`
4340       n_recs=`expr $n_recs + 1`
4341   done < netflow.log
4342
4343   # There should be exactly 1 MAC learning packet,
4344   # exactly 59 other packets in that direction,
4345   # and exactly 60 packets in the other direction.
4346   AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4347 ])
4348
4349   AT_CLEANUP])
4350
4351 CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1], [IPv4])
4352 CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]], [IPv6])
4353
4354 AT_SETUP([ofproto-dpif - flow stats])
4355 OVS_VSWITCHD_START
4356 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
4357 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
4358
4359 ovs-appctl time/stop
4360
4361 for i in `seq 1 10`; do
4362     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)'
4363 done
4364
4365 ovs-appctl time/warp 1000
4366 sleep 1  # wait for revalidator to update stats
4367
4368 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
4369 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
4370  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
4371  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
4372 ])
4373 OVS_VSWITCHD_STOP
4374 AT_CLEANUP
4375
4376 AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
4377 OVS_VSWITCHD_START
4378 AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
4379 AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
4380
4381 ovs-appctl time/stop
4382
4383 for i in `seq 1 10`; do
4384     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)'
4385 done
4386
4387 ovs-appctl time/warp 100
4388 AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
4389 ovs-appctl time/warp 1000
4390
4391 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
4392 AT_CHECK([STRIP_XIDS stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
4393  cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
4394  cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
4395 ])
4396 OVS_VSWITCHD_STOP
4397 AT_CLEANUP
4398
4399 AT_SETUP([idle_age and hard_age increase over time])
4400 OVS_VSWITCHD_START
4401
4402 # get_ages DURATION HARD IDLE
4403 #
4404 # Fetch the flow duration, hard age, and idle age into the variables
4405 # whose names are given as arguments.  Rounds DURATION down to the
4406 # nearest integer.  If hard_age doesn't appear in the output, sets
4407 # HARD to "none".  If idle_age doesn't appear in the output, sets IDLE
4408 # to 0.
4409 get_ages () {
4410     AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
4411
4412     duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
4413     AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
4414     AS_VAR_COPY([$1], [duration])
4415
4416     hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
4417     if test X"$hard" = X; then
4418         hard=none
4419     else
4420         AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
4421     fi
4422     AS_VAR_COPY([$2], [hard])
4423
4424     idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
4425     if test X"$idle" = X; then
4426         idle=0
4427     else
4428         AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
4429     fi
4430     AS_VAR_COPY([$3], [idle])
4431 }
4432
4433 # Add a flow and get its initial hard and idle age.
4434 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
4435 get_ages duration1 hard1 idle1
4436
4437 ovs-appctl time/stop
4438 # Warp time forward by 10 seconds, then modify the flow's actions.
4439 ovs-appctl time/warp 10000
4440 get_ages duration2 hard2 idle2
4441 AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
4442
4443 # Warp time forward by 10 seconds.
4444 ovs-appctl time/warp 10000
4445 get_ages duration3 hard3 idle3
4446
4447 # Warp time forward 10 more seconds, then pass some packets through the flow,
4448 # then warp forward a few more times because idle times are only updated
4449 # occasionally.
4450 ovs-appctl time/warp 10000
4451 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)'
4452 ovs-appctl time/warp 1000
4453 ovs-appctl time/warp 1000
4454 ovs-appctl time/warp 1000
4455 sleep 1
4456 get_ages duration4 hard4 idle4
4457
4458 printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
4459 printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
4460 printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
4461
4462 # Duration should increase steadily over time.
4463 AT_CHECK([test $duration1 -lt $duration2])
4464 AT_CHECK([test $duration2 -lt $duration3])
4465 AT_CHECK([test $duration3 -lt $duration4])
4466
4467 # Hard age should be "none" initially because it's the same as flow_duration,
4468 # then it should increase.
4469 AT_CHECK([test $hard1 = none])
4470 AT_CHECK([test $hard2 = none])
4471 AT_CHECK([test $hard3 != none])
4472 AT_CHECK([test $hard4 != none])
4473 AT_CHECK([test $hard3 -lt $hard4])
4474
4475 # Idle age should increase from 1 to 2 to 3, then decrease.
4476 AT_CHECK([test $idle1 -lt $idle2])
4477 AT_CHECK([test $idle2 -lt $idle3])
4478 AT_CHECK([test $idle3 -gt $idle4])
4479
4480 # Check some invariant relationships.
4481 AT_CHECK([test $duration1 = $idle1])
4482 AT_CHECK([test $duration2 = $idle2])
4483 AT_CHECK([test $duration3 = $idle3])
4484 AT_CHECK([test $idle3 -gt $hard3])
4485 AT_CHECK([test $idle4 -lt $hard4])
4486 AT_CHECK([test $hard4 -lt $duration4])
4487
4488 OVS_VSWITCHD_STOP
4489 AT_CLEANUP
4490
4491 AT_SETUP([ofproto-dpif - fin_timeout])
4492 OVS_VSWITCHD_START
4493 ovs-appctl time/stop
4494 AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
4495 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
4496 [NXST_FLOW reply:
4497  idle_timeout=60, actions=fin_timeout(idle_timeout=5)
4498 ])
4499
4500 # Check that a TCP SYN packet does not change the timeout.  (Because
4501 # flow stats updates are mainly what implements the fin_timeout
4502 # feature, we warp forward a couple of times to ensure that flow stats
4503 # run before re-checking the flow table.)
4504 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
4505 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
4506 warped
4507 ])
4508 sleep 1
4509 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
4510 [NXST_FLOW reply:
4511  n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
4512 ])
4513 # Check that a TCP FIN packet does change the timeout.
4514 AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
4515 AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
4516 warped
4517 ])
4518 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
4519 [NXST_FLOW reply:
4520  n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
4521 ])
4522 OVS_VSWITCHD_STOP
4523 AT_CLEANUP
4524
4525 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
4526 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
4527 ADD_OF_PORTS([br0], [1], [2])
4528 ADD_OF_PORTS([br1], [3])
4529
4530 AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
4531 dummy@br0
4532 dummy@br1
4533 ])
4534 OVS_VSWITCHD_STOP
4535 AT_CLEANUP
4536
4537 AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
4538 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
4539 ADD_OF_PORTS([br0], [1], [2])
4540 ADD_OF_PORTS([br1], [3])
4541
4542 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
4543 dummy@ovs-dummy: hit:0 missed:0
4544         br0:
4545                 br0 65534/100: (dummy)
4546                 p1 1/1: (dummy)
4547                 p2 2/2: (dummy)
4548         br1:
4549                 br1 65534/101: (dummy)
4550                 p3 3/3: (dummy)
4551 ])
4552 OVS_VSWITCHD_STOP
4553 AT_CLEANUP
4554
4555 AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
4556 # bump max-idle to avoid the flows being reclaimed behind us
4557 OVS_VSWITCHD_START([add-br br1 -- \
4558                     set bridge br1 datapath-type=dummy fail-mode=secure -- \
4559                     set Open_vSwitch . other_config:max-idle=10000])
4560 ADD_OF_PORTS([br0], [1], [2])
4561 ADD_OF_PORTS([br1], [3])
4562
4563 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)'])
4564 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)'])
4565 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)'])
4566 sleep 1  # wait for upcall handlers
4567 AT_CHECK([ovs-appctl dpif/dump-flows br0 | sort | STRIP_USED], [0], [dnl
4568 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
4569 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
4570 ])
4571
4572 AT_CHECK([ovs-appctl dpif/dump-flows br1 | sort | STRIP_USED], [0], [dnl
4573 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
4574 ])
4575
4576 AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sort | STRIP_USED], [0], [dnl
4577 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
4578 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
4579 ])
4580
4581 AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | sort | STRIP_USED], [0], [dnl
4582 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
4583 ])
4584
4585 OVS_VSWITCHD_STOP
4586 AT_CLEANUP
4587
4588 AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
4589 OVS_VSWITCHD_START([dnl
4590    add-port br0 p1 -- set Interface p1 type=dummy
4591 ])
4592 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4593 ON_EXIT([kill `cat ovs-ofctl.pid`])
4594
4595 AT_CAPTURE_FILE([ofctl_monitor.log])
4596 AT_DATA([flows.txt], [dnl
4597 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
4598 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
4599 ])
4600 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4601
4602 dnl Packet is sent to userspace because a MPLS push or pop action is applied to
4603 dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
4604 dnl
4605 dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
4606 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)
4607 dnl         (label 20, exp 0, [S], ttl 32)
4608 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
4609 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
4610
4611 for dl_src in 00 01; do
4612     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"])
4613 done
4614 sleep 1  # wait for the datapath flow installed
4615 for dl_src in 00 01; do
4616     AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep ":$dl_src/" | STRIP_USED], [0], [dnl
4617 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))
4618 ])
4619 done
4620
4621 OVS_VSWITCHD_STOP
4622 AT_CLEANUP
4623
4624
4625 AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
4626 OVS_VSWITCHD_START([dnl
4627    add-port br0 p1 -- set Interface p1 type=dummy
4628 ])
4629 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4630 ON_EXIT([kill `cat ovs-ofctl.pid`])
4631
4632 AT_CAPTURE_FILE([ofctl_monitor.log])
4633 AT_DATA([flows.txt], [dnl
4634 dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
4635 dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8849,controller
4636 ])
4637 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4638
4639 dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
4640 dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
4641 dnl can't determine the resulting MPLS label after MPLS push/pop actions.
4642 dnl
4643 dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
4644 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)
4645 dnl         (label 20, exp 0, ttl 32)
4646 dnl         (label 20, exp 0, ttl 32)
4647 dnl         (label 20, exp 0, [S], ttl 32)
4648 dnl         (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
4649 dnl     192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
4650
4651 for dl_src in 00 01; do
4652     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"])
4653 done
4654 sleep 1  # wait for the datapath flow installed
4655 for dl_src in 00 01; do
4656     AT_CHECK_UNQUOTED([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | grep ":$dl_src/" | STRIP_USED], [0], [dnl
4657 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))
4658 ])
4659 done
4660
4661 OVS_VSWITCHD_STOP
4662 AT_CLEANUP
4663
4664 AT_SETUP([ofproto-dpif - patch ports])
4665 OVS_VSWITCHD_START([add-br br1 \
4666 -- set bridge br1 datapath-type=dummy fail-mode=secure \
4667 -- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
4668 -- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
4669
4670 ADD_OF_PORTS([br0], [2])
4671 ADD_OF_PORTS([br1], [3])
4672
4673 AT_CHECK([ovs-appctl time/stop])
4674 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4675
4676 AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
4677 AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
4678
4679 for i in $(seq 1 10); do
4680     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)'
4681     if [[ $i -eq 1 ]]; then
4682         sleep 1
4683     fi
4684 done
4685
4686 for i in $(seq 1 5); do
4687     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)'
4688     if [[ $i -eq 1 ]]; then
4689         sleep 1
4690     fi
4691 done
4692
4693 AT_CHECK([ovs-appctl time/warp 500], [0],
4694 [warped
4695 ])
4696 sleep 1  # wait for log writer
4697
4698 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
4699 dummy@ovs-dummy: hit:13 missed:2
4700         br0:
4701                 br0 65534/100: (dummy)
4702                 p2 2/2: (dummy)
4703                 pbr0 1/none: (patch: peer=pbr1)
4704         br1:
4705                 br1 65534/101: (dummy)
4706                 p3 3/3: (dummy)
4707                 pbr1 1/none: (patch: peer=pbr0)
4708 ])
4709
4710 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
4711 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
4712 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
4713 ])
4714
4715 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(100).*packets:9' | FILTER_FLOW_DUMP], [0], [dnl
4716 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
4717 ])
4718 AT_CHECK([cat ovs-vswitchd.log | grep -e 'in_port(101).*packets:4' | FILTER_FLOW_DUMP], [0], [dnl
4719 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
4720 ])
4721
4722 AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
4723 OFPST_PORT reply (xid=0x4): 1 ports
4724   port  1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
4725            tx pkts=10, bytes=600, drop=0, errs=0, coll=0
4726 ])
4727
4728 AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
4729 OFPST_PORT reply (xid=0x4): 1 ports
4730   port  1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
4731            tx pkts=5, bytes=300, drop=0, errs=0, coll=0
4732 ])
4733
4734 OVS_VSWITCHD_STOP
4735 AT_CLEANUP
4736
4737 AT_SETUP([ofproto-dpif - port duration])
4738 OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
4739 ADD_OF_PORTS([br0], 1, 2)
4740
4741 ovs-appctl time/stop
4742 ovs-appctl time/warp 10000
4743
4744 AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
4745 AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
4746 [dnl
4747            duration=?s
4748            duration=?s
4749            duration=?s
4750 ])
4751 OVS_VSWITCHD_STOP
4752 AT_CLEANUP
4753
4754 dnl ----------------------------------------------------------------------
4755 AT_BANNER([ofproto-dpif -- megaflows])
4756
4757 AT_SETUP([ofproto-dpif megaflow - port classification])
4758 OVS_VSWITCHD_START
4759 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4760 ADD_OF_PORTS([br0], [1], [2])
4761 AT_DATA([flows.txt], [dnl
4762 table=0 in_port=1 actions=output(2)
4763 ])
4764 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4765 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)'])
4766 sleep 1
4767 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)'])
4768 sleep 1
4769 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4770 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>
4771 ])
4772 OVS_VSWITCHD_STOP
4773 AT_CLEANUP
4774
4775 AT_SETUP([ofproto-dpif megaflow - L2 classification])
4776 OVS_VSWITCHD_START
4777 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4778 ADD_OF_PORTS([br0], [1], [2])
4779 AT_DATA([flows.txt], [dnl
4780 table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
4781 ])
4782 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4783 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)'])
4784 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)'])
4785 sleep 1
4786 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4787 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>
4788 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:02,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>
4789 ])
4790 OVS_VSWITCHD_STOP
4791 AT_CLEANUP
4792
4793 AT_SETUP([ofproto-dpif megaflow - L3 classification])
4794 OVS_VSWITCHD_START
4795 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4796 ADD_OF_PORTS([br0], [1], [2])
4797 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], [])
4798 AT_DATA([flows.txt], [dnl
4799 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
4800 ])
4801 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4802 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)'])
4803 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)'])
4804 sleep 1
4805 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4806 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.2,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>
4807 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>
4808 ])
4809 OVS_VSWITCHD_STOP
4810 AT_CLEANUP
4811
4812 AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
4813 OVS_VSWITCHD_START
4814 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4815 ADD_OF_PORTS([br0], [1], [2])
4816 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], [])
4817 AT_DATA([flows.txt], [dnl
4818 table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
4819 ])
4820 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4821 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)'])
4822 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)'])
4823 sleep 1
4824 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4825 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>
4826 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/0:0:0:4::,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>
4827 ])
4828 OVS_VSWITCHD_STOP
4829 AT_CLEANUP
4830
4831 AT_SETUP([ofproto-dpif megaflow - L4 classification])
4832 OVS_VSWITCHD_START
4833 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4834 ADD_OF_PORTS([br0], [1], [2])
4835 AT_DATA([flows.txt], [dnl
4836 table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
4837 ])
4838 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4839 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)'])
4840 sleep 1
4841 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)'])
4842 sleep 1
4843 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4844 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>
4845 ])
4846 OVS_VSWITCHD_STOP
4847 AT_CLEANUP
4848
4849 AT_SETUP([ofproto-dpif megaflow - normal])
4850 OVS_VSWITCHD_START
4851 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4852 ADD_OF_PORTS([br0], [1], [2])
4853 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4854 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)'])
4855 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)'])
4856 sleep 1
4857 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4858 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>
4859 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>
4860 ])
4861 OVS_VSWITCHD_STOP
4862 AT_CLEANUP
4863
4864 AT_SETUP([ofproto-dpif megaflow - mpls])
4865 OVS_VSWITCHD_START
4866 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4867 ADD_OF_PORTS([br0], [1], [2])
4868 AT_DATA([flows.txt], [dnl
4869 table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
4870 table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
4871 ])
4872 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4873 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)'])
4874 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)'])
4875 sleep 1
4876 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4877 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>
4878 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>
4879 ])
4880 OVS_VSWITCHD_STOP
4881 AT_CLEANUP
4882
4883 # CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR, IP_VERSION_TYPE)
4884 #
4885 # IP_VERSION_TYPE is used in AT_SETUP
4886 m4_define([CHECK_MEGAFLOW_NETFLOW],
4887   [AT_SETUP([ofproto-dpif megaflow - netflow - $2 collector])
4888   OVS_VSWITCHD_START
4889   AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4890   ADD_OF_PORTS([br0], [1], [2])
4891
4892   dnl NetFlow configuration disables wildcarding relevant fields
4893   ON_EXIT([kill `cat test-netflow.pid`])
4894   AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
4895   AT_CAPTURE_FILE([netflow.log])
4896   NETFLOW_PORT=`parse_listening_port < test-netflow.log`
4897   ovs-vsctl \
4898      set Bridge br0 netflow=@nf -- \
4899      --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
4900        engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
4901
4902   AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4903   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)'])
4904   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)'])
4905   sleep 1
4906   AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4907 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>
4908 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>
4909 ])
4910   OVS_VSWITCHD_STOP
4911   AT_CLEANUP])
4912
4913 CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4914 CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4915
4916 AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
4917 OVS_VSWITCHD_START(
4918   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
4919    add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
4920    set interface p2 type=dummy ofport_request=2 -- \
4921    set interface p3 type=dummy ofport_request=3])
4922 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4923 ])
4924 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4925
4926 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4927 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)'])
4928 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)'])
4929 sleep 1
4930 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4931 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>
4932 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>
4933 ])
4934 OVS_VSWITCHD_STOP
4935 AT_CLEANUP
4936
4937 AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
4938 OVS_VSWITCHD_START(
4939   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
4940    add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
4941    set interface p2 type=dummy ofport_request=2 -- \
4942    set interface p3 type=dummy ofport_request=3])
4943 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4944 ])
4945 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4946
4947 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4948 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)'])
4949 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)'])
4950 sleep 1
4951 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4952 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>
4953 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>
4954 ])
4955 OVS_VSWITCHD_STOP
4956 AT_CLEANUP
4957
4958 AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
4959 # Create bond0 on br0 with interfaces p0 and p1
4960 #    and bond1 on br1 with interfaces p2 and p3
4961 # with p0 patched to p2 and p1 patched to p3.
4962 OVS_VSWITCHD_START(
4963   [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
4964                             other-config:lacp-time=fast \
4965                             other-config:bond-rebalance-interval=0 -- \
4966    set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
4967    set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
4968    add-br br1 -- \
4969    set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
4970    set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
4971                   fail-mode=secure -- \
4972    add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
4973                             other-config:lacp-time=fast \
4974                             other-config:bond-rebalance-interval=0 -- \
4975    set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
4976    set interface p3 type=patch options:peer=p1 ofport_request=4 --])
4977
4978 AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
4979 ])
4980 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4981 ADD_OF_PORTS([br0], [7])
4982 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
4983 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
4984 ovs-appctl time/stop
4985 ovs-appctl time/warp 5000
4986 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)'])
4987 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)'])
4988 sleep 1
4989 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
4990 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>
4991 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>
4992 ])
4993 OVS_VSWITCHD_STOP
4994 AT_CLEANUP
4995
4996 AT_SETUP([ofproto-dpif megaflow - resubmit port action])
4997 OVS_VSWITCHD_START
4998 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
4999 ADD_OF_PORTS([br0], [1], [2])
5000 AT_DATA([flows.txt], [dnl
5001 table=0 in_port=1,ip actions=resubmit(90)
5002 table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
5003 ])
5004 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5005 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)'])
5006 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)'])
5007 sleep 1
5008 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5009 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>
5010 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:02,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>
5011 ])
5012 OVS_VSWITCHD_STOP
5013 AT_CLEANUP
5014
5015 AT_SETUP([ofproto-dpif megaflow - resubmit table action])
5016 OVS_VSWITCHD_START
5017 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5018 ADD_OF_PORTS([br0], [1], [2])
5019 AT_DATA([flows.txt], [dnl
5020 table=0 in_port=1,ip actions=resubmit(,1)
5021 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5022 ])
5023 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5024 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)'])
5025 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=
5026 1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
5027 sleep 1
5028 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5029 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>
5030 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>
5031 ])
5032 OVS_VSWITCHD_STOP
5033 AT_CLEANUP
5034
5035 AT_SETUP([ofproto-dpif megaflow - goto_table action])
5036 OVS_VSWITCHD_START
5037 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5038 ADD_OF_PORTS([br0], [1], [2])
5039 AT_DATA([flows.txt], [dnl
5040 table=0 in_port=1,ip actions=goto_table(1)
5041 table=1 dl_src=50:54:00:00:00:09 actions=output(2)
5042 ])
5043 AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
5044 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)'])
5045 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)'])
5046 sleep 1
5047 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5048 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>
5049 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>
5050 ])
5051 OVS_VSWITCHD_STOP
5052 AT_CLEANUP
5053
5054 AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
5055 OVS_VSWITCHD_START
5056 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5057 ADD_OF_PORTS([br0], [1], [2], [3])
5058 ovs-vsctl \
5059         set Bridge br0 mirrors=@m --\
5060         --id=@p3 get Port p3 --\
5061         --id=@m create Mirror name=mymirror select_all=true output_port=@p3
5062
5063 AT_DATA([flows.txt], [dnl
5064 in_port=1 actions=output:2
5065 ])
5066 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5067 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)'])
5068 sleep 1
5069 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)'])
5070 sleep 1
5071 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5072 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>
5073 ])
5074 OVS_VSWITCHD_STOP
5075 AT_CLEANUP
5076
5077 AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
5078 OVS_VSWITCHD_START
5079 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5080 ADD_OF_PORTS([br0], [1], [2], [3])
5081 ovs-vsctl \
5082         set Bridge br0 mirrors=@m --\
5083         --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
5084         --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
5085
5086 AT_DATA([flows.txt], [dnl
5087 in_port=1 actions=output:2
5088 ])
5089 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5090 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))'])
5091 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)'])
5092 sleep 1
5093 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5094 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>
5095 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>
5096 ])
5097 OVS_VSWITCHD_STOP
5098 AT_CLEANUP
5099
5100 AT_SETUP([ofproto-dpif megaflow - move action])
5101 OVS_VSWITCHD_START
5102 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5103 ADD_OF_PORTS([br0], [1], [2])
5104 AT_DATA([flows.txt], [dnl
5105 table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
5106 table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
5107 table=0 in_port=91 reg0=0x0a000002,actions=output(2)
5108 ])
5109 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5110 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)'])
5111 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)'])
5112 sleep 1
5113 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5114 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>
5115 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>
5116 ])
5117 OVS_VSWITCHD_STOP
5118 AT_CLEANUP
5119
5120 AT_SETUP([ofproto-dpif megaflow - push action])
5121 OVS_VSWITCHD_START
5122 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5123 ADD_OF_PORTS([br0], [1], [2])
5124 AT_DATA([flows.txt], [dnl
5125 table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
5126 ])
5127 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5128 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)'])
5129 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)'])
5130 sleep 1
5131 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5132 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>
5133 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>
5134 ])
5135 OVS_VSWITCHD_STOP
5136 AT_CLEANUP
5137
5138 AT_SETUP([ofproto-dpif megaflow - learning])
5139 OVS_VSWITCHD_START
5140 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5141 ADD_OF_PORTS([br0], [1], [2])
5142 AT_DATA([flows.txt], [dnl
5143 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
5144 ])
5145 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5146 ovs-appctl time/stop
5147 # We send each packet twice because the first packet in each flow causes the
5148 # flow table to change and thus revalidations, which (depending on timing)
5149 # can keep a megaflow from being installed.  The revalidations are done by
5150 # the second iteration, allowing the flows to be installed.
5151 for i in 1 2; do
5152     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)'])
5153     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)'])
5154     ovs-appctl time/warp 100
5155 done
5156 sleep 1
5157 dnl The original flow is missing due to a revalidation.
5158 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5159 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>
5160 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>
5161 ])
5162 OVS_VSWITCHD_STOP
5163 AT_CLEANUP
5164
5165 AT_SETUP([ofproto-dpif megaflow - tunnels])
5166 OVS_VSWITCHD_START(
5167   [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
5168 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5169 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
5170      options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
5171 AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
5172           ofport_request=3])
5173 AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
5174      options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
5175      ofport_request=4 options:key=flow])
5176 AT_DATA([flows.txt], [dnl
5177 in_port=1,actions=output(2)
5178 in_port=3,actions=output(4)
5179 ])
5180 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5181 dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
5182 dnl will cause the packet to be dropped.
5183 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)'])
5184 sleep 1
5185 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)'])
5186 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)'])
5187 sleep 1
5188 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)'])
5189 sleep 1
5190 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5191 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>
5192 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>
5193 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>
5194 ])
5195 OVS_VSWITCHD_STOP
5196 AT_CLEANUP
5197
5198 AT_SETUP([ofproto-dpif megaflow - dec_ttl])
5199 OVS_VSWITCHD_START
5200 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5201 ADD_OF_PORTS([br0], [1], [2])
5202 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], [])
5203 AT_DATA([flows.txt], [dnl
5204 table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
5205 ])
5206 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5207 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)'])
5208 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)'])
5209 sleep 1
5210 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_XOUT], [0], [dnl
5211 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.2,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>
5212 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>
5213 ])
5214 OVS_VSWITCHD_STOP
5215 AT_CLEANUP
5216
5217 AT_SETUP([ofproto-dpif megaflow - set dl_dst])
5218 OVS_VSWITCHD_START
5219 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5220 ADD_OF_PORTS([br0], [1], [2])
5221 AT_DATA([flows.txt], [dnl
5222 table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
5223 ])
5224 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5225 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)'])
5226 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)'])
5227 sleep 1
5228 dnl The megaflows do not match the same fields, since the first packet
5229 dnl is essentially a no-op.  (The new destination MAC is the same as the
5230 dnl original.) The ofproto-dpif library un-wildcards the destination MAC
5231 dnl so that a packet that doesn't need its MAC address changed doesn't
5232 dnl hide one that does.  Since the first entry doesn't need to change,
5233 dnl only the destination MAC address is matched (as decided by
5234 dnl ofproto-dpif).  The second entry actually updates the destination
5235 dnl MAC, so both the source and destination MAC addresses are
5236 dnl un-wildcarded, since the ODP commit functions update both the source
5237 dnl and destination MAC addresses.
5238 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5239 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
5240 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
5241 ])
5242 OVS_VSWITCHD_STOP
5243 AT_CLEANUP
5244
5245 AT_SETUP([ofproto-dpif megaflow - disabled])
5246 OVS_VSWITCHD_START
5247 AT_CHECK([ovs-appctl vlog/set dpif:dbg])
5248 ADD_OF_PORTS([br0], [1], [2])
5249 AT_DATA([flows.txt], [dnl
5250 table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
5251 table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
5252 ])
5253 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
5254 ], [])
5255 AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
5256 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5257 for i in 1 2 3 4; do
5258     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)'])
5259     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)'])
5260     if [[ $i -eq 1 ]]; then
5261         sleep 1
5262     fi
5263 done
5264 sleep 1
5265 AT_CHECK([cat ovs-vswitchd.log | FILTER_FLOW_INSTALL | STRIP_USED], [0], [dnl
5266 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
5267 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
5268 ])
5269 AT_CHECK([cat ovs-vswitchd.log | grep '00:09.*packets:3' | FILTER_FLOW_DUMP], [0], [dnl
5270 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
5271 ])
5272 AT_CHECK([cat ovs-vswitchd.log | grep '00:0b.*packets:3' | FILTER_FLOW_DUMP], [0], [dnl
5273 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
5274 ])
5275 OVS_VSWITCHD_STOP
5276 AT_CLEANUP
5277
5278 AT_SETUP([ofproto-dpif - datapath port number change])
5279 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5280 ADD_OF_PORTS([br0], 1)
5281
5282 # Trace a flow that should output to p1.
5283 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5284   [0], [stdout])
5285 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
5286 ])
5287
5288 # Change p1's port number to 5.
5289 AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
5290
5291 # Trace a flow that should output to p1 in its new location.
5292 AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
5293   [0], [stdout])
5294 AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
5295 ])
5296 OVS_VSWITCHD_STOP
5297 AT_CLEANUP
5298
5299 # Tests the bundling with various bfd and cfm configurations.
5300 AT_SETUP([ofproto - bundle with variable bfd/cfm config])
5301 OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
5302                     add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
5303                     add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
5304                     set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
5305                     set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
5306                     set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
5307                     set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
5308                     set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
5309                     set Interface p0 cfm_mpid=1 -- \
5310                     set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
5311
5312 ovs-appctl time/stop
5313 # advance the clock to stablize everything.
5314 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
5315 # cfm/show should show 'recv' fault.
5316 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5317         fault: recv
5318 ])
5319 # bfd/show should show 'up'.
5320 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5321         Local Session State: up
5322         Remote Session State: up
5323         Local Session State: up
5324         Remote Session State: up
5325 ])
5326 # bond/show should show 'may-enable: true' for all slaves.
5327 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5328         may_enable: true
5329         may_enable: true
5330         may_enable: true
5331         may_enable: true
5332 ])
5333
5334 # now disable the bfd on p1.
5335 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
5336 # advance the clock to stablize everything.
5337 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
5338 # cfm/show should show 'recv' fault.
5339 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5340         fault: recv
5341 ])
5342 # bfd/show should show 'down'.
5343 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5344         Local Session State: down
5345         Remote Session State: down
5346 ])
5347 # bond/show should show 'may-enable: false' for p0.
5348 AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5349         may_enable: false
5350         may_enable: true
5351 ])
5352
5353 # now enable the bfd on p1 and disable bfd on p0.
5354 AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
5355 AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
5356 # advance the clock to stablize everything.
5357 for i in `seq 0 49`; do ovs-appctl time/warp 100; done
5358 # cfm/show should show 'recv' fault.
5359 AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
5360         fault: recv
5361 ])
5362 # bfd/show should show 'down'.
5363 AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
5364         Local Session State: down
5365         Remote Session State: down
5366 ])
5367 # bond/show should show 'may-enable: false' for p0 and p1.
5368 AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
5369         may_enable: false
5370         may_enable: true
5371         may_enable: false
5372         may_enable: true
5373 ])
5374
5375 OVS_VSWITCHD_STOP
5376 AT_CLEANUP
5377
5378 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
5379 OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
5380
5381 # enable bfd on p0.
5382 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
5383 # check log.
5384 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
5385 # disable bfd on p0.
5386 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
5387 # check log.
5388 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
5389 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
5390
5391 # enable cfm on p0.
5392 AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
5393 # check log.
5394 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
5395 # disable cfm on p0.
5396 AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
5397 # check log.
5398 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
5399 AT_CHECK([cat ovs-vswitchd.log | sed -e '/^.*ofproto_dpif_monitor.*$/d' > ovs-vswitchd.log])
5400
5401 # enable both bfd and cfm on p0.
5402 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
5403 # check log.
5404 OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
5405 # disable bfd on p0.
5406 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
5407 # check log, there should not be the log of thread terminated.
5408 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
5409 ])
5410 # reenable bfd on p0.
5411 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
5412 # check log, should still be on log of thread created.
5413 AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
5414 monitor thread created
5415 ])
5416 # disable bfd and cfm together.
5417 AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
5418 # check log.
5419 OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
5420
5421 OVS_VSWITCHD_STOP
5422 AT_CLEANUP
5423
5424 # this test helps avoid the deadlock between the main thread and monitor thread.
5425 AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
5426 OVS_VSWITCHD_START
5427
5428 for i in `seq 1 199`
5429 do
5430     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])
5431 done
5432
5433 OVS_VSWITCHD_STOP
5434 AT_CLEANUP
5435 \f
5436 AT_BANNER([ofproto-dpif - flow translation resource limits])
5437
5438 AT_SETUP([ofproto-dpif - infinite resubmit])
5439 OVS_VSWITCHD_START
5440 AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
5441 AT_CHECK([ovs-appctl ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
5442   [0], [stdout])
5443 AT_CHECK([tail -1 stdout], [0], [Datapath actions: drop
5444 ])
5445 AT_CHECK([grep -c 'resubmit actions recursed over 64 times' ovs-vswitchd.log],
5446   [0], [1
5447 ])
5448 OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
5449 AT_CLEANUP
5450
5451 AT_SETUP([ofproto-dpif - exponential resubmit chain])
5452 OVS_VSWITCHD_START
5453 ADD_OF_PORTS([br0], 1)
5454 (for i in `seq 1 64`; do
5455      j=`expr $i + 1`
5456      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
5457  done
5458  echo "in_port=65, actions=local") > flows
5459  AT_CHECK([ovs-ofctl add-flows br0 flows])
5460 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
5461 AT_CHECK([grep -c 'over 4096 resubmit actions' ovs-vswitchd.log], [0], [1
5462 ])
5463 OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
5464 AT_CLEANUP
5465
5466 AT_SETUP([ofproto-dpif - too many output actions])
5467 OVS_VSWITCHD_START
5468 ADD_OF_PORTS([br0], 1)
5469 (for i in `seq 1 12`; do
5470      j=`expr $i + 1`
5471      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
5472  done
5473  echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
5474 AT_CHECK([ovs-ofctl add-flows br0 flows])
5475 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
5476 AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
5477   [0], [1
5478 ])
5479 AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' ovs-vswitchd.log], [0], [1
5480 ])
5481 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
5482 AT_CLEANUP
5483
5484 AT_SETUP([ofproto-dpif - stack too deep])
5485 OVS_VSWITCHD_START
5486 ADD_OF_PORTS([br0], 1)
5487 (for i in `seq 1 12`; do
5488      j=`expr $i + 1`
5489      echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
5490  done
5491  push="push:NXM_NX_REG0[[]]"
5492  echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
5493  AT_CHECK([ovs-ofctl add-flows br0 flows])
5494 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
5495 AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' ovs-vswitchd.log], [0], [1
5496 ])
5497 OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
5498 AT_CLEANUP
5499
5500
5501 AT_SETUP([ofproto-dpif packet-out controller])
5502 OVS_VSWITCHD_START
5503 ADD_OF_PORTS([br0], 1, 2)
5504
5505 AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
5506
5507 AT_CAPTURE_FILE([ofctl_monitor.log])
5508 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
5509
5510 for i in 1 2 3; do
5511         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
5512 done
5513
5514 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
5515 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
5516 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
5517 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
5518 dnl
5519 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
5520 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
5521 dnl
5522 NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
5523 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
5524 ])
5525
5526 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
5527  dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
5528 NXST_FLOW reply:
5529 ])
5530
5531 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
5532  echo "  0: active=1, lookup=0, matched=0"
5533  x=1
5534  while test $x -lt 254; do
5535    echo "  $x: active=0, lookup=0, matched=0"
5536    x=`expr $x + 1`
5537  done) > expout
5538 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
5539
5540 OVS_VSWITCHD_STOP
5541 AT_CLEANUP
5542
5543
5544 AT_SETUP([ofproto-dpif packet-out controller (patch port)])
5545 OVS_VSWITCHD_START(
5546   [-- \
5547    add-port br0 p1 -- \
5548    set interface p1 type=patch options:peer=p2 -- \
5549    add-br br1 -- \
5550    set bridge br1 datapath-type=dummy -- \
5551    set bridge br1 fail-mode=secure -- \
5552    set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
5553    add-port br1 p2 -- \
5554    set interface p2 type=patch options:peer=p1 --])
5555
5556 AT_CAPTURE_FILE([ofctl_monitor.log])
5557 AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
5558
5559 for i in 1 2 3; do
5560         AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
5561 done
5562
5563 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
5564 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
5565 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
5566 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
5567 dnl
5568 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
5569 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
5570 dnl
5571 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
5572 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
5573 ])
5574
5575 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
5576  x=0
5577  while test $x -lt 254; do
5578    echo "  $x: active=0, lookup=0, matched=0"
5579    x=`expr $x + 1`
5580  done) > expout
5581 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
5582
5583 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
5584  echo "  0: active=0, lookup=3, matched=0"
5585  x=1
5586  while test $x -lt 254; do
5587    echo "  $x: active=0, lookup=0, matched=0"
5588    x=`expr $x + 1`
5589  done) > expout
5590 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
5591
5592 OVS_VSWITCHD_STOP
5593 AT_CLEANUP
5594
5595
5596 AT_SETUP([ofproto-dpif packet-out goto_table])
5597 OVS_VSWITCHD_START
5598 ADD_OF_PORTS([br0], 1, 2)
5599
5600 AT_DATA([flows.txt], [dnl
5601 table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
5602 table=1 dl_dst=50:54:00:00:00:0a actions=controller
5603 ])
5604 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
5605
5606 AT_CAPTURE_FILE([ofctl_monitor.log])
5607 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
5608
5609 for i in 1 2 3; do
5610     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)'
5611 done
5612
5613 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
5614 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
5615 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
5616 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5617 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
5618 dnl
5619 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5620 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
5621 dnl
5622 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5623 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
5624 ])
5625
5626 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
5627
5628 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
5629  n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
5630  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
5631 OFPST_FLOW reply (OF1.3):
5632 ])
5633
5634 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
5635  echo "  0: active=1, lookup=3, matched=3"
5636  echo "  1: active=1, lookup=3, matched=3"
5637  x=2
5638  while test $x -lt 254; do
5639    echo "  $x: active=0, lookup=0, matched=0"
5640    x=`expr $x + 1`
5641  done) > expout
5642 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
5643
5644 OVS_VSWITCHD_STOP
5645 AT_CLEANUP
5646
5647
5648 AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
5649 OVS_VSWITCHD_START
5650 ADD_OF_PORTS([br0], 1, 2)
5651
5652 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
5653 AT_CHECK([ovs-ofctl -O OpenFlow13 mod-table br0 all continue])
5654
5655 AT_CAPTURE_FILE([ofctl_monitor.log])
5656 AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
5657
5658 for i in 1 2 3; do
5659     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)'
5660 done
5661
5662 OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
5663 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
5664 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
5665 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5666 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
5667 dnl
5668 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5669 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
5670 dnl
5671 NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
5672 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
5673 ])
5674
5675 AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
5676
5677 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
5678  table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
5679 OFPST_FLOW reply (OF1.3):
5680 ])
5681
5682 (echo "OFPST_TABLE reply (OF1.3) (xid=0x2): 254 tables"
5683  echo "  0: active=0, lookup=3, matched=0"
5684  echo "  1: active=1, lookup=3, matched=3"
5685  x=2
5686  while test $x -lt 254; do
5687    echo "  $x: active=0, lookup=0, matched=0"
5688    x=`expr $x + 1`
5689  done) > expout
5690 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
5691
5692 OVS_VSWITCHD_STOP
5693 AT_CLEANUP
5694
5695 AT_SETUP([ofproto-dpif - ICMPv6])
5696 OVS_VSWITCHD_START
5697 ADD_OF_PORTS([br0], 1)
5698
5699 AT_CAPTURE_FILE([ofctl_monitor.log])
5700
5701 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
5702
5703 ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
5704
5705 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
5706
5707 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
5708 NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
5709 icmp6,metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:00:86:05:80:da,dl_dst=00:60:97:07:69:ea,ipv6_src=fe80::200:86ff:fe05:80da,ipv6_dst=fe80::260:97ff:fe07:69ea,ipv6_label=0x00000,nw_tos=0,nw_ecn=0,nw_ttl=255,icmp_type=135,icmp_code=0,nd_target=fe80::260:97ff:fe07:69ea,nd_sll=00:00:86:05:80:da,nd_tll=00:00:00:00:00:00
5710 ])
5711
5712 OVS_VSWITCHD_STOP
5713 AT_CLEANUP