]> git.proxmox.com Git - mirror_ovs.git/blame - tests/ofproto-dpif.at
tests: make as() function as documented
[mirror_ovs.git] / tests / ofproto-dpif.at
CommitLineData
29901626
BP
1AT_BANNER([ofproto-dpif])
2
27f57736
JS
3AT_SETUP([ofproto-dpif - revalidator/wait])
4OVS_VSWITCHD_START
5AT_CHECK([ovs-appctl revalidator/wait])
6OVS_VSWITCHD_STOP
7AT_CLEANUP
8
5f5ebd4c 9AT_SETUP([ofproto-dpif - active-backup bonding])
adcf00ba
AZ
10# Create br0 with interfaces p1, p2 and p7, creating bond0 with p1 and p2
11# and br1 with interfaces p3, p4 and p8.
12# toggle p1,p2 of bond0 up and down to test bonding in active-backup mode.
13OVS_VSWITCHD_START(
14 [add-bond br0 bond0 p1 p2 bond_mode=active-backup --\
15 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
16 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
17 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
18 add-br br1 -- \
19 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
20 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
21 fail-mode=secure -- \
22 add-port br1 p3 -- set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
23 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
24 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 25WAIT_FOR_DUMMY_PORTS([p3], [p4])
623540e4 26AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
adcf00ba
AZ
27
28AT_CHECK([ovs-ofctl add-flow br0 action=normal])
29AT_CHECK([ovs-ofctl add-flow br1 action=normal])
30ovs-appctl netdev-dummy/set-admin-state up
31ovs-appctl time/warp 100
32ovs-appctl netdev-dummy/set-admin-state p2 down
33ovs-appctl time/stop
34ovs-appctl time/warp 100
35AT_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)'])
36AT_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)'])
37ovs-appctl time/warp 100
38ovs-appctl netdev-dummy/set-admin-state p2 up
39ovs-appctl netdev-dummy/set-admin-state p1 down
40ovs-appctl time/warp 100
41AT_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)'])
42AT_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)'])
bdba1947 43ovs-appctl time/warp 200 100
53555f51 44sleep 1
2be3fe44 45AT_CHECK([grep 'in_port=[[348]]' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
16194afd
DDP
46recirc_id=0,ip,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
47recirc_id=0,ip,in_port=3,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
48recirc_id=0,ip,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0d,nw_frag=no, actions: <del>
49recirc_id=0,ip,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0e,nw_frag=no, actions: <del>
50recirc_id=0,rarp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=ff:ff:ff:ff:ff:ff, actions: <del>
51recirc_id=0,rarp,in_port=4,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=ff:ff:ff:ff:ff:ff, actions: <del>
adcf00ba
AZ
52])
53OVS_VSWITCHD_STOP
54AT_CLEANUP
55
5f5ebd4c 56AT_SETUP([ofproto-dpif - balance-slb bonding])
adcf00ba
AZ
57# Create br0 with interfaces bond0(p1, p2, p3) and p7,
58# and br1 with interfaces p4, p5, p6 and p8.
59# p1 <-> p4, p2 <-> p5, p3 <-> p6
60# Send some traffic, make sure the traffic are spread based on source mac.
61OVS_VSWITCHD_START(
62 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-slb --\
63 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
64 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
65 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
66 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
67 add-br br1 -- \
68 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
69 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
70 fail-mode=secure -- \
71 add-port br1 p4 -- set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
72 add-port br1 p5 -- set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
73 add-port br1 p6 -- set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
74 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
55466d72 75WAIT_FOR_DUMMY_PORTS([p4], [p5], [p6])
adcf00ba
AZ
76AT_CHECK([ovs-ofctl add-flow br0 action=normal])
77AT_CHECK([ovs-ofctl add-flow br1 action=normal])
78AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
79])
adcf00ba
AZ
80ovs-appctl time/stop
81ovs-appctl time/warp 100
82(
83for i in `seq 0 100 |xargs printf '%02x\n'`;
84 do
85 pkt="in_port(7),eth(src=50:54:00:00:00:$i,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)"
86 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
87 done
88)
89ovs-appctl time/warp 100
90AT_CHECK([ovs-appctl dpif/dump-flows br1 > br1_flows.txt])
91# Make sure there is resonable distribution to all three ports.
92# We don't want to make this check precise, in case hash function changes.
93AT_CHECK([test `egrep 'in_port\(4\)' br1_flows.txt |wc -l` -gt 3])
94AT_CHECK([test `egrep 'in_port\(5\)' br1_flows.txt |wc -l` -gt 3])
95AT_CHECK([test `egrep 'in_port\(6\)' br1_flows.txt |wc -l` -gt 3])
96OVS_VSWITCHD_STOP
97AT_CLEANUP
98
5f5ebd4c 99AT_SETUP([ofproto-dpif - balance-tcp bonding])
adcf00ba
AZ
100# Create br0 with interfaces bond0(p1, p2, p3) and p7,
101# and br1 with interfaces bond1(p4, p5, p6) and p8.
102# bond0 <-> bond1
103# Send some traffic, make sure the traffic are spread based on L4 headers.
104OVS_VSWITCHD_START(
105 [add-bond br0 bond0 p1 p2 p3 bond_mode=balance-tcp lacp=active \
106 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
107 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
108 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
109 set interface p3 type=dummy options:pstream=punix:$OVS_RUNDIR/p3.sock ofport_request=3 -- \
110 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
111 add-br br1 -- \
112 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
113 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
114 fail-mode=secure -- \
115 add-bond br1 bond1 p4 p5 p6 bond_mode=balance-tcp lacp=active \
116 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 --\
117 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=4 -- \
118 set interface p5 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=5 -- \
119 set interface p6 type=dummy options:stream=unix:$OVS_RUNDIR/p3.sock ofport_request=6 -- \
120 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
121AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
122])
123AT_CHECK([ovs-ofctl add-flow br0 action=normal])
124AT_CHECK([ovs-ofctl add-flow br1 action=normal])
125AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
126], [])
48105e85 127OVS_WAIT_WHILE([ovs-appctl bond/show | grep "may_enable: false"])
adcf00ba
AZ
128ovs-appctl time/stop
129ovs-appctl time/warp 100
130ovs-appctl lacp/show > lacp.txt
131ovs-appctl bond/show > bond.txt
132(
25d6a6a8 133for i in `seq 0 255` ;
adcf00ba 134 do
ea2735d3 135 pkt="in_port(7),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=$i),tcp_flags(ack)"
adcf00ba
AZ
136 AT_CHECK([ovs-appctl netdev-dummy/receive p7 $pkt])
137 done
138)
bdba1947 139ovs-appctl time/warp 300 100
adcf00ba
AZ
140AT_CHECK([ovs-appctl dpif/dump-flows br0 |grep tcp > br0_flows.txt])
141AT_CHECK([ovs-appctl dpif/dump-flows br1 |grep tcp > br1_flows.txt])
142# Make sure there is resonable distribution to all three ports.
143# We don't want to make this check precise, in case hash function changes.
fd184489
AZ
144AT_CHECK([test `grep in_port.4 br1_flows.txt |wc -l` -gt 24])
145AT_CHECK([test `grep in_port.5 br1_flows.txt |wc -l` -gt 24])
146AT_CHECK([test `grep in_port.6 br1_flows.txt |wc -l` -gt 24])
f9038ef6
AW
147
148OVS_VSWITCHD_STOP()
149AT_CLEANUP
150
151# Makes sure recirculation does not change the way packet is handled.
5f5ebd4c 152AT_SETUP([ofproto-dpif - balance-tcp bonding, different recirc flow ])
f9038ef6
AW
153OVS_VSWITCHD_START(
154 [add-bond br0 bond0 p1 p2 bond_mode=balance-tcp lacp=active \
155 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
156 set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p1.sock ofport_request=1 -- \
157 set interface p2 type=dummy options:pstream=punix:$OVS_RUNDIR/p2.sock ofport_request=2 -- \
158 add-br br1 -- \
159 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
160 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
161 fail-mode=standalone -- \
162 add-bond br1 bond1 p3 p4 bond_mode=balance-tcp lacp=active \
163 other-config:lacp-time=fast other-config:bond-rebalance-interval=0 -- \
164 set interface p3 type=dummy options:stream=unix:$OVS_RUNDIR/p1.sock ofport_request=3 -- \
165 set interface p4 type=dummy options:stream=unix:$OVS_RUNDIR/p2.sock ofport_request=4 -- \
166 add-port br1 br1- -- set interface br1- type=patch options:peer=br1+ ofport_request=100 -- \
167 add-br br-int -- \
168 set bridge br-int other-config:hwaddr=aa:77:aa:77:00:00 -- \
169 set bridge br-int datapath-type=dummy other-config:datapath-id=1235 \
170 fail-mode=secure -- \
171 add-port br-int br1+ -- set interface br1+ type=patch options:peer=br1- ofport_request=101 -- \
172 add-port br-int p5 -- set interface p5 ofport_request=5 type=dummy
173])
174AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
175])
176
f12bfd04
AW
177# Waits for all ifaces enabled.
178OVS_WAIT_UNTIL([test `ovs-appctl bond/show | grep -- "may_enable: true" | wc -l` -ge 4])
179
f9038ef6
AW
180# The dl_vlan flow should not be ever matched,
181# since recirculation should not change the flow handling.
182AT_DATA([flows.txt], [dnl
183table=0 priority=1 in_port=5 actions=mod_vlan_vid:1,output(101)
184table=0 priority=2 in_port=5 dl_vlan=1 actions=drop
185])
186AT_CHECK([ovs-ofctl add-flows br-int flows.txt])
187
188# Sends a packet to trigger recirculation.
f9038ef6
AW
189AT_CHECK([ovs-appctl netdev-dummy/receive p5 "in_port(5),eth(src=50:54:00:00:00:05,dst=50:54:00:00:01:00),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1)"])
190
191# Collects flow stats.
192AT_CHECK([ovs-appctl revalidator/purge], [0])
193
194# Checks the flow stats in br1, should only be one flow with non-zero
195# 'n_packets' from internal table.
e2167cb7
AZ
196AT_CHECK([ovs-appctl bridge/dump-flows br1 | ofctl_strip | grep -- "n_packets" | grep -- "table_id" | sed -e 's/output:[[0-9]][[0-9]]*/output/'] , [0], [dnl
197table_id=254, n_packets=1, n_bytes=64, priority=20,recirc_id=0x0,dp_hash=0x0/0xff,actions=output
f9038ef6
AW
198])
199
200# Checks the flow stats in br-int, should be only one match.
201AT_CHECK([ovs-ofctl dump-flows br-int | ofctl_strip | sort], [0], [dnl
202 n_packets=1, n_bytes=60, priority=1,in_port=5 actions=mod_vlan_vid:1,output:101
203 priority=2,in_port=5,dl_vlan=1 actions=drop
204NXST_FLOW reply:
205])
206
adcf00ba
AZ
207OVS_VSWITCHD_STOP()
208AT_CLEANUP
209
29901626 210AT_SETUP([ofproto-dpif - resubmit])
023e1e0a 211OVS_VSWITCHD_START
ca5792f0 212add_of_ports br0 1 10 11 12 13 14 15 16 17 18 19 20 21
29901626
BP
213AT_DATA([flows.txt], [dnl
214table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21)
215table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18)
216table=0 in_port=3 priority=2000 icmp actions=output(20)
217table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15)
218table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2)
219table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2)
220])
221AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31a19d69 222AT_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])
29901626
BP
223AT_CHECK([tail -1 stdout], [0],
224 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
225])
023e1e0a 226OVS_VSWITCHD_STOP
29901626 227AT_CLEANUP
58a89177 228
55599423
JR
229AT_SETUP([ofproto-dpif - goto table])
230OVS_VSWITCHD_START
ca5792f0 231add_of_ports br0 1 10 11
55599423 232echo "table=0 in_port=1 actions=output(10),goto_table(1)" > flows.txt
4468099e
EJ
233for i in `seq 1 63`; do echo "table=$i actions=goto_table($(($i+1)))"; done >> flows.txt
234echo "table=64 actions=output(11)" >> flows.txt
55599423
JR
235AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
236AT_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])
237AT_CHECK([tail -1 stdout], [0],
238 [Datapath actions: 10,11
239])
240OVS_VSWITCHD_STOP
241AT_CLEANUP
242
7fdb60a7
SH
243AT_SETUP([ofproto-dpif - write actions])
244OVS_VSWITCHD_START
ca5792f0 245add_of_ports br0 1 10 11 12 13
7fdb60a7
SH
246AT_DATA([flows.txt], [dnl
247table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
248table=1 ip actions=write_actions(output(13)),goto_table(2)
249table=2 ip actions=set_field:192.168.3.91->ip_src,output(11)
250])
251AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
252AT_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])
ce58df5b 253AT_CHECK([tail -2 stdout], [0],
16194afd 254 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 255Datapath actions: 10,set(ipv4(src=192.168.3.91)),11,set(ipv4(src=192.168.3.90)),13
7fdb60a7
SH
256])
257OVS_VSWITCHD_STOP
258AT_CLEANUP
259
e60e935b
SRCSA
260AT_SETUP([ofproto-dpif - modify IPv6 Neighbor Solitication (ND)])
261OVS_VSWITCHD_START
ca5792f0 262add_of_ports br0 1 10 11 12 13
e60e935b
SRCSA
263AT_DATA([flows.txt], [dnl
264table=0 in_port=1,icmp6,icmpv6_type=135 actions=output(10),write_actions(set_field:fe80::3->nd_target,set_field:aa:aa:aa:aa:aa:aa->nd_sll,output(12)),goto_table(1)
265table=1 icmp6 actions=write_actions(output(13)),goto_table(2)
266table=2 in_port=1,icmp6,icmpv6_type=135 actions=set_field:fe80::4->nd_target,set_field:cc:cc:cc:cc:cc:cc->nd_sll,output(11)
267])
268AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
269AT_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,icmp6,ipv6_src=fe80::1,ipv6_dst=fe80::2,nw_tos=0,nw_ttl=128,icmpv6_type=135,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11'], [0], [stdout])
270AT_CHECK([tail -4 stdout], [0],
ed5648b7 271 [Megaflow: recirc_id=0,icmp6,in_port=1,nw_frag=no,icmp_type=0x87/0xff,icmp_code=0x0/0xff,nd_target=fe80::2020,nd_sll=66:55:44:33:22:11
e60e935b
SRCSA
272Datapath actions: 10,set(nd(target=fe80::4,sll=cc:cc:cc:cc:cc:cc)),11,set(nd(target=fe80::3,sll=aa:aa:aa:aa:aa:aa)),13
273This flow is handled by the userspace slow path because it:
274 - Uses action(s) not supported by datapath.
275])
276OVS_VSWITCHD_STOP
277AT_CLEANUP
278
7fdb60a7
SH
279AT_SETUP([ofproto-dpif - clear actions])
280OVS_VSWITCHD_START
ca5792f0 281add_of_ports br0 1 10 11 12
7fdb60a7
SH
282AT_DATA([flows.txt], [dnl
283table=0 in_port=1,ip actions=output(10),write_actions(set_field:192.168.3.90->ip_src,output(12)),goto_table(1)
ce58df5b 284table=1 tcp actions=set_field:91->tp_src,output(11),clear_actions
7fdb60a7
SH
285])
286AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
ce58df5b
JR
287AT_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])
288AT_CHECK([tail -2 stdout], [0],
16194afd 289 [Megaflow: recirc_id=0,tcp,in_port=1,nw_frag=no,tp_src=8
d23df9a8 290Datapath actions: 10,set(tcp(src=91)),11
7fdb60a7
SH
291])
292OVS_VSWITCHD_STOP
293AT_CLEANUP
294
0eb48fe1 295AT_SETUP([ofproto-dpif - group chaining])
5a070238 296OVS_VSWITCHD_START
ca5792f0 297add_of_ports br0 1 10 11
0eb48fe1
BP
298AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=set_field:192.168.3.90->ip_src,group:123,bucket=output:11'])
299AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=123,type=all,bucket=output:10'])
300AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
301AT_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])
302AT_CHECK([tail -1 stdout], [0],
303 [Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
5a070238
BP
304])
305OVS_VSWITCHD_STOP
306AT_CLEANUP
307
f4fb341b
SH
308AT_SETUP([ofproto-dpif - all group in action list])
309OVS_VSWITCHD_START
ca5792f0 310add_of_ports br0 1 10 11
f4fb341b
SH
311AT_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'])
312AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
313AT_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])
d23df9a8
JR
314# Must match on the source address to be able to restore it's value for
315# the second bucket
ce58df5b 316AT_CHECK([tail -2 stdout], [0],
16194afd 317 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 318Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
319])
320OVS_VSWITCHD_STOP
321AT_CLEANUP
322
323AT_SETUP([ofproto-dpif - indirect group in action list])
324OVS_VSWITCHD_START
ca5792f0 325add_of_ports br0 1 10
f4fb341b
SH
326AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
327AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234'])
328AT_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])
329AT_CHECK([tail -1 stdout], [0],
330 [Datapath actions: 10
331])
332OVS_VSWITCHD_STOP
333AT_CLEANUP
334
5b09e569
JR
335AT_SETUP([ofproto-dpif - group actions have no effect afterwards])
336OVS_VSWITCHD_START
ca5792f0 337add_of_ports br0 1 10
5b09e569
JR
338AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10'])
339AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10'])
340AT_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])
341AT_CHECK([tail -1 stdout], [0],
342 [Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2)),10
343])
344OVS_VSWITCHD_STOP
345AT_CLEANUP
346
f4fb341b
SH
347AT_SETUP([ofproto-dpif - all group in action set])
348OVS_VSWITCHD_START
ca5792f0 349add_of_ports br0 1 10 11
f4fb341b
SH
350AT_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'])
351AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
352AT_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])
d23df9a8
JR
353# Must match on the source address to be able to restore it's value for
354# the third bucket
ce58df5b 355AT_CHECK([tail -2 stdout], [0],
16194afd 356 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 357Datapath actions: set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),11
f4fb341b
SH
358])
359OVS_VSWITCHD_STOP
360AT_CLEANUP
361
362AT_SETUP([ofproto-dpif - indirect group in action set])
363OVS_VSWITCHD_START
ca5792f0 364add_of_ports br0 1 10
f4fb341b
SH
365AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 group_id=1234,type=indirect,bucket=output:10])
366AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
367AT_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])
368AT_CHECK([tail -1 stdout], [0],
369 [Datapath actions: 10
370])
371OVS_VSWITCHD_STOP
372AT_CLEANUP
373
fe7e5749
SH
374AT_SETUP([ofproto-dpif - select group])
375OVS_VSWITCHD_START
ca5792f0 376add_of_ports br0 1 10 11
fe7e5749
SH
377AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11'])
378AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
7cb279c2
SH
379
380# Try a bunch of different flows and make sure that they get distributed
381# at least somewhat.
382for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
383 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])
384 tail -1 stdout >> results
385done
386sort results | uniq -c
387AT_CHECK([sort results | uniq], [0],
fe7e5749 388 [Datapath actions: 10
7cb279c2 389Datapath actions: 11
fe7e5749
SH
390])
391OVS_VSWITCHD_STOP
392AT_CLEANUP
393
394AT_SETUP([ofproto-dpif - select group with watch port])
395OVS_VSWITCHD_START
ca5792f0 396add_of_ports br0 1 10 11
fe7e5749
SH
397AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11'])
398AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
399AT_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])
400AT_CHECK([tail -1 stdout], [0],
401 [Datapath actions: 11
402])
403OVS_VSWITCHD_STOP
404AT_CLEANUP
405
7cb279c2
SH
406AT_SETUP([ofproto-dpif - select group with weight])
407OVS_VSWITCHD_START
ca5792f0 408add_of_ports br0 1 10 11 12
125bf01d 409AT_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'])
7cb279c2
SH
410AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
411AT_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])
412AT_CHECK([tail -1 stdout], [0],
413 [Datapath actions: 11
414])
415OVS_VSWITCHD_STOP
416AT_CLEANUP
417
0c4b9393
SH
418AT_SETUP([ofproto-dpif - select group with hash selection method])
419OVS_VSWITCHD_START
ca5792f0 420add_of_ports br0 1 10 11
0c4b9393
SH
421AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields=eth_dst,bucket=output:10,bucket=output:11'])
422AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)'])
423
424# Try a bunch of different flows and make sure that they get distributed
425# at least somewhat.
426for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
427 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])
428 tail -1 stdout >> results
429done
430sort results | uniq -c
431AT_CHECK([sort results | uniq], [0],
432 [Datapath actions: 10
433Datapath actions: 11
434])
435
436> results
437# Try a bunch of different flows and make sure that they are not distributed
438# as they only vary a field that is not hashed
439for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
440 AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:$d,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])
441 tail -1 stdout >> results
442done
443sort results | uniq -c
444AT_CHECK([sort results | uniq], [0],
445 [Datapath actions: 10
446])
447
448OVS_VSWITCHD_STOP
449AT_CLEANUP
450
dd8cd4b4
SH
451AT_SETUP([ofproto-dpif - fast failover group])
452OVS_VSWITCHD_START
ca5792f0 453add_of_ports br0 1 10 11
dd8cd4b4
SH
454AT_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'])
455AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
456AT_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])
457AT_CHECK([tail -1 stdout], [0],
458 [Datapath actions: drop
459])
460OVS_VSWITCHD_STOP
461AT_CLEANUP
462
b2af3288
AZ
463AT_SETUP([ofproto-dpif - group stats single bucket])
464OVS_VSWITCHD_START
ca5792f0 465add_of_ports br0 1 10 11
b2af3288
AZ
466AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,weight=2000,bucket=output:11,weight=0'])
467AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
468(
469for i in `seq 0 2`;
470 do
471 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)"
472 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
473 done
474)
cea4a6d7 475AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 476AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 477AT_CHECK([strip_xids < stdout | sort], [0], [dnl
4f20179d 478 group_id=1234,ref_count=1,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=0,byte_count=0
b2af3288
AZ
479OFPST_GROUP reply (OF1.2):
480])
481OVS_VSWITCHD_STOP
482AT_CLEANUP
483
484AT_SETUP([ofproto-dpif - group stats all buckets])
485OVS_VSWITCHD_START
ca5792f0 486add_of_ports br0 1 10 11
b2af3288
AZ
487AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:11'])
488AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)'])
489(
490for i in `seq 0 2`;
491 do
492 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)"
493 AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt])
494 done
495)
cea4a6d7 496AT_CHECK([ovs-appctl revalidator/purge], [0])
b2af3288 497AT_CHECK([ovs-ofctl -O OpenFlow12 -vwarn dump-group-stats br0], [0], [stdout])
8a32aaa5 498AT_CHECK([strip_xids < stdout | sort], [0], [dnl
4f20179d 499 group_id=1234,ref_count=1,packet_count=3,byte_count=180,bucket0:packet_count=3,byte_count=180,bucket1:packet_count=3,byte_count=180
b2af3288
AZ
500OFPST_GROUP reply (OF1.2):
501])
502OVS_VSWITCHD_STOP
503AT_CLEANUP
504
58a89177 505AT_SETUP([ofproto-dpif - registers])
023e1e0a 506OVS_VSWITCHD_START
ca5792f0 507add_of_ports br0 20 21 22 33 90
58a89177
EJ
508AT_DATA([flows.txt], [dnl
509in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91
510in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92
e9358af6
EJ
511in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11,resubmit:93
512in_port=93 actions=resubmit:12,resubmit:13,resubmit:14,resubmit:15
513
58a89177
EJ
514in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]]
515in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]]
516in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]]
517in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]]
518in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]]
519in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]]
520in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]]
521in_port=9,reg0=0xdeadbeef actions=output:20
522in_port=10,reg1=0xdeadbeef actions=output:21
523in_port=11,reg2=0xeef22dea actions=output:22
e9358af6
EJ
524
525dnl Sanilty check all registers
526in_port=12 actions=load:0x10->NXM_NX_REG0[[]],load:0x11->NXM_NX_REG1[[]],load:0x12->NXM_NX_REG2[[]]
527in_port=13 actions=load:0x13->NXM_NX_REG3[[]],load:0x14->NXM_NX_REG4[[]],load:0x15->NXM_NX_REG5[[]]
528in_port=14 actions=load:0x16->NXM_NX_REG6[[]],load:0x17->NXM_NX_REG7[[]]
529in_port=15,reg0=0x10,reg1=0x11,reg2=0x12,reg3=0x13,reg4=0x14,reg5=0x15,reg6=0x16,reg7=0x17 actions=output:33
bd85dac1 530
58a89177
EJ
531])
532AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 533AT_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])
58a89177 534AT_CHECK([tail -1 stdout], [0],
e9358af6 535 [Datapath actions: 20,21,22,33
58a89177 536])
023e1e0a 537OVS_VSWITCHD_STOP
58a89177 538AT_CLEANUP
f694937d 539
57fa8167
BP
540dnl Tests that the standardized xregs are mapped onto the legacy OVS registers
541dnl in the manner documented in ovs-ofctl(8).
542AT_SETUP([ofproto-dpif - extended registers])
543OVS_VSWITCHD_START
ca5792f0 544add_of_ports br0 1 2 3
57fa8167
BP
545AT_DATA([flows.txt], [dnl
546table=0 actions=load:0xfedcba9876543210->OXM_OF_PKT_REG1[[]],resubmit(,1)
547table=1,reg2=0xfedcba98,reg3=0x76543210 actions=2
548
549# These low-priority rules shouldn't match. They're here only to make really
550# sure that the test fails if either of the above rules fails to match.
551table=0,priority=0 actions=3
552table=1,priority=0 actions=3
553])
554AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
555AT_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])
556AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
557])
558OVS_VSWITCHD_STOP
559AT_CLEANUP
560
1b0ee636
TG
561AT_SETUP([ofproto-dpif - load and move order])
562OVS_VSWITCHD_START
ca5792f0 563add_of_ports br0 1 10 11
1b0ee636
TG
564AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=all,bucket=output:10,move:NXM_NX_REG1[[]]->NXM_OF_IP_SRC[[]],bucket=output:11'])
565AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(load:0xffffffff->NXM_NX_REG1[[]],move:NXM_NX_REG1[[]]->NXM_NX_REG2[[]],group:1234)'])
566AT_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])
567AT_CHECK([tail -2 stdout], [0],
16194afd 568 [Megaflow: recirc_id=0,ip,in_port=1,nw_src=192.168.0.1,nw_frag=no
d23df9a8 569Datapath actions: set(ipv4(src=255.255.255.255)),10,set(ipv4(src=192.168.0.1)),11
1b0ee636
TG
570])
571OVS_VSWITCHD_STOP
572AT_CLEANUP
573
eb1cbc6b
JT
574dnl Tests that 1.5 copy-field can copy into the standardized xregs.
575AT_SETUP([ofproto-dpif - copy-field into extended registers])
576OVS_VSWITCHD_START
ca5792f0 577add_of_ports br0 1 2 3
eb1cbc6b
JT
578AT_DATA([flows.txt], [dnl
579table=0 actions=move:OXM_OF_ETH_SRC[[0..47]]->OXM_OF_PKT_REG0[[0..47]],goto_table(1)
580table=1,xreg0=0x0000505400000005 actions=2
581
582# These low-priority rules shouldn't match. They're here only to make really
583# sure that the test fails if either of the above rules fails to match.
584table=0,priority=0 actions=3
585table=1,priority=0 actions=3
586])
587AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
588AT_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])
589AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
590])
591OVS_VSWITCHD_STOP
592AT_CLEANUP
593
2bef8e07
JT
594dnl Tests that 1.5 set-field with mask in the metadata register.
595AT_SETUP([ofproto-dpif - masked set-field into metadata])
596OVS_VSWITCHD_START
ca5792f0 597add_of_ports br0 1 2 3
2bef8e07
JT
598AT_DATA([flows.txt], [dnl
599table=0 actions=set_field:0xfafafafa5a5a5a5a->metadata,goto_table(1)
600table=1 actions=set_field:0x6b/0xff->metadata,goto_table(2)
601table=2,metadata=0xfafafafa5a5a5a6b actions=2
602
603# These low-priority rules shouldn't match. They're here only to make really
604# sure that the test fails if either of the above rules fails to match.
605table=0,priority=0 actions=3
606table=1,priority=0 actions=3
607table=2,priority=0 actions=3
608])
609AT_CHECK([ovs-ofctl -O OpenFlow15 add-flows br0 flows.txt])
610AT_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])
611AT_CHECK([tail -1 stdout], [0], [Datapath actions: 2
612])
613OVS_VSWITCHD_STOP
614AT_CLEANUP
615
c61f3870
BP
616
617AT_SETUP([ofproto-dpif - actset_output])
618OVS_VSWITCHD_START
ca5792f0 619add_of_ports br0 1 2 3 4 5 6 7 8 9 10 11 12 13
c61f3870 620AT_DATA([flows.txt], [dnl
3ca3ce0c 621table=0,actset_output=unset actions=write_actions(output(2)),goto_table(1)
c61f3870
BP
622table=1 actions=move:ONFOXM_ET_ACTSET_OUTPUT[[0..31]]->OXM_OF_PKT_REG0[[0..31]],goto_table(2)
623
624# Verify that actset_output got set.
625table=2,priority=20,actset_output=2 actions=4,goto_table(3)
626table=2,priority=10 actions=5,goto_table(3)
627
628# Verify that xreg0 got copied properly from actset_output.
629table=3,priority=20,xreg0=2 actions=6,goto_table(4)
630table=3,priority=10 actions=7,goto_table(4)
631
9055ca9a
BP
632# Verify that adding a group action unsets actset_output,
633# even if output follows group.
634table=4 actions=write_actions(group(5),output(10)),goto_table(5)
c61f3870
BP
635table=5,priority=20,actset_output=unset actions=8,goto_table(6)
636table=5,priority=10 actions=9,goto_table(6)
637
638# Verify that adding another output action doesn't change actset_output
639# (since there's still a group).
640table=6 actions=write_actions(output(3)),goto_table(7)
641table=7,priority=20,actset_output=unset actions=10,goto_table(8)
642table=7,priority=10 actions=11,goto_table(8)
643
644# Verify that clearing the action set, then writing an output action,
645# causes actset_output to be set again.
646table=8,actions=clear_actions,write_actions(output(3),output(2)),goto_table(9)
647table=9,priority=20,actset_output=2 actions=12
648table=9,priority=10 actions=13
649])
4f20179d 650AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=5,type=all,bucket=output:1'])
c61f3870
BP
651AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
652AT_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])
653AT_CHECK([tail -1 stdout], [0], [Datapath actions: 4,6,8,10,12,2
654])
655OVS_VSWITCHD_STOP
656AT_CLEANUP
bd85dac1
AZ
657AT_SETUP([ofproto-dpif - push-pop])
658OVS_VSWITCHD_START
ca5792f0 659add_of_ports br0 20 21 22 33 90
bd85dac1
AZ
660AT_DATA([flows.txt], [dnl
661in_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
662in_port=2 actions=pop:NXM_NX_REG0[[0..7]],output:NXM_NX_REG0[[]]
663in_port=3 actions=pop:NXM_NX_REG1[[0..7]],output:NXM_NX_REG1[[]]
664in_port=4 actions=pop:NXM_NX_REG2[[0..15]],output:NXM_NX_REG2[[]]
665in_port=5 actions=pop:NXM_NX_REG3[[]],output:NXM_NX_REG3[[]]
666
667])
668AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 669AT_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])
bd85dac1
AZ
670AT_CHECK([tail -1 stdout], [0],
671 [Datapath actions: 33,22,21,20
672])
673OVS_VSWITCHD_STOP
674AT_CLEANUP
675
f694937d 676AT_SETUP([ofproto-dpif - output])
023e1e0a 677OVS_VSWITCHD_START
ca5792f0 678add_of_ports br0 1 9 10 11 55 66 77 88
f694937d 679AT_DATA([flows.txt], [dnl
557323cd 680in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7,resubmit:8
f694937d
EJ
681in_port=2 actions=output:9
682in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]]
683in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11
684in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]]
685in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]]
686in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]]
557323cd 687in_port=8 actions=1,9,load:9->NXM_OF_IN_PORT[[]],1,9
f694937d
EJ
688])
689AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 690AT_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])
f694937d 691AT_CHECK([tail -1 stdout], [0],
557323cd 692 [Datapath actions: 9,55,10,55,66,11,77,88,9,1
f694937d 693])
023e1e0a 694OVS_VSWITCHD_STOP
f694937d 695AT_CLEANUP
8e9ce036 696
f0fd1a17
PS
697AT_SETUP([ofproto-dpif - dec_ttl])
698OVS_VSWITCHD_START
ca5792f0 699add_of_ports br0 1 2 3 4
f0fd1a17
PS
700AT_DATA([flows.txt], [dnl
701table=0 in_port=1 action=dec_ttl,output:2,resubmit(1,1),output:4
702table=1 in_port=1 action=dec_ttl,output:3
703])
704AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
8249a1fe 705AT_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])
ce58df5b 706AT_CHECK([tail -4 stdout], [0],
16194afd 707 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=2,nw_frag=no
d23df9a8 708Datapath actions: set(ipv4(ttl=1)),2,4
6a7e895f
BP
709This flow is handled by the userspace slow path because it:
710 - Sends "packet-in" messages to the OpenFlow controller.
f0fd1a17 711])
8249a1fe 712AT_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])
ce58df5b 713AT_CHECK([tail -2 stdout], [0],
16194afd 714 [Megaflow: recirc_id=0,ip,in_port=1,nw_ttl=3,nw_frag=no
d23df9a8 715Datapath actions: set(ipv4(ttl=2)),2,set(ipv4(ttl=1)),3,4
f0fd1a17 716])
50aa28fd 717AT_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])
ce58df5b 718AT_CHECK([tail -2 stdout], [0],
16194afd 719 [Megaflow: recirc_id=0,ipv6,in_port=1,nw_ttl=128,nw_frag=no
d23df9a8 720Datapath actions: set(ipv6(hlimit=127)),2,set(ipv6(hlimit=126)),3,4
f0fd1a17
PS
721])
722
982697a4 723AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 724AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log])
8249a1fe 725AT_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])
f0fd1a17
PS
726OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
727AT_CHECK([cat ofctl_monitor.log], [0], [dnl
8249a1fe 728NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=34 in_port=1 (via invalid_ttl) data_len=34 (unbuffered)
e6d9ab56 729ip,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
f0fd1a17
PS
730])
731OVS_VSWITCHD_STOP
732AT_CLEANUP
733
65bfce4a
SH
734dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
735dnl buffer to be resized just before pushing the id of the dec_ttl action.
736dnl Thus the implementation must account for this by using the
737dnl reallocated buffer rather than the original buffer.
738dnl
739dnl A number of similar rules are added to try and exercise
740dnl xrealloc sufficiently that it returns a different base pointer
741AT_SETUP([ofproto-dpif - dec_ttl without arguments at offset 32 in ofpacts])
742OVS_VSWITCHD_START
ca5792f0 743add_of_ports br0 1
65bfce4a
SH
744(for i in `seq 0 255`; do
745 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl,controller\n" $i
746 done) > flows.txt
747AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
748OVS_VSWITCHD_STOP
749AT_CLEANUP
750
751dnl A dec_ttl action at offset 32 in ofpacts will cause the ofpacts
752dnl buffer to be resized just before pushing the id of the dec_ttl action.
753dnl Thus the implementation must account for this by using the
754dnl reallocated buffer rather than the original buffer.
755dnl
756dnl A number of similar rules are added to try and exercise
757dnl xrealloc sufficiently that it returns a different base pointer
758AT_SETUP([ofproto-dpif - dec_ttl with arguments at offset 32 in ofpacts])
759OVS_VSWITCHD_START
ca5792f0 760add_of_ports br0 1
65bfce4a
SH
761(for i in `seq 0 255`; do
762 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,output:1,dec_ttl(1),controller\n" $i
763 done) > flows.txt
764AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
765OVS_VSWITCHD_STOP
766AT_CLEANUP
767
768dnl A note action at offset 24 in ofpacts will cause the ofpacts
769dnl buffer to be resized just before pushing the id of the dec_ttl action.
770dnl Thus the implementation must account for this by using the
771dnl reallocated buffer rather than the original buffer.
772dnl
773dnl A number of similar rules are added to try and exercise
774dnl xrealloc sufficiently that it returns a different base pointer
775AT_SETUP([ofproto-dpif - note at offset 24 in ofpacts])
776OVS_VSWITCHD_START
ca5792f0 777add_of_ports br0 1
65bfce4a
SH
778(for i in `seq 0 255`; do
779 printf "dl_src=10:11:11:11:11:%02x actions=output:1,output:1,note:ff,controller\n" $i
780 done) > flows.txt
781AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
782OVS_VSWITCHD_STOP
783AT_CLEANUP
f0fd1a17 784
77750738 785AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 786OVS_VSWITCHD_START
ca5792f0 787add_of_ports br0 1 2
77750738 788
77750738
JP
789AT_CHECK([ovs-ofctl add-flow br0 action=normal])
790
791# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 792flow="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"
77750738 793AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
794AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
7951
7962
797100
798])
77750738
JP
799
800OVS_VSWITCHD_STOP
801AT_CLEANUP
802
8b36f51e 803AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 804OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 805add_of_ports br0 9
8b36f51e 806AT_DATA([flows.txt], [dnl
bdda5aca 807actions=output:LOCAL,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:LOCAL
8b36f51e
EJ
808])
809AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
810AT_CHECK([ovs-vsctl -- \
811 set Port p1 qos=@newqos --\
812 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
813 --id=@q1 create Queue dscp=1 --\
814 --id=@q2 create Queue dscp=2], [0], [ignore])
50aa28fd 815AT_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])
ce58df5b 816AT_CHECK([tail -2 stdout], [0],
d23df9a8 817 [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 818Datapath actions: dnl
e44768b7 819100,dnl
d23df9a8
JR
820set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
821set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 8221,dnl
d23df9a8
JR
823set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
824set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
825set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
826])
827OVS_VSWITCHD_STOP
828AT_CLEANUP
829
fd19297b 830AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 831OVS_VSWITCHD_START
ca5792f0 832add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
833
834AT_DATA([flows.txt], [dnl
a0fbe94a 835in_port=local actions=local,flood
fd19297b
EJ
836in_port=1 actions=flood
837in_port=2 actions=all
bdda5aca
BP
838in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
839in_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
fd19297b
EJ
840])
841AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
842AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
843AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
844
50aa28fd 845AT_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])
a0fbe94a
AR
846AT_CHECK([tail -1 stdout \
847| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
8481
8492
8503
8514
8527
853])
854
50aa28fd 855AT_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])
fd19297b
EJ
856AT_CHECK([tail -1 stdout \
857| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 858100
fd19297b
EJ
8592
8603
8614
8627
863])
864
50aa28fd 865AT_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])
fd19297b
EJ
866AT_CHECK([tail -1 stdout \
867| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 8681
e44768b7 869100
fd19297b
EJ
8703
8714
8726
8737
874])
875
50aa28fd 876AT_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])
fd19297b 877AT_CHECK([tail -1 stdout], [0],
e44768b7 878 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
879])
880
50aa28fd 881AT_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])
fd19297b 882AT_CHECK([tail -1 stdout], [0],
1b567fb9 883 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
884])
885OVS_VSWITCHD_STOP
886AT_CLEANUP
887
6b83a3c5 888AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
889OVS_VSWITCHD_START([dnl
890 add-port br0 p1 -- set Interface p1 type=dummy
891])
53eb8cb8 892on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
893
894AT_CAPTURE_FILE([ofctl_monitor.log])
895
6409e008 896AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
897
898for i in 1 2 3 ; do
ea2735d3 899 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(syn)'
6d328fa2 900done
8bd16974 901OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6d328fa2
SH
902OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
903AT_CHECK([cat ofctl_monitor.log], [0], [dnl
904NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 905tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
6d328fa2
SH
906dnl
907NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 908tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
6d328fa2
SH
909dnl
910NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 911tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=syn tcp_csum:0
6d328fa2
SH
912])
913
914AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
915AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
916NXST_FLOW reply:
917])
918
919OVS_VSWITCHD_STOP
920AT_CLEANUP
921
6b83a3c5
SH
922AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
923OVS_VSWITCHD_START([dnl
924 add-port br0 p1 -- set Interface p1 type=dummy
925])
53eb8cb8 926on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
927
928AT_CAPTURE_FILE([ofctl_monitor.log])
929AT_CHECK([ovs-ofctl del-flows br0])
930
6409e008 931AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5
SH
932
933dnl Test that missed packets are droped
934for i in 1 2 3 ; do
ea2735d3 935 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack,syn)'
6b83a3c5
SH
936done
937OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
938
939AT_CHECK([cat ofctl_monitor.log], [0], [dnl
940])
941
942AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
943AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
944OFPST_FLOW reply (OF1.3):
945])
946
947OVS_VSWITCHD_STOP
948AT_CLEANUP
949
6d328fa2
SH
950AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
951OVS_VSWITCHD_START([dnl
952 add-port br0 p1 -- set Interface p1 type=dummy
953])
53eb8cb8 954on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
955
956AT_CAPTURE_FILE([ofctl_monitor.log])
957AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
958
6409e008 959AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
960
961for i in 1 2 3 ; do
8e4c1621 962 ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(urg|rst)'
6d328fa2 963done
8bd16974 964OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6d328fa2
SH
965OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
966AT_CHECK([cat ofctl_monitor.log], [0], [dnl
967OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 968tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
6d328fa2
SH
969dnl
970OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 971tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
6d328fa2
SH
972dnl
973OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 974tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=rst|urg tcp_csum:0
6d328fa2
SH
975])
976
cea4a6d7 977AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
978AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
979 n_packets=3, n_bytes=180, actions=goto_table:1
980OFPST_FLOW reply (OF1.2):
981])
982
983OVS_VSWITCHD_STOP
984AT_CLEANUP
985
986AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
987OVS_VSWITCHD_START([dnl
988 add-port br0 p1 -- set Interface p1 type=dummy
989])
53eb8cb8 990on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
991
992AT_CAPTURE_FILE([ofctl_monitor.log])
993AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
994
6409e008 995AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
996
997for i in 1 2 3 ; do
998 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)'
999done
1000
1001OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1002AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1003])
1004
cea4a6d7 1005AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1006AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1007 n_packets=3, n_bytes=180, actions=resubmit(1,1)
1008OFPST_FLOW reply (OF1.2):
1009])
1010
1011OVS_VSWITCHD_STOP
1012AT_CLEANUP
1013
1014AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1015OVS_VSWITCHD_START([dnl
1016 add-port br0 p1 -- set Interface p1 type=dummy
1017])
53eb8cb8 1018on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1019
1020AT_CAPTURE_FILE([ofctl_monitor.log])
1021AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1022AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1023
1024dnl Miss table 0, Hit table 1
6409e008 1025AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1026
1027for i in 1 2 3 ; do
1028 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)'
1029done
8bd16974 1030OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6d328fa2
SH
1031OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1032
1033AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1034NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1035tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1036dnl
1037NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1038tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1039dnl
1040NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1041tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1042])
1043
1044dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1045AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1046
1047for i in 1 2 3 ; do
1048 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)'
1049done
8bd16974 1050OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6d328fa2
SH
1051OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1052
1053AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1054NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1055tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1056dnl
1057NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1058tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1059dnl
1060NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1061tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1062])
1063
cea4a6d7 1064AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1065AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1066 table=1, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1067OFPST_FLOW reply (OF1.2):
1068])
1069
1070OVS_VSWITCHD_STOP
1071AT_CLEANUP
1072
1073AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1074OVS_VSWITCHD_START([dnl
1075 add-port br0 p1 -- set Interface p1 type=dummy
1076])
53eb8cb8 1077on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1078
1079AT_CAPTURE_FILE([ofctl_monitor.log])
1080AT_DATA([flows.txt], [dnl
1081table=0 actions=goto_table(1)
1082table=2 dl_src=10:11:11:11:11:11 actions=controller
1083])
1084AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1085AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1086
1087dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1088AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1089
1090for i in 1 2 3 ; do
1091 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)'
1092done
8bd16974 1093OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1094OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1095
1096AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1097NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1098tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1099dnl
1100NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1101tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1102dnl
1103NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1104tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1105])
1106
1107dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1108AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1109
1110for i in 1 2 3 ; do
1111 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)'
1112done
8bd16974 1113OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
6d328fa2
SH
1114OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1115
1116AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1117NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1118tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1119dnl
1120NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1121tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1122dnl
1123NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1124tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
6d328fa2
SH
1125])
1126
cea4a6d7 1127AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1128AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1129 n_packets=6, n_bytes=360, actions=goto_table:1
1130 table=2, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1131OFPST_FLOW reply (OF1.2):
1132])
1133
1134OVS_VSWITCHD_STOP
1135AT_CLEANUP
1136
1137AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1138OVS_VSWITCHD_START([dnl
1139 add-port br0 p1 -- set Interface p1 type=dummy
1140])
53eb8cb8 1141on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1142
1143AT_CAPTURE_FILE([ofctl_monitor.log])
1144AT_DATA([flows.txt], [dnl
1145table=0 actions=resubmit(1,1)
1146table=2 dl_src=10:11:11:11:11:11 actions=controller
1147])
1148AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1149AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1150
1151dnl Hit table 0, Miss table 1, Dropped
6409e008 1152AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1153
1154for i in 1 2 3 ; do
1155 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)'
1156done
0c473314 1157OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1158
1159AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1160])
1161
1162dnl Hit table 1, Dropped
6409e008 1163AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1164
1165for i in 1 2 3 ; do
1166 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)'
1167done
1168OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1169
1170AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1171])
1172
cea4a6d7 1173AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1174AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1175 n_packets=6, n_bytes=360, actions=resubmit(1,1)
1176 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1177OFPST_FLOW reply (OF1.2):
1178])
1179
1180OVS_VSWITCHD_STOP
1181AT_CLEANUP
1182
1183AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1184OVS_VSWITCHD_START([dnl
1185 add-port br0 p1 -- set Interface p1 type=dummy
1186])
53eb8cb8 1187on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1188
1189AT_CAPTURE_FILE([ofctl_monitor.log])
1190AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1191
6409e008 1192AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1193
1194dnl Test that missed packets are droped
1195for i in 1 2 3 ; do
1196 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)'
1197done
1198OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1199
1200AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1201])
1202
1203AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1204AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1205NXST_FLOW reply:
1206])
1207
1208OVS_VSWITCHD_STOP
1209AT_CLEANUP
1210
1211AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1212OVS_VSWITCHD_START([dnl
1213 add-port br0 p1 -- set Interface p1 type=dummy
1214])
53eb8cb8 1215on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1216
1217AT_CAPTURE_FILE([ofctl_monitor.log])
1218AT_CHECK([ovs-ofctl del-flows br0])
1219AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1220AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1221
6409e008 1222AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1223
1224dnl Test that missed packets are droped
1225for i in 1 2 3 ; do
1226 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)'
1227done
1228OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1229
1230AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1231])
1232
cea4a6d7 1233AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1234AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1235 n_packets=3, n_bytes=180, actions=goto_table:1
1236OFPST_FLOW reply (OF1.2):
1237])
1238
1239OVS_VSWITCHD_STOP
1240AT_CLEANUP
1241
1242AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1243OVS_VSWITCHD_START([dnl
1244 add-port br0 p1 -- set Interface p1 type=dummy
1245])
53eb8cb8 1246on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1247
1248AT_CAPTURE_FILE([ofctl_monitor.log])
1249AT_CHECK([ovs-ofctl del-flows br0])
1250AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1251AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1252
6409e008 1253AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1254
1255dnl Test that missed packets are droped
1256for i in 1 2 3 ; do
1257 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)'
1258done
1259OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1260
1261AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1262])
1263
cea4a6d7 1264AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1265AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1266 n_packets=3, n_bytes=180, actions=resubmit(1,1)
1267OFPST_FLOW reply (OF1.2):
1268])
1269
1270OVS_VSWITCHD_STOP
1271AT_CLEANUP
1272
15056dc8
EJ
1273AT_SETUP([ofproto-dpif - controller])
1274OVS_VSWITCHD_START([dnl
1275 add-port br0 p1 -- set Interface p1 type=dummy
1276])
53eb8cb8 1277on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1278
1279AT_CAPTURE_FILE([ofctl_monitor.log])
1280AT_DATA([flows.txt], [dnl
1281cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1282cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1283cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1284
54834960
EJ
1285cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1286cookie=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)
1287cookie=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)
1288cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1289cookie=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)
1290cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1291cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1292cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1293cookie=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
15056dc8
EJ
1294])
1295AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1296
1297dnl Flow miss.
6409e008 1298AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1299
1300for i in 1 2 3 ; do
dc235f7f 1301 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)'
15056dc8 1302done
57c94f35 1303OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1304OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1305
15056dc8 1306AT_CHECK([cat ofctl_monitor.log], [0], [dnl
f0fd1a17 1307OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1308tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
15056dc8 1309dnl
f0fd1a17 1310OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1311tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
15056dc8 1312dnl
f0fd1a17 1313OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1314tcp,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=9,tcp_flags=ack tcp_csum:0
15056dc8
EJ
1315])
1316
1317dnl Singleton controller action.
6409e008 1318AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1319
1320for i in 1 2 3 ; do
dc235f7f 1321 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)'
15056dc8 1322done
57c94f35 1323OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1324OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1325
15056dc8
EJ
1326AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1327OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1328tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
15056dc8
EJ
1329dnl
1330OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1331tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
15056dc8
EJ
1332dnl
1333OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1334tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
15056dc8
EJ
1335])
1336
1337dnl Modified controller action.
6409e008 1338AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1339
1340for i in 1 2 3 ; do
dc235f7f 1341 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)'
15056dc8 1342done
57c94f35 1343OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1344OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1345
15056dc8
EJ
1346AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1347OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1348tcp,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
15056dc8
EJ
1349dnl
1350OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1351tcp,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
15056dc8
EJ
1352dnl
1353OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1354tcp,dl_vlan=15,dl_vlan_pcp=0,dl_src=30:33:33:33:33:33,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=fin tcp_csum:0
15056dc8
EJ
1355])
1356
363dd1d9 1357dnl Modified VLAN controller action.
6409e008 1358AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1359
1360for i in 1 2 3; do
8249a1fe 1361 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)'
363dd1d9 1362done
57c94f35 1363OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1364OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1365
363dd1d9
JS
1366AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1367NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1368ip,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
363dd1d9
JS
1369dnl
1370NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1371ip,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
363dd1d9
JS
1372dnl
1373NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1374ip,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
363dd1d9
JS
1375])
1376
349fbdc2 1377dnl Checksum TCP.
6409e008 1378AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1379
1380for i in 1 ; do
1381 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)'
1382done
1383OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1384ovs-appctl -t ovs-ofctl exit
1385
1386AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1387NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1388tcp,vlan_tci=0x0000,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
349fbdc2 1389dnl
50dcbd8e 1390NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1391tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=20:22:22:22:22:22,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
349fbdc2 1392dnl
50dcbd8e 1393NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1394tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
349fbdc2 1395dnl
50dcbd8e 1396NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1397tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:0
349fbdc2 1398dnl
50dcbd8e 1399NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1400tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:1a03
349fbdc2 1401dnl
50dcbd8e 1402NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1403tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=11,tcp_flags=fin tcp_csum:3205
349fbdc2 1404dnl
50dcbd8e 1405NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1406tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=11,tcp_flags=fin tcp_csum:31b8
349fbdc2 1407dnl
50dcbd8e 1408NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1409tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:316d
349fbdc2 1410dnl
50dcbd8e 1411NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1412tcp,dl_vlan=80,dl_vlan_pcp=0,dl_src=80:81:81:81:81:81,dl_dst=82:82:82:82:82:82,nw_src=83.83.83.83,nw_dst=84.84.84.84,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=85,tp_dst=86,tcp_flags=fin tcp_csum:316d
349fbdc2
SH
1413])
1414
1415dnl Checksum UDP.
6409e008 1416AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1417
1418for i in 1 ; do
1419 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'
1420done
1421OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1422ovs-appctl -t ovs-ofctl exit
1423
1424AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1425NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1426udp,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
349fbdc2 1427dnl
50dcbd8e 1428NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1429udp,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
349fbdc2 1430dnl
50dcbd8e 1431NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1432udp,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
349fbdc2 1433dnl
50dcbd8e 1434NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1435udp,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
349fbdc2 1436dnl
50dcbd8e 1437NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1438udp,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
349fbdc2 1439dnl
50dcbd8e 1440NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1441udp,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
349fbdc2 1442dnl
50dcbd8e 1443NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1444udp,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
349fbdc2 1445dnl
50dcbd8e 1446NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1447udp,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
349fbdc2 1448dnl
50dcbd8e 1449NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1450udp,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
349fbdc2
SH
1451])
1452
1453dnl Modified ARP controller action.
6409e008 1454AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1455
1456for i in 1 2 3; do
1457 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)'
1458done
1459
368a198a 1460OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
349fbdc2
SH
1461OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1462AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1463NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1464arp,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
349fbdc2 1465NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1466arp,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
349fbdc2 1467NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1468arp,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
349fbdc2 1469NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1470arp,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
349fbdc2 1471NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1472arp,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
349fbdc2 1473NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1474arp,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
349fbdc2 1475NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1476arp,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
349fbdc2 1477NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1478arp,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
349fbdc2 1479NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1480arp,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
349fbdc2
SH
1481])
1482
1483AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1484
1485dnl Checksum SCTP.
6409e008 1486AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1487
1488for i in 1 ; do
1489 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'
1490done
1491
f7a22c7e 1492AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2
SH
1493OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
1494OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
1495AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1496NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 1497sctp,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
349fbdc2 1498dnl
50dcbd8e 1499NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1500sctp,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
349fbdc2 1501dnl
50dcbd8e 1502NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=102 reg0=0x1,reg1=0x2,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1503sctp,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
349fbdc2 1504dnl
50dcbd8e 1505NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1506sctp,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
349fbdc2 1507dnl
50dcbd8e 1508NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1509sctp,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
349fbdc2 1510dnl
50dcbd8e 1511NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1512sctp,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
349fbdc2 1513dnl
50dcbd8e 1514NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1515sctp,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:dd778f5f
349fbdc2 1516dnl
50dcbd8e 1517NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1518sctp,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:62051f56
349fbdc2 1519dnl
50dcbd8e 1520NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=102 reg0=0x1,reg1=0x2,reg2=0x3,reg3=0x4,reg4=0x5,tun_id=0x6,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1521sctp,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:62051f56
349fbdc2
SH
1522])
1523
1524AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1525 cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1526 cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1527 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)
1528 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)
1529 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)
1530 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)
1531 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)
1532 cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1533 cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1534 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
1535 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
1536 n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1537NXST_FLOW reply:
1538])
1539
1540OVS_VSWITCHD_STOP
1541AT_CLEANUP
1542
1543AT_SETUP([ofproto-dpif - MPLS handling])
1544OVS_VSWITCHD_START([dnl
1545 add-port br0 p1 -- set Interface p1 type=dummy
1546])
53eb8cb8 1547on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
1548
1549AT_CAPTURE_FILE([ofctl_monitor.log])
1550AT_DATA([flows.txt], [dnl
1551cookie=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
1552cookie=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
1553cookie=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
1554cookie=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
1555cookie=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
1556cookie=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
1557cookie=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
1558cookie=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
1ffd16af 1559cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
1560cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1561cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1562cookie=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
1ffd16af
SH
1563
1564cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1565cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1566cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1567cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
1568cookie=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
1569cookie=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
1570cookie=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
1571
1572cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1573cookie=0xd table=1 arp actions=controller
1574
e672ff9b
JR
1575cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1576cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
1577cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1578cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1579
1580cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1581cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1582cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1583
1584cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
1585cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1586cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 1587
e672ff9b
JR
1588cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1589cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1590cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1591
e672ff9b
JR
1592cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1593cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1594cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1595
e672ff9b
JR
1596cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1597cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1598cookie=0x5 dl_src=60:66:66:66:05:10 actions=push_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8847,dec_mpls_ttl,controller
349fbdc2
SH
1599])
1600AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1601
b02475c5 1602dnl Modified MPLS controller action.
6409e008 1603AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1604
1605for i in 1 2 3; do
791a09be 1606 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)'
b02475c5 1607done
57c94f35 1608OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1609OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1610
b02475c5
SH
1611AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1612NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1613mpls,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
b02475c5
SH
1614dnl
1615NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1616mpls,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
b02475c5
SH
1617dnl
1618NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1619mpls,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
b02475c5
SH
1620])
1621
1622dnl Modified MPLS controller action.
6409e008 1623AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5 1624
b0a17866 1625for i in 1 2 3; do
8249a1fe 1626 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)'
b0a17866
SH
1627done
1628OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1629OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
1630
1631AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1632NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1633ip,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
b0a17866
SH
1634dnl
1635NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1636ip,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
b0a17866
SH
1637dnl
1638NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1639ip,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
b0a17866
SH
1640])
1641
1642dnl Modified MPLS controller action.
6409e008 1643AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b0a17866 1644
b02475c5
SH
1645dnl 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)
1646
1647for i in 1 2 3; do
1648 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)'
1649done
bece9ea7 1650OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1651OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 1652
b02475c5
SH
1653AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1654NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1655mpls,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
b02475c5
SH
1656dnl
1657NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1658mpls,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
b02475c5
SH
1659dnl
1660NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1661mpls,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
b02475c5
SH
1662])
1663
1664dnl Modified MPLS controller action.
6409e008 1665AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1666
1667for i in 1 2 3; do
8249a1fe 1668 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))'
b02475c5 1669done
57c94f35 1670OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1671OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1672
b02475c5
SH
1673AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1674NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1675mpls,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
b02475c5
SH
1676dnl
1677NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1678mpls,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
b02475c5
SH
1679dnl
1680NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1681mpls,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
b02475c5
SH
1682])
1683
b676167a 1684dnl Modified MPLS controller action.
6409e008 1685AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b676167a
SH
1686
1687for i in 1 2 3; do
8249a1fe 1688 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)'
b676167a 1689done
57c94f35 1690OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1691OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 1692
b676167a
SH
1693AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1694NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1695mpls,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
b676167a
SH
1696dnl
1697NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1698mpls,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
b676167a
SH
1699dnl
1700NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1701mpls,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
b676167a
SH
1702])
1703
0f3f3c3d 1704dnl Modified MPLS controller action.
6409e008 1705AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1706
1707for i in 1 2 3; do
8249a1fe 1708 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)'
0f3f3c3d 1709done
57c94f35 1710OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1711OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1712
0f3f3c3d
SH
1713AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1714NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1715mpls,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
0f3f3c3d
SH
1716dnl
1717NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1718mpls,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
0f3f3c3d
SH
1719dnl
1720NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1721mpls,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
0f3f3c3d
SH
1722])
1723
1724dnl Modified MPLS controller action.
6409e008 1725AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1726
1727for i in 1 2 3; do
8249a1fe 1728 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)'
0f3f3c3d 1729done
57c94f35 1730OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1731OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1732
0f3f3c3d
SH
1733AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1734NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1735mpls,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
0f3f3c3d
SH
1736dnl
1737NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1738mpls,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
0f3f3c3d
SH
1739dnl
1740NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1741mpls,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
0f3f3c3d
SH
1742])
1743
1ffd16af
SH
1744AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1745
1746dnl Modified MPLS controller action.
6409e008 1747AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1748
1749for i in 1 2 3; do
1750 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)'
1751done
1752OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1753ovs-appctl -t ovs-ofctl exit
1754
1755AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1756NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1757mplsm,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
1ffd16af
SH
1758dnl
1759NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1760mplsm,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
1ffd16af
SH
1761dnl
1762NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1763mplsm,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
1ffd16af
SH
1764])
1765
1766AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1767
0f3f3c3d 1768dnl Modified MPLS controller action.
6409e008 1769AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1770
1771for i in 1 2 3; do
8249a1fe 1772 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)'
0f3f3c3d 1773done
57c94f35 1774OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1775OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1776
0f3f3c3d
SH
1777AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1778NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1779mpls,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
0f3f3c3d
SH
1780dnl
1781NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1782mpls,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
0f3f3c3d
SH
1783dnl
1784NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1785mpls,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
0f3f3c3d
SH
1786])
1787
b02475c5 1788dnl Modified MPLS actions.
6409e008 1789AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1790
1791for i in 1 2 3; do
02830175 1792 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)'
b02475c5 1793done
57c94f35 1794OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1795OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1796
b02475c5
SH
1797AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1798NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1799mpls,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
b02475c5
SH
1800dnl
1801NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1802mpls,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
b02475c5
SH
1803dnl
1804NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1805mpls,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
b02475c5
SH
1806])
1807
1808dnl Modified MPLS ipv6 controller action.
6409e008 1809AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1810
1811for i in 1 2 3; do
1812 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)'
1813done
57c94f35 1814OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1815OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1816
b02475c5
SH
1817AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1818NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1819mplsm,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
b02475c5
SH
1820dnl
1821NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1822mplsm,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
b02475c5
SH
1823dnl
1824NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1825mplsm,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
b02475c5
SH
1826])
1827
1828
1829dnl Modified MPLS pop action.
cff78c88
SH
1830dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1831dnl 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)
1832dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1833
6409e008 1834AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1835
1836for i in 1 2 3; do
cff78c88 1837 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'
b02475c5 1838done
cff78c88
SH
1839#for i in 2 3; do
1840# 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)'
1841#done
57c94f35 1842OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1843OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1844
b02475c5 1845AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 1846NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1847tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
b02475c5 1848dnl
cff78c88 1849NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1850tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
b02475c5 1851dnl
cff78c88 1852NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1853tcp,vlan_tci=0x0000,dl_src=60:66:66:66:66:66,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
b02475c5
SH
1854])
1855
5c0243a9 1856AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 1857
1ffd16af
SH
1858dnl Modified MPLS pop action.
1859dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1860dnl 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)
1861dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1862dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1863AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1864
1865for i in 1 2 3; do
1866 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'
1867done
1868OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1869OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1870
2be3fe44 1871AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1872NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1873tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 1874dnl
e672ff9b 1875NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1876tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 1877dnl
e672ff9b 1878NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1879tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
1880])
1881
1882AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1883
1884dnl Modified MPLS pop action.
1885dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1886dnl 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)
1887dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1888dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1889AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1890
1891for i in 1 2 3; do
1892 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'
1893done
1894OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1895OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1896
2be3fe44 1897AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1898NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1899tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af 1900dnl
e672ff9b 1901NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1902tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af 1903dnl
e672ff9b 1904NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1905tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:02,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af
SH
1906])
1907
1908AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1909
1910dnl Modified MPLS pop action.
1911dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1912dnl 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)
1913dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1914dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1915AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1916
1917for i in 1 2 3; do
1918 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'
1919done
1920OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1921OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1922
2be3fe44 1923AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1924NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1925tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af 1926dnl
e672ff9b 1927NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1928tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af 1929dnl
e672ff9b 1930NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1931tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:03,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af
SH
1932])
1933
1934AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1935
1936dnl Modified MPLS pop action.
1937dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1938dnl 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)
1939dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1940dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1941AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1942
1943for i in 1 2 3; do
1944 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'
1945done
1946OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1947OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1948
2be3fe44 1949AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1950NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1951tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af 1952dnl
e672ff9b 1953NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1954tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af 1955dnl
e672ff9b 1956NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1957tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:04,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.2,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7743
1ffd16af
SH
1958])
1959
1960AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1961
1962dnl Modified MPLS pop action.
1963dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1964dnl 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)
1965dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1966dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1967AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1968
1969for i in 1 2 3; do
1970 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'
1971done
1972OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1973OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1974
2be3fe44 1975AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1976NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1977tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
1ffd16af 1978dnl
e672ff9b 1979NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1980tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
1ffd16af 1981dnl
e672ff9b 1982NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1983tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
1ffd16af
SH
1984])
1985
1986AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1987
1988dnl Modified MPLS pop action.
1989dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1990dnl 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)
1991dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1992dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1993AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1994
1995for i in 1 2 3; do
1996 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'
1997done
1998OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1999OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2000
2be3fe44 2001AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2002NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2003tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
1ffd16af 2004dnl
e672ff9b 2005NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2006tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
1ffd16af 2007dnl
e672ff9b 2008NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2009tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:06,dl_dst=50:54:00:00:00:07,nw_src=192.168.255.255,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
1ffd16af
SH
2010])
2011
2012AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2013
2014dnl Modified MPLS pop action.
2015dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2016dnl 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)
2017dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2018dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2019AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2020
2021for i in 1 2 3; do
2022 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'
2023done
2024OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2025OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2026
2be3fe44 2027AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2028NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2029tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2030dnl
e672ff9b 2031NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2032tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2033dnl
e672ff9b 2034NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2035tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:07,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2036])
2037
2038AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2039
2040dnl Modified MPLS pop action.
2041dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2042dnl 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)
6409e008 2043AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2044
2045for i in 1 2 3; do
2046 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'
2047done
2048OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2049OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2050
2be3fe44 2051AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2052NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2053arp,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
1ffd16af
SH
2054dnl
2055NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2056arp,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
1ffd16af
SH
2057dnl
2058NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2059arp,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
1ffd16af
SH
2060])
2061
2062AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2063
2064dnl Modified MPLS pop action.
2065dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2066dnl 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)
2067dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2068dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2069AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2070
2071for i in 1 2 3; do
2072 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'
2073done
2074OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2075OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2076
2be3fe44 2077AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2078NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2079tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2080dnl
e672ff9b 2081NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2082tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2083dnl
e672ff9b 2084NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2085tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:09,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=48,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2086])
2087
2088AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2089
2090dnl Modified MPLS pop action.
2091dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2092dnl 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)
2093dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2094dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2095AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2096
2097for i in 1 2 3; do
2098 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'
2099done
2100OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2101OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2102
2be3fe44 2103AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2104NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2105tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af 2106dnl
e672ff9b 2107NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2108tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af 2109dnl
e672ff9b 2110NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2111tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0a,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2dee
1ffd16af
SH
2112])
2113
2114AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2115
2116dnl Modified MPLS pop action.
2117dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2118dnl 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)
2119dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2120dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2121AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2122
2123for i in 1 2 3; do
2124 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'
2125done
2126OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2127OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2128
2be3fe44 2129AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2130NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2131tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
1ffd16af 2132dnl
e672ff9b 2133NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2134tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
1ffd16af 2135dnl
e672ff9b 2136NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2137tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:0b,dl_dst=50:54:00:00:00:07,nw_src=10.0.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:2ded
1ffd16af
SH
2138])
2139
2140AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2141
2142dnl Modified MPLS pop action.
2143dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2144dnl 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)
2145dnl (label 20, exp 0, [S], ttl 31)
2146dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2147dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2148AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2149
2150for i in 1 2 3; do
2151 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'
2152done
2153OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2154OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2155
2156AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2157NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2158mplsm,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
1ffd16af
SH
2159dnl
2160NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2161mplsm,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
1ffd16af
SH
2162dnl
2163NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2164mplsm,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
1ffd16af
SH
2165])
2166
2167AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2168
2169dnl Modified MPLS pop action.
2170dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2171dnl 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)
2172dnl (label 20, exp 0, [S], ttl 31)
2173dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2174dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2175AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2176
2177for i in 1 2 3; do
2178 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'
2179done
2180OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2181OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2182
2183AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2184NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2185mpls,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
1ffd16af 2186dnl
e672ff9b 2187NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2188mpls,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
1ffd16af 2189dnl
e672ff9b 2190NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2191mpls,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
1ffd16af
SH
2192])
2193
2194AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2195
2196dnl Modified MPLS pop action.
2197dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2198dnl 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)
2199dnl (label 20, exp 0, [S], ttl 31)
2200dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2201dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2202AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2203
2204for i in 1 2 3; do
2205 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'
2206done
2207OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2208OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2209
2210AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2211NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2212mplsm,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
1ffd16af
SH
2213dnl
2214NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2215mplsm,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
1ffd16af
SH
2216dnl
2217NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2218mplsm,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
1ffd16af
SH
2219])
2220
2221AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2222
2223dnl Modified MPLS pop action.
2224dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2225dnl 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)
2226dnl (label 20, exp 0, [S], ttl 31)
2227dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2228dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2229AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2230
2231for i in 1 2 3; do
2232 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'
2233done
2234OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2235OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2236
2237AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2238NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2239tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2240dnl
e672ff9b 2241NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2242tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2243dnl
e672ff9b 2244NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2245tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:00,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2246])
2247
2248AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2249
2250dnl Modified MPLS pop action.
2251dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2252dnl 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)
2253dnl (label 20, exp 0, [S], ttl 31)
2254dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2255dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2256AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2257
2258for i in 1 2 3; do
2259 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'
2260done
e672ff9b 2261
1ffd16af
SH
2262OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2263OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2264
2be3fe44 2265AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2266NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2267tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2268dnl
e672ff9b 2269NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2270tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2271dnl
e672ff9b 2272NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2273tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:01,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2274])
2275
2276AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2277
2278dnl Modified MPLS pop action.
2279dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2280dnl 60:66:66:66:02:10 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
1ffd16af
SH
2281dnl (label 20, exp 0, [S], ttl 31)
2282dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2283dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2284AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2285
2286for i in 1 2 3; do
2287 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'
2288done
2289OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2290OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2291
2be3fe44 2292AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2293NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2294tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2295dnl
e672ff9b 2296NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2297tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2298dnl
e672ff9b 2299NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2300tcp,vlan_tci=0x0000,dl_src=60:66:66:66:02:10,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2301])
2302
2303AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2304
2305dnl Modified MPLS pop action.
2306dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2307dnl 60:66:66:66:03:00 > 50:54:00:00:00:07, ethertype MPLS unicast (0x8847), length 66: MPLS (label 20, exp 0, ttl 32)
1ffd16af
SH
2308dnl (label 20, exp 0, ttl 31)
2309dnl (label 20, exp 0, [S], ttl 30)
2310dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2311dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2312AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2313
2314for i in 1 2 3; do
2315 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'
2316done
2317OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2318OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2319
2320AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2321NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2322mplsm,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
1ffd16af 2323dnl
e672ff9b 2324NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2325mplsm,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
1ffd16af 2326dnl
e672ff9b 2327NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2328mplsm,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
1ffd16af
SH
2329])
2330
2331AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2332
2333dnl Modified MPLS pop action.
2334dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2335dnl 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)
2336dnl (label 20, exp 0, ttl 31)
2337dnl (label 20, exp 0, [S], ttl 30)
2338dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2339dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2340AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2341
2342for i in 1 2 3; do
2343 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'
2344done
2345OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2346OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2347
2348AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2349NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2350mpls,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
1ffd16af 2351dnl
e672ff9b 2352NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2353mpls,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
1ffd16af 2354dnl
e672ff9b 2355NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2356mpls,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
1ffd16af
SH
2357])
2358
2359AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2360
2361dnl Modified MPLS pop action.
2362dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2363dnl 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)
2364dnl (label 20, exp 0, ttl 31)
2365dnl (label 20, exp 0, [S], ttl 30)
2366dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2367dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2368AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2369
2370for i in 1 2 3; do
2371 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'
2372done
2373OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2374OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2375
2376AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2377NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2378mplsm,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
1ffd16af 2379dnl
e672ff9b 2380NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2381mplsm,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
1ffd16af 2382dnl
e672ff9b 2383NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2384mplsm,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
1ffd16af
SH
2385])
2386
2387AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2388
2389dnl Modified MPLS pop action.
2390dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2391dnl 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)
2392dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2393dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2394AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2395
2396for i in 1 2 3; do
2397 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'
2398done
2399OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2400OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2401
2be3fe44 2402AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2403NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2404mpls,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
1ffd16af 2405dnl
e672ff9b 2406NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2407mpls,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
1ffd16af 2408dnl
e672ff9b 2409NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2410mpls,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
1ffd16af
SH
2411])
2412
2413AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2414
2415dnl Modified MPLS pop action.
2416dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2417dnl 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)
2418dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2419dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2420AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2421
2422for i in 1 2 3; do
2423 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'
2424done
2425OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2426OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2427
2be3fe44 2428AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2429NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2430mplsm,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
1ffd16af 2431dnl
e672ff9b 2432NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2433mplsm,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
1ffd16af 2434dnl
e672ff9b 2435NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2436mplsm,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
1ffd16af
SH
2437])
2438
2439AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2440
2441dnl Modified MPLS pop action.
2442dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2443dnl 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)
2444dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2445dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2446AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2447
2448for i in 1 2 3; do
2449 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'
2450done
2451OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2452OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2453
2be3fe44 2454AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2455NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2456mplsm,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
1ffd16af 2457dnl
e672ff9b 2458NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2459mplsm,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
1ffd16af 2460dnl
e672ff9b 2461NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2462mplsm,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
1ffd16af
SH
2463])
2464
2465AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2466
2467dnl Modified MPLS pop action.
2468dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2469dnl 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)
2470dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2471dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2472AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2473
2474for i in 1 2 3; do
2475 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'
2476done
e672ff9b 2477
1ffd16af
SH
2478OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2479OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2480
2481AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2482NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2483mpls,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
1ffd16af 2484dnl
e672ff9b 2485NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2486mpls,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
1ffd16af 2487dnl
e672ff9b 2488NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2489mpls,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
1ffd16af
SH
2490])
2491
2492AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2493
2494dnl Modified MPLS pop action.
2495dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2496dnl 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)
2497dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2498dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2499AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2500
2501for i in 1 2 3; do
2502 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'
2503done
2504OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2505OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2506
2507AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2508NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2509mplsm,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
1ffd16af 2510dnl
e672ff9b 2511NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2512mplsm,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
1ffd16af 2513dnl
e672ff9b 2514NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2515mplsm,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
1ffd16af
SH
2516])
2517
2518AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2519
2520dnl Modified MPLS pop action.
2521dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2522dnl 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)
2523dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2524dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2525AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2526
2527for i in 1 2 3; do
2528 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'
2529done
e672ff9b 2530
1ffd16af
SH
2531OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2532OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2533
2534AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2535NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2536mpls,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
1ffd16af 2537dnl
e672ff9b 2538NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2539mpls,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
1ffd16af 2540dnl
e672ff9b 2541NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2542mpls,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
1ffd16af
SH
2543])
2544
cea4a6d7 2545AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 2546AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
2547 cookie=0x5, n_packets=3, n_bytes=186, dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,CONTROLLER:65535
2548 cookie=0x5, 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
2549 cookie=0x5, 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
b02475c5
SH
2550 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
2551 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
2552 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
b676167a 2553 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
0f3f3c3d
SH
2554 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
2555 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
2556 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
b0a17866 2557 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
1ffd16af 2558 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
392c30ba 2559 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
b02475c5 2560 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
1ffd16af 2561 cookie=0xd, n_packets=3, n_bytes=180, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
c2d936a4 2562 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
1ffd16af
SH
2563 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
2564 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
2565 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
2566 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
2567 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
2568 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
e672ff9b 2569 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
2570 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
2571 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
cff78c88 2572 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
2573 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2574 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
2575 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
2576 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
1ffd16af 2577 cookie=0xd, table=1, n_packets=3, n_bytes=168, arp actions=CONTROLLER:65535
e672ff9b
JR
2578 cookie=0xdeadbeef, table=2, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
2579 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2580 cookie=0xe, n_packets=3, n_bytes=198, dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,CONTROLLER:65535
2581 cookie=0xe, n_packets=3, n_bytes=210, dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,CONTROLLER:65535
2582 cookie=0xe, 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
2583 cookie=0xe, 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
2584 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,CONTROLLER:65535
2585 cookie=0xf, 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
2586 cookie=0xf, n_packets=3, n_bytes=186, dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,CONTROLLER:65535
ef0ce8ae 2587NXST_FLOW reply:
15056dc8
EJ
2588])
2589
2590OVS_VSWITCHD_STOP
8e9ce036 2591AT_CLEANUP
04c956fc 2592
1ffd16af
SH
2593AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2594OVS_VSWITCHD_START([dnl
2595 add-port br0 p1 -- set Interface p1 type=dummy
2596])
53eb8cb8 2597on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2598
2599AT_CAPTURE_FILE([ofctl_monitor.log])
2600AT_DATA([flows.txt], [dnl
2601table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2602table=1 ip,ip_dscp=8 actions=controller
2603])
2604AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2605
2606
2607dnl Modified MPLS pop action.
2608dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2609dnl 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)
2610dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2611dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2612AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2613
2614for i in 1 2 3; do
2615 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'
2616done
2617OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2618OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2619
2be3fe44 2620AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2621OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2622tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2623dnl
2624OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2625tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2626dnl
2627OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2628tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2629])
2630
cea4a6d7 2631AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2632AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2633 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2634 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2635OFPST_FLOW reply (OF1.2):
2636])
2637
2638OVS_VSWITCHD_STOP
2639AT_CLEANUP
2640
2641AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2642OVS_VSWITCHD_START([dnl
2643 add-port br0 p1 -- set Interface p1 type=dummy
2644])
53eb8cb8 2645on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2646
2647dnl N.B: The first (and only) action that accesses L3 data after the
2648dnl pop_mpls action is present in write_actions. This exercises recirculation
2649dnl triggered in write_actions due to a previous action not in write actions.
2650AT_CAPTURE_FILE([ofctl_monitor.log])
2651AT_DATA([flows.txt], [dnl
2652mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2653])
2654AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2655
2656dnl Modified MPLS pop action.
2657dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2658dnl 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)
2659dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2660dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2661AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2662
2663for i in 1 2 3; do
2664 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'
2665done
2666OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2667OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2668
2be3fe44 2669AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2670OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2671tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2672dnl
e672ff9b 2673OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2674tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af 2675dnl
e672ff9b 2676OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2677tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:08,dl_dst=50:54:00:00:00:01,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=32,nw_ecn=0,nw_ttl=254,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7744
1ffd16af
SH
2678])
2679
cea4a6d7 2680AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2681AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2682 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2683OFPST_FLOW reply (OF1.2):
2684])
2685
2686OVS_VSWITCHD_STOP
2687AT_CLEANUP
527ae97e
SH
2688
2689AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2690OVS_VSWITCHD_START([dnl
2691 add-port br0 p1 -- set Interface p1 type=dummy
2692])
53eb8cb8 2693on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2694
2695AT_CAPTURE_FILE([ofctl_monitor.log])
2696# A table-miss flow has priority 0 and no match
2697AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2698
2699dnl Singleton controller action.
6409e008 2700AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2701
2702for i in 1 2 3 ; do
2703 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)'
2704done
2705OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2706ovs-appctl -t ovs-ofctl exit
2707
2708AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2709OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2710tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2711dnl
2712OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2713tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2714dnl
2715OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2716tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2717])
2718
cea4a6d7 2719AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e
SH
2720AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2721 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2722NXST_FLOW reply:
2723])
2724
2725OVS_VSWITCHD_STOP
2726AT_CLEANUP
2727
2728
2729AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2730OVS_VSWITCHD_START([dnl
2731 add-port br0 p1 -- set Interface p1 type=dummy
2732])
53eb8cb8 2733on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2734
2735AT_CAPTURE_FILE([ofctl_monitor.log])
2736# A table-miss flow has priority 0 and no match
2737AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2738
2739dnl Singleton controller action.
6409e008 2740AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2741
2742for i in 1 2 3 ; do
2743 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)'
2744done
2745OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2746ovs-appctl -t ovs-ofctl exit
2747
2748AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2749
2750AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2751OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2752tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2753dnl
2754OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2755tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2756dnl
2757OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2758tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
ba96552a
SS
2759])
2760
cea4a6d7 2761AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
2762AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2763 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2764OFPST_FLOW reply (OF1.3):
2765])
2766
2767OVS_VSWITCHD_STOP
2768AT_CLEANUP
2769
2770AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2771OVS_VSWITCHD_START([dnl
2772 add-port br0 p1 -- set Interface p1 type=dummy
2773])
53eb8cb8 2774on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 2775
5b7278a1
JS
2776ovs-appctl time/stop
2777
ba96552a
SS
2778AT_CAPTURE_FILE([ofctl_monitor.log])
2779# A table-miss flow has priority 0 and no match
2780AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2781
2782dnl Singleton controller action.
6409e008 2783AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a
SS
2784
2785# Become slave (OF 1.3), which should disable everything except port status.
2786ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2787
5b7278a1
JS
2788# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2789ovs-appctl time/warp 500 100
2790
ba96552a
SS
2791# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2792ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2793
5b7278a1 2794ovs-appctl time/warp 500 100
ba96552a
SS
2795for i in 1 2 3 ; do
2796 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)'
2797done
2798OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2799ovs-appctl -t ovs-ofctl exit
2800
cea4a6d7 2801AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
2802AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2803send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2804OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2805dnl
2806send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2807 master:
2808 PACKET_IN: (off)
2809 PORT_STATUS: (off)
2810 FLOW_REMOVED: (off)
904e5202
BP
2811 ROLE_STATUS: (off)
2812 TABLE_STATUS: (off)
2813 REQUESTFORWARD: (off)
ba96552a
SS
2814
2815 slave:
2816 PACKET_IN: no_match
2817 PORT_STATUS: (off)
2818 FLOW_REMOVED: (off)
904e5202
BP
2819 ROLE_STATUS: (off)
2820 TABLE_STATUS: (off)
2821 REQUESTFORWARD: (off)
ba96552a
SS
2822dnl
2823OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2824tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
ba96552a
SS
2825dnl
2826OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2827tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
ba96552a
SS
2828dnl
2829OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2830tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
527ae97e
SH
2831])
2832
2833AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2834
2835AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2836 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2837OFPST_FLOW reply (OF1.3):
2838])
2839
2840OVS_VSWITCHD_STOP
2841AT_CLEANUP
2842
807c7989
SS
2843
2844AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
2845OVS_VSWITCHD_START([dnl
2846 add-port br0 p1 -- set Interface p1 type=dummy
2847])
53eb8cb8 2848on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
2849
2850AT_CAPTURE_FILE([ofctl_monitor.log])
2851# A table-miss flow has priority 0 and no match
2852AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2853
2854dnl Singleton controller action.
6409e008 2855AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
2856
2857for i in 1 2 3 ; do
2858 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)'
2859done
2860OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2861ovs-appctl -t ovs-ofctl exit
2862
cea4a6d7 2863AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989
SS
2864AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2865OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2866tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
807c7989
SS
2867dnl
2868OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2869tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
807c7989
SS
2870dnl
2871OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2872tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
807c7989
SS
2873])
2874
2875AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2876
2877AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2878 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2879OFPST_FLOW reply (OF1.4):
2880])
2881
2882OVS_VSWITCHD_STOP
2883AT_CLEANUP
2884
2885
029ca940 2886AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
2887OVS_VSWITCHD_START([dnl
2888 add-port br0 p1 -- set Interface p1 type=dummy
2889])
53eb8cb8 2890on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
2891
2892AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
2893AT_DATA([flows.txt], [dnl
2894table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2895table=1 actions=output(CONTROLLER),goto_table(2)
2896table=2 actions=group:1234
2897])
3a11fd5b 2898AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 2899AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
2900
2901dnl Singleton controller action.
6409e008 2902AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
2903
2904for i in 1 2 3 ; do
2905 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)'
2906done
2907OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2908ovs-appctl -t ovs-ofctl exit
2909
2910AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2911
2912AT_CHECK([cat ofctl_monitor.log], [0], [dnl
029ca940 2913OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2914tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2915dnl
2916OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2917tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940 2918dnl
3a11fd5b 2919OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2920tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b 2921dnl
029ca940 2922OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2923tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2924dnl
2925OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2926tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940 2927dnl
3a11fd5b 2928OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2929tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b 2930dnl
029ca940 2931OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2932tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2933dnl
2934OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2935tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940 2936dnl
3a11fd5b 2937OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2938tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b
SS
2939])
2940
2941AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2942
2943AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
029ca940
SS
2944 n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
2945 table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
2946 table=2, n_packets=3, n_bytes=180, actions=group:1234
3a11fd5b
SS
2947OFPST_FLOW reply (OF1.3):
2948])
2949
2950OVS_VSWITCHD_STOP
2951AT_CLEANUP
2952
2953
029ca940 2954AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
2955OVS_VSWITCHD_START([dnl
2956 add-port br0 p1 -- set Interface p1 type=dummy
2957])
53eb8cb8 2958on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
2959
2960AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
2961AT_DATA([flows.txt], [dnl
2962table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2963table=1 actions=output(CONTROLLER),goto_table(2)
2964table=2 actions=group:1234
2965])
3a11fd5b 2966AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 2967AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
2968
2969dnl Singleton controller action.
6409e008 2970AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
2971
2972for i in 1 2 3 ; do
2973 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)'
2974done
2975OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2976ovs-appctl -t ovs-ofctl exit
2977
2978AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2979
2980AT_CHECK([cat ofctl_monitor.log], [0], [dnl
029ca940 2981OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2982tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2983dnl
2984OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 2985tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2986dnl
2987OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 2988tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2989dnl
2990OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2991tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2992dnl
2993OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 2994tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2995dnl
2996OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 2997tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
029ca940
SS
2998dnl
2999OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 3000tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b 3001dnl
029ca940 3002OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 3003tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b 3004dnl
029ca940 3005OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 3006tcp,vlan_tci=0x0000,dl_src=10:11:11:11:11:11,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,tp_src=8,tp_dst=10,tcp_flags=syn tcp_csum:0
3a11fd5b
SS
3007])
3008
3009AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3010
3011AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
029ca940
SS
3012 n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3013 table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
3014 table=2, n_packets=3, n_bytes=180, actions=group:1234
3a11fd5b
SS
3015OFPST_FLOW reply (OF1.4):
3016])
3017
3018OVS_VSWITCHD_STOP
3019AT_CLEANUP
3020
029ca940 3021
f6c8a6b1
BP
3022AT_SETUP([ofproto-dpif - ARP modification slow-path])
3023OVS_VSWITCHD_START
ca5792f0 3024add_of_ports br0 1 2
f6c8a6b1
BP
3025
3026ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3027ovs-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'
3028
3029# Input some packets that should follow the arp modification slow-path.
3030for i in 1 2 3; do
3031 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)'
3032done
3033AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3034
3035# Check the packets that were output.
3036AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3037arp,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
3038arp,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
3039arp,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
3040arp,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
3041arp,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
3042arp,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
3043arp,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
3044arp,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
3045arp,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
f6c8a6b1
BP
3046])
3047
f6c8a6b1
BP
3048OVS_VSWITCHD_STOP
3049AT_CLEANUP
3050
ecac4ebf 3051AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3052OVS_VSWITCHD_START(
023e1e0a
BP
3053 [set Bridge br0 fail-mode=standalone -- \
3054 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3055 add-port br0 p2 tag=10 -- \
5e9ceccd
BP
3056 add-port br0 p3 tag=12 \
3057 other-config:priority-tags=true -- \
ecac4ebf
BP
3058 add-port br0 p4 tag=12 -- \
3059 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3060 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3061 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
5e9ceccd
BP
3062 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3063 other-config:priority-tags=true -- \
ecac4ebf
BP
3064 set Interface p1 type=dummy -- \
3065 set Interface p2 type=dummy -- \
3066 set Interface p3 type=dummy -- \
3067 set Interface p4 type=dummy -- \
3068 set Interface p5 type=dummy -- \
3069 set Interface p6 type=dummy -- \
3070 set Interface p7 type=dummy -- \
3071 set Interface p8 type=dummy --])
04c956fc 3072
247527db
BP
3073dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3074dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3075dnl actions.
04c956fc 3076for tuple in \
e44768b7
JP
3077 "100 none 0 drop" \
3078 "100 0 0 drop" \
3079 "100 0 1 drop" \
3080 "100 10 0 1,5,6,7,8,pop_vlan,2" \
3081 "100 10 1 1,5,6,7,8,pop_vlan,2" \
3082 "100 11 0 5,7" \
3083 "100 11 1 5,7" \
3084 "100 12 0 1,5,6,pop_vlan,3,4,7,8" \
3085 "100 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
247527db
BP
3086 "1 none 0 drop" \
3087 "1 0 0 drop" \
3088 "1 0 1 drop" \
e44768b7
JP
3089 "1 10 0 5,6,7,8,100,pop_vlan,2" \
3090 "1 10 1 5,6,7,8,100,pop_vlan,2" \
247527db
BP
3091 "1 11 0 drop" \
3092 "1 11 1 drop" \
e44768b7
JP
3093 "1 12 0 5,6,100,pop_vlan,3,4,7,8" \
3094 "1 12 1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3095 "2 none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3096 "2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3097 "2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
247527db
BP
3098 "2 10 0 drop" \
3099 "2 10 1 drop" \
3100 "2 11 0 drop" \
3101 "2 11 1 drop" \
3102 "2 12 0 drop" \
3103 "2 12 1 drop" \
e44768b7
JP
3104 "3 none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3105 "3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3106 "3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3107 "3 10 0 drop" \
3108 "3 10 1 drop" \
3109 "3 11 0 drop" \
3110 "3 11 1 drop" \
3111 "3 12 0 drop" \
3112 "3 12 1 drop" \
e44768b7
JP
3113 "4 none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3114 "4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3115 "4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3116 "4 10 0 drop" \
3117 "4 10 1 drop" \
3118 "4 11 0 drop" \
3119 "4 11 1 drop" \
3120 "4 12 0 drop" \
3121 "4 12 1 drop" \
e44768b7
JP
3122 "5 none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3123 "5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3124 "5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3125 "5 10 0 1,6,7,8,100,pop_vlan,2" \
3126 "5 10 1 1,6,7,8,100,pop_vlan,2" \
3127 "5 11 0 7,100" \
3128 "5 11 1 7,100" \
3129 "5 12 0 1,6,100,pop_vlan,3,4,7,8" \
3130 "5 12 1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3131 "6 none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3132 "6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3133 "6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3134 "6 10 0 1,5,7,8,100,pop_vlan,2" \
3135 "6 10 1 1,5,7,8,100,pop_vlan,2" \
247527db
BP
3136 "6 11 0 drop" \
3137 "6 11 1 drop" \
e44768b7
JP
3138 "6 12 0 1,5,100,pop_vlan,3,4,7,8" \
3139 "6 12 1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3140 "7 none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3141 "7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3142 "7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
3143 "7 10 0 1,5,6,8,100,pop_vlan,2" \
3144 "7 10 1 1,5,6,8,100,pop_vlan,2" \
3145 "7 11 0 5,100" \
3146 "7 11 1 5,100" \
3147 "7 12 0 1,5,6,100,pop_vlan,3,4,8" \
3148 "7 12 1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
3149 "8 none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3150 "8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3151 "8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3152 "8 10 0 1,5,6,7,100,pop_vlan,2" \
3153 "8 10 1 1,5,6,7,100,pop_vlan,2" \
247527db
BP
3154 "8 11 0 drop" \
3155 "8 11 1 drop" \
e44768b7
JP
3156 "8 12 0 1,5,6,100,pop_vlan,3,4,7" \
3157 "8 12 1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
04c956fc
BP
3158do
3159 set $tuple
3160 in_port=$1
3161 vlan=$2
ecac4ebf
BP
3162 pcp=$3
3163 expected=$4
04c956fc
BP
3164
3165 if test $vlan = none; then
247527db 3166 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3167 else
247527db 3168 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))"
04c956fc
BP
3169 fi
3170
395e68ce
BP
3171 echo "----------------------------------------------------------------------"
3172 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3173
50aa28fd 3174 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3175 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3176
247527db 3177 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3178 mv stdout expout
247527db 3179 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3180done
3181
3182OVS_VSWITCHD_STOP
3183AT_CLEANUP
7257b535 3184
56879058
JS
3185AT_SETUP([ofproto-dpif - MPLS handling])
3186OVS_VSWITCHD_START([dnl
3187 add-port br0 p1 -- set Interface p1 type=dummy
3188])
53eb8cb8 3189on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3190
3191AT_CAPTURE_FILE([ofctl_monitor.log])
3192AT_DATA([flows.txt], [dnl
3193dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3194dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3195dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3196])
3197AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3198
3199dnl In this test, we push an MPLS tag to an ethernet packet.
6409e008 3200AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
56879058
JS
3201
3202for i in 1 2 3; do
3203 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)'
3204done
62022172 3205OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3206OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3207
38b0b29f 3208AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
56879058 3209OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3210mpls,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
56879058
JS
321100000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
321200000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
321300000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
321400000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3215dnl
3216OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3217mpls,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
56879058
JS
321800000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
321900000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
322000000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
322100000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3222dnl
3223OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3224mpls,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
56879058
JS
322500000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
322600000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
322700000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
322800000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3229])
3230
63636ee8
JS
3231dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3232dnl copied exactly, except for the BOS bit.
6409e008 3233AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
63636ee8
JS
3234
3235for i in 1 2 3; do
3236 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)'
3237done
62022172 3238OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3239OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 3240
38b0b29f 3241AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
63636ee8 3242OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3243mpls,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
63636ee8
JS
324400000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
324500000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
324600000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
324700000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3248dnl
3249OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3250mpls,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
63636ee8
JS
325100000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
325200000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
325300000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
325400000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3255dnl
3256OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3257mpls,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
63636ee8
JS
325800000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
325900000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
326000000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0c1625e8
SH
326100000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3262])
3263
3264dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3265dnl copied exactly, except for the BOS bit. The ethertype should be updated
3266dnl to the MPLS ethertype of the MPLS push action which differs to that
3267dnl of the input packet.
6409e008 3268AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
3269
3270for i in 1 2 3; do
3271 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)'
3272done
62022172 3273OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c1625e8
SH
3274OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
3275
38b0b29f 3276AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
0c1625e8 3277OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3278mplsm,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
0c1625e8
SH
327900000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
328000000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
328100000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
328200000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3283dnl
3284OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3285mplsm,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
0c1625e8
SH
328600000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
328700000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
328800000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
328900000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3290dnl
3291OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3292mplsm,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
0c1625e8
SH
329300000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
329400000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
329500000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
63636ee8
JS
329600000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3297])
3298
56879058
JS
3299OVS_VSWITCHD_STOP
3300AT_CLEANUP
3301
846e159a
SH
3302AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3303OVS_VSWITCHD_START([dnl
3304 add-port br0 p1 -- set Interface p1 type=dummy
3305])
53eb8cb8 3306on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
3307
3308AT_CAPTURE_FILE([ofctl_monitor.log])
3309AT_DATA([flows.txt], [dnl
3310cookie=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
3311cookie=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
3312cookie=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
3313cookie=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
3314cookie=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
3315cookie=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
3316cookie=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
3317cookie=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
3318cookie=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
3319cookie=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
3320])
3321AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3322
3323dnl Modified MPLS controller action.
3324dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3325dnl both of these in the final flow
6409e008 3326AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3327
3328for i in 1 2 3; do
3329 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)'
3330done
62022172 3331OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3332OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3333
38b0b29f 3334AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3335OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3336mpls,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
846e159a
SH
333700000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
333800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
333900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
334000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
334100000040 00 00 00 00
3342dnl
3343OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3344mpls,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
846e159a
SH
334500000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
334600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
334700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
334800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
334900000040 00 00 00 00
3350dnl
3351OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3352mpls,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
846e159a
SH
335300000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
335400000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
335500000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
335600000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
335700000040 00 00 00 00
3358])
3359
3360dnl Modified MPLS controller action.
4dc94d7e 3361dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3362dnl before we push the MPLS and VLAN tags.
6409e008 3363AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3364
3365for i in 1 2 3; do
3366 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))'
3367done
62022172 3368OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3369OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3370
38b0b29f 3371AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3372OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3373mpls,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
846e159a
SH
337400000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
337500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
337600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
337700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3378dnl
3379OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3380mpls,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
846e159a
SH
338100000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
338200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
338300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
338400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3385dnl
3386OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3387mpls,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
846e159a
SH
338800000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
338900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
339000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
339100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3392])
3393
3394dnl Modified MPLS controller action.
3395dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3396dnl both of these in the final flow
6409e008 3397AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3398
3399for i in 1 2 3; do
3400 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)'
3401done
62022172 3402OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3403OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3404
38b0b29f 3405AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3406OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3407mpls,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
846e159a
SH
340800000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
340900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
341000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
341100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
341200000040 00 00 00 00
3413dnl
3414OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3415mpls,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
846e159a
SH
341600000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
341700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
341800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
341900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
342000000040 00 00 00 00
3421dnl
3422OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3423mpls,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
846e159a
SH
342400000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
342500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
342600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
342700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
342800000040 00 00 00 00
3429])
3430
3431dnl Modified MPLS controller action.
4dc94d7e 3432dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3433dnl before we push the MPLS and VLAN tags.
6409e008 3434AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3435
3436for i in 1 2 3; do
3437 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))'
3438done
62022172 3439OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3440OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3441
38b0b29f 3442AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3443OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3444mpls,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
846e159a
SH
344500000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
344600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
344700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
344800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3449dnl
3450OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3451mpls,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
846e159a
SH
345200000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
345300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
345400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
345500000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3456dnl
3457OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3458mpls,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
846e159a
SH
345900000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
346000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
346100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
346200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3463])
3464
3465dnl Modified MPLS controller action.
3466dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3467dnl actions are reordered, so we see both of these in the final flow.
6409e008 3468AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3469
3470for i in 1 2 3; do
3471 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)'
3472done
62022172 3473OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3474OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3475
38b0b29f 3476AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3477OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3478mpls,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
846e159a
SH
347900000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
348000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
348100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
348200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
348300000040 00 00 00 00
3484dnl
3485OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3486mpls,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
846e159a
SH
348700000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
348800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
348900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
349000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
349100000040 00 00 00 00
3492dnl
3493OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3494mpls,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
846e159a
SH
349500000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
349600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
349700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
349800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
349900000040 00 00 00 00
3500])
3501
3502dnl Modified MPLS controller action.
4dc94d7e 3503dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3504dnl before we push the MPLS and VLAN tags.
6409e008 3505AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3506
3507for i in 1 2 3; do
3508 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))'
3509done
62022172 3510OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 3511OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 3512
38b0b29f 3513AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3514OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3515mpls,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
846e159a
SH
351600000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
351700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
351800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
351900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3520dnl
3521OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3522mpls,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
846e159a
SH
352300000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
352400000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
352500000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
352600000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3527dnl
3528OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3529mpls,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
846e159a
SH
353000000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
353100000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
353200000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
353300000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3534])
3535
3536dnl Modified MPLS controller action.
3537dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3538dnl actions are reordered, so we see both of these in the final flow.
6409e008 3539AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3540
3541for i in 1 2 3; do
3542 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)'
3543done
62022172 3544OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3545OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3546
38b0b29f 3547AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3548OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3549mpls,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
846e159a
SH
355000000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
355100000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
355200000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
355300000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
355400000040 00 00 00 00
3555dnl
3556OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3557mpls,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
846e159a
SH
355800000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
355900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
356000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
356100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
356200000040 00 00 00 00
3563dnl
3564OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3565mpls,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
846e159a
SH
356600000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
356700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
356800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
356900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
357000000040 00 00 00 00
3571])
3572
3573dnl Modified MPLS controller action.
4dc94d7e 3574dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3575dnl before we push the MPLS and VLAN tags.
6409e008 3576AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3577
3578for i in 1 2 3; do
3579 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))'
3580done
62022172 3581OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3582OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3583
38b0b29f 3584AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3585OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3586mpls,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
846e159a
SH
358700000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
358800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
358900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
359000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3591dnl
3592OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3593mpls,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
846e159a
SH
359400000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
359500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
359600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
359700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3598dnl
3599OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3600mpls,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
846e159a
SH
360100000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
360200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
360300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
360400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3605])
3606
3607dnl Modified MPLS controller action.
4dc94d7e 3608dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3609dnl before we push the MPLS and VLAN tags.
6409e008 3610AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3611
3612for i in 1 2 3; do
3613 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))'
3614done
62022172 3615OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3616OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3617
38b0b29f 3618AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3619OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3620mpls,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
846e159a
SH
362100000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
362200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
362300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
362400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3625dnl
3626OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3627mpls,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
846e159a
SH
362800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
362900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
363000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
363100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3632dnl
3633OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3634mpls,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
846e159a
SH
363500000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
363600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
363700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
363800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3639])
3640
3641dnl Modified MPLS controller action.
4dc94d7e 3642dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 3643dnl before we push MPLS and VLAN tags.
6409e008 3644AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3645
3646for i in 1 2 3; do
3647 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))'
3648done
62022172 3649OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
846e159a
SH
3650ovs-appctl -t ovs-ofctl exit
3651
38b0b29f 3652AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3653OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3654mpls,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
846e159a
SH
365500000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
365600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
365700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
365800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3659dnl
3660OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3661mpls,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
846e159a
SH
366200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
366300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
366400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
366500000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3666dnl
3667OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3668mpls,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
846e159a
SH
366900000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
367000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
367100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
367200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3673])
3674
cea4a6d7 3675AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a
SH
3676AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3677 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
3678 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
3679 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
3680 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
3681 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
3682 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
3683 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
3684 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
3685 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
3686 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
3687OFPST_FLOW reply (OF1.2):
3688])
3689
3690OVS_VSWITCHD_STOP
3691AT_CLEANUP
3692
b8778a0d 3693AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 3694OVS_VSWITCHD_START
ca5792f0 3695add_of_ports br0 1 2 3 4 5 6 90
7257b535 3696AT_DATA([flows.txt], [dnl
12e4681c
JR
3697priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3698priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
12e4681c
JR
3699priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3700priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
b8778a0d 3701priority=50 tcp ip_frag=later actions=output:6
7257b535
BP
3702])
3703AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3704
a61680c6 3705base_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"
7257b535
BP
3706no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3707first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3708later_flow="$base_flow,frag=later)"
3709
3710 # mode no first later
3711for tuple in \
3712 'normal 1 5 6' \
3713 'drop 1 drop drop' \
3714 'nx-match 1 2 6'
3715do
3716 set $tuple
3717 mode=$1
3718 no=$2
3719 first=$3
3720 later=$4
3721
3722 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3723 for type in no first later; do
3724 eval flow=\$${type}_flow exp_output=\$$type
7fd51d39 3725 printf "\n%s\n" "----$mode $type-----"
50aa28fd 3726 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
3727 : > expout
3728 if test $mode = drop && test $type != no; then
3729 echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 3730 echo "Datapath actions: $exp_output" >> expout
b8778a0d 3731 elif test $type = later; then
12e4681c
JR
3732 echo "Datapath actions: $exp_output" >> expout
3733 else
3734 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
7fd51d39 3735 fi
7fd51d39 3736 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
3737 done
3738done
023e1e0a 3739OVS_VSWITCHD_STOP
7257b535 3740AT_CLEANUP
848e8809 3741
b8778a0d
JR
3742AT_SETUP([ofproto-dpif - fragment handling - upcall])
3743OVS_VSWITCHD_START
ca5792f0 3744add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
3745AT_DATA([flows.txt], [dnl
3746priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
3747priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
3748priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
3749priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
3750priority=50 tcp ip_frag=later actions=output:6
3751])
3752AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3753
3754base_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"
3755no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3756first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3757later_flow="$base_flow,frag=later)"
3758
3759AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3760
3761mode=normal
3762
3763AT_CHECK([ovs-ofctl set-frags br0 $mode])
3764for type in no first later; do
3765 eval flow=\$${type}_flow
3766 printf "\n%s\n" "----$mode $type-----"
3767
3768 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3769done
3770
3771AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3772flow-dump from non-dpdk interfaces:
b8778a0d
JR
3773recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3774recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),5
3775recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3776])
3777
3778mode=drop
3779
98bb4286 3780AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3781AT_CHECK([ovs-ofctl set-frags br0 $mode])
3782for type in no first later; do
3783 eval flow=\$${type}_flow
3784 printf "\n%s\n" "----$mode $type-----"
3785
3786 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3787done
3788
3789AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3790flow-dump from non-dpdk interfaces:
b8778a0d
JR
3791recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3792recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3793recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3794])
3795
3796mode=nx-match
3797
98bb4286 3798AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3799AT_CHECK([ovs-ofctl set-frags br0 $mode])
3800for type in no first later; do
3801 eval flow=\$${type}_flow
3802 printf "\n%s\n" "----$mode $type-----"
3803
3804 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3805done
3806
3807AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3808flow-dump from non-dpdk interfaces:
b8778a0d
JR
3809recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),1
3810recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(dst=80), packets:0, bytes:0, used:never, actions:set(tcp(dst=81)),2
3811recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3812])
3813
3814OVS_VSWITCHD_STOP
3815AT_CLEANUP
3816
3817AT_SETUP([ofproto-dpif - fragment handling - actions])
3818OVS_VSWITCHD_START
ca5792f0 3819add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
3820
3821AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_TCP_DST[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
3822AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3823source field tcp_dst lacks correct prerequisites
3824ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3825])
3826
3827AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 "tcp,ip_frag=later actions=move:OXM_OF_PKT_REG0[[0..7]]->OXM_OF_TCP_SRC[[0..7]],output:1"], [1], [], [stderr])
3828AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3829destination field tcp_src lacks correct prerequisites
3830ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3831])
3832
3833AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3834AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3835set_field udp_src lacks correct prerequisities
3836ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3837])
3838
3839AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3840AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3841set_field udp_dst lacks correct prerequisities
3842ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3843])
3844
3845AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3846AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3847set_field sctp_src lacks correct prerequisities
3848ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3849])
3850
3851AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3852AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3853set_field sctp_dst lacks correct prerequisities
3854ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3855])
3856
3857AT_CHECK([ovs-ofctl add-flow br0 "tcp,ip_frag=later actions=learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]],NXM_OF_TCP_SRC[[]]=NXM_OF_TCP_DST[[]],output:NXM_NX_REG0[[0..15]]),output:1"], [1], [], [stderr])
3858AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3859source field tcp_dst lacks correct prerequisites
3860ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3861])
3862
3863AT_DATA([flows.txt], [dnl
3864priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3865])
3866AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3867
3868AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3869
3870mode=normal
3871
3872AT_CHECK([ovs-ofctl set-frags br0 $mode])
3873for frag in 4000 6000 6008 4010; do
3874 printf "\n%s\n" "----$mode $frag-----"
3875
3876 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 003c 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016 751e267b 00000000 a002 16d0 1736 0000 02 04 05 b4 04 02 08 0a 2d 25 08 5f 00 00 00 00 01 03 03 07"])
3877done
3878
3879AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3880flow-dump from non-dpdk interfaces:
b8778a0d
JR
3881recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419), packets:0, bytes:0, used:never, actions:set(tcp(src=33322)),1
3882recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419), packets:0, bytes:0, used:never, actions:set(tcp(src=33322)),1
3883recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3884])
3885
98bb4286 3886AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3887AT_CHECK([ovs-ofctl set-frags br0 $mode])
3888for frag in 4000 6000 6008 4010; do
3889 printf "\n%s\n" "----$mode $frag truncated transport header -----"
3890
3891 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3892done
3893
3894AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3895flow-dump from non-dpdk interfaces:
b8778a0d
JR
3896recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3897recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3898recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3899])
3900
98bb4286 3901AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3902AT_CHECK([ovs-ofctl set-frags br0 $mode])
3903for frag in 4000 6000 6001 4002; do
3904 printf "\n%s\n" "----$mode $frag missing transport header-----"
3905
3906 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3907done
3908
3909AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3910flow-dump from non-dpdk interfaces:
b8778a0d
JR
3911recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3912recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0), packets:0, bytes:0, used:never, actions:set(tcp(src=42)),1
3913recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3914])
3915
3916OVS_VSWITCHD_STOP
3917AT_CLEANUP
3918
848e8809
EJ
3919AT_SETUP([ofproto-dpif - exit])
3920OVS_VSWITCHD_START
ca5792f0 3921add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
3922AT_DATA([flows.txt], [dnl
3923in_port=1 actions=output:10,exit,output:11
3924in_port=2 actions=output:12,resubmit:1,output:12
3925in_port=3 actions=output:13,resubmit:2,output:14
3926])
3927AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 3928AT_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])
848e8809
EJ
3929AT_CHECK([tail -1 stdout], [0],
3930 [Datapath actions: 10
3931])
50aa28fd 3932AT_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])
848e8809
EJ
3933AT_CHECK([tail -1 stdout], [0],
3934 [Datapath actions: 12,10
3935])
50aa28fd 3936AT_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])
848e8809
EJ
3937AT_CHECK([tail -1 stdout], [0],
3938 [Datapath actions: 13,12,10
3939])
3940OVS_VSWITCHD_STOP
3941AT_CLEANUP
c06bba01
JP
3942
3943
3944AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 3945AT_KEYWORDS([mirror mirrors mirroring])
432fca23 3946OVS_VSWITCHD_START
ca5792f0 3947add_of_ports br0 1 2 3
432fca23 3948ovs-vsctl \
c06bba01
JP
3949 set Bridge br0 mirrors=@m --\
3950 --id=@p3 get Port p3 --\
432fca23 3951 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 3952
c06bba01
JP
3953AT_DATA([flows.txt], [dnl
3954in_port=1 actions=output:2
3955in_port=2 actions=output:1
3956])
3957AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3958
247527db 3959flow="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)"
50aa28fd 3960AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3961AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 3962 [Datapath actions: 3,2
c06bba01
JP
3963])
3964
247527db 3965flow="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)"
50aa28fd 3966AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3967AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 3968 [Datapath actions: 3,1
c06bba01
JP
3969])
3970
3971OVS_VSWITCHD_STOP
3972AT_CLEANUP
3973
3974
3975AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 3976AT_KEYWORDS([mirror mirrors mirroring])
432fca23 3977OVS_VSWITCHD_START
ca5792f0 3978add_of_ports br0 1 2 3
432fca23 3979ovs-vsctl \
c06bba01
JP
3980 set Bridge br0 mirrors=@m --\
3981 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 3982 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 3983
c06bba01
JP
3984AT_DATA([flows.txt], [dnl
3985in_port=1 actions=output:2
3986in_port=2 actions=output:1
3987])
3988AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3989
247527db 3990flow="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)"
50aa28fd 3991AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3992AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 3993 [Datapath actions: 3,2
c06bba01
JP
3994])
3995
247527db 3996flow="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)"
50aa28fd 3997AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3998AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 3999 [Datapath actions: 1
c06bba01
JP
4000])
4001OVS_VSWITCHD_STOP
4002AT_CLEANUP
4003
33158a18 4004AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4005AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4006OVS_VSWITCHD_START
ca5792f0 4007add_of_ports br0 1 2
432fca23 4008ovs-vsctl \
33158a18
JP
4009 set Bridge br0 mirrors=@m --\
4010 --id=@p2 get Port p2 --\
432fca23 4011 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4012
33158a18
JP
4013AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4014
4015# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4016flow="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"
33158a18
JP
4017AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4018AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4019 [Datapath actions: 1,2
33158a18
JP
4020])
4021
4022OVS_VSWITCHD_STOP
4023AT_CLEANUP
4024
c06bba01
JP
4025
4026AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4027AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4028OVS_VSWITCHD_START
ca5792f0 4029add_of_ports br0 1 2 3
432fca23 4030ovs-vsctl \
c06bba01
JP
4031 set Bridge br0 mirrors=@m --\
4032 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4033 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4034
c06bba01
JP
4035AT_DATA([flows.txt], [dnl
4036in_port=1 actions=output:2
4037in_port=2 actions=output:1
4038])
4039AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4040
247527db 4041flow="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)"
50aa28fd 4042AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4043AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4044 [Datapath actions: 2,3
c06bba01
JP
4045])
4046
247527db 4047flow="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)"
50aa28fd 4048AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4049AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4050 [Datapath actions: 1
c06bba01
JP
4051])
4052
4053OVS_VSWITCHD_STOP
4054AT_CLEANUP
4055
4056
4057AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4058AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4059OVS_VSWITCHD_START
ca5792f0 4060add_of_ports br0 1 2 3
432fca23 4061ovs-vsctl \
c06bba01
JP
4062 set Bridge br0 mirrors=@m --\
4063 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4064 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4065
c06bba01
JP
4066AT_DATA([flows.txt], [dnl
4067in_port=1, actions=output:2
4068])
4069AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4070
247527db 4071flow="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)"
50aa28fd 4072AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4073AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4074 [Datapath actions: 2
c06bba01
JP
4075])
4076
247527db 4077flow="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))"
50aa28fd 4078AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4079AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4080 [Datapath actions: 2
c06bba01
JP
4081])
4082
247527db 4083flow="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))"
50aa28fd 4084AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4085AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4086 [Datapath actions: 3,2
c06bba01
JP
4087])
4088
4089OVS_VSWITCHD_STOP
4090AT_CLEANUP
4091
4092
4093AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4094AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4095OVS_VSWITCHD_START
ca5792f0 4096add_of_ports br0 1 2 3
432fca23 4097ovs-vsctl \
c06bba01
JP
4098 set Bridge br0 mirrors=@m --\
4099 --id=@p3 get Port p3 --\
432fca23 4100 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4101
c06bba01
JP
4102AT_DATA([flows.txt], [dnl
4103in_port=1 actions=mod_vlan_vid:17,output:2
4104in_port=2 actions=output:1
4105])
4106AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4107
247527db 4108flow="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)"
50aa28fd 4109AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4110AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4111 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4112])
4113
247527db 4114flow="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)"
50aa28fd 4115AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4116AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4117 [Datapath actions: 3,1
c06bba01
JP
4118])
4119
4120OVS_VSWITCHD_STOP
4121AT_CLEANUP
4122
c06bba01 4123AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4124AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4125OVS_VSWITCHD_START
ca5792f0 4126add_of_ports br0 1 2
432fca23 4127ovs-vsctl \
c06bba01 4128 set Bridge br0 mirrors=@m --\
432fca23 4129 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 4130
c06bba01
JP
4131AT_DATA([flows.txt], [dnl
4132in_port=1 actions=output:2
4133in_port=2 actions=mod_vlan_vid:17,output:1
4134])
4135AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4136
247527db 4137flow="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)"
50aa28fd 4138AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4139actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4140
e44768b7 4141expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4142AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4143mv stdout expout
247527db 4144AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 4145
247527db 4146flow="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)"
50aa28fd 4147AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4148actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4149
e44768b7 4150expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4151AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4152mv stdout expout
247527db 4153AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
4154
4155OVS_VSWITCHD_STOP
4156AT_CLEANUP
b44a10b7 4157
faa624b4
BP
4158# This verifies that we don't get duplicate mirroring when mirror_packet()
4159# might be invoked recursively, as a check against regression.
4160AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 4161AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
4162OVS_VSWITCHD_START
4163add_of_ports br0 1 2 3
4164ovs-vsctl \
4165 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4166 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4167 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4168 -- set Port br0 tag=0 \
4169 -- set Port p1 tag=0 \
4170 -- set Port p2 tag=500 \
4171 -- set Port p3 tag=501
4172
4173flow='in_port=1'
4174AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4175AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4176s/,/\
4177/g' | sort], [0], [100
41782
41793
4180])
4181
4182OVS_VSWITCHD_STOP
4183AT_CLEANUP
4184
29bae541
BP
4185# This test verifies that mirror state is preserved across recirculation.
4186#
4187# Otherwise, post-recirculation the ingress and the output to port 4
4188# would cause the packet to be mirrored to port 3 a second time.
4189AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 4190AT_KEYWORDS([mirror mirrors mirroring])
29bae541 4191OVS_VSWITCHD_START
ca5792f0 4192add_of_ports br0 1 2 3 4
29bae541
BP
4193ovs-vsctl \
4194 set Bridge br0 mirrors=@m --\
4195 --id=@p3 get Port p3 --\
4196 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4197
4198AT_DATA([flows.txt], [dnl
4199in_port=1 actions=2,debug_recirc,4
4200])
4201AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4202
4203flow="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)"
4204AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4205AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4206])
4207AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4208AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4209])
4210
4211OVS_VSWITCHD_STOP
4212AT_CLEANUP
4213
83a31283
BP
4214# This test verifies that the table ID is preserved across recirculation
4215# when a resubmit action requires it (because the action is relative to
4216# the current table rather than specifying a table).
4217AT_SETUP([ofproto-dpif - resubmit with recirculation])
4218OVS_VSWITCHD_START
ca5792f0 4219add_of_ports br0 1 2 3
83a31283
BP
4220
4221AT_DATA([flows.txt], [dnl
4222table=0 in_port=1 actions=2,resubmit(,1)
4223table=1 in_port=1 actions=debug_recirc,resubmit:55
4224table=1 in_port=55 actions=3
4225])
4226AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4227
4228flow="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)"
4229AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4230AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4231])
4232AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4233AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4234])
4235
4236OVS_VSWITCHD_STOP
4237AT_CLEANUP
4238
6b1c5734
BP
4239# This test verifies that "resubmit", when it triggers recirculation
4240# indirectly through the flow that it recursively invokes, is not
4241# re-executed when execution continues later post-recirculation.
4242AT_SETUP([ofproto-dpif - recirculation after resubmit])
4243OVS_VSWITCHD_START
ca5792f0 4244add_of_ports br0 1 2
6b1c5734
BP
4245
4246AT_DATA([flows.txt], [dnl
4247table=0 in_port=1 actions=resubmit(,1),2
4248table=1 in_port=1 actions=debug_recirc
4249])
4250AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4251
4252flow="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)"
4253AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4254AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4255])
4256AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4257AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4258])
4259
4260OVS_VSWITCHD_STOP
4261AT_CLEANUP
4262
77ab5fd2
BP
4263dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4264dnl
4265dnl Checks the implementation of the continuation mechanism that allows the
4266dnl packet processing pipeline to be paused and resumed. Starts by creating
4267dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4268dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4269dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4270dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4271dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4272dnl and repeats the process.
4273dnl
4274dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4275dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4276dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4277dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4278dnl by EXTRA_SETUP) jumps from one bridge to another.
4279dnl
4280dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4281dnl both bridges, e.g. to configure mirrors or patch ports.
4282m4_define([CHECK_CONTINUATION], [dnl
4283 AT_SETUP([ofproto-dpif - continuation - $1])
4284 AT_KEYWORDS([continuations pause resume])
4285 OVS_VSWITCHD_START
4286
4287 # count_matches STRING
4288 #
4289 # Prints on stdout the number of occurrences of STRING in stdin.
4290 count_matches () {
4291 sed -n ":start
4292 s/$[1]//p
4293 t start" | wc -l
4294 }
4295
4296 add_of_ports --pcap br0 `seq 1 $2`
4297 m4_if([$3], [0], [],
4298 [add_of_br 1
4299 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4300
4301 AT_CAPTURE_FILE([ofctl_monitor0.log])
4302 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4303 m4_if([$3], [0], [],
4304 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4305 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4306
4307 actions0='$4'
4308 actions1='$5'
4309 $6
4310 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)"
4311 n_packets=0
4312 n_resumes=0
4313 while true; do
4314 printf "\n\nactions for br0:\n%s\n" "$actions0"
4315 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4316
4317 # Add flows.
4318 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4319 m4_if([$3], [0], [],
4320 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4321
4322 # Run a packet through the switch.
4323 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4324
4325 # Wait for the expected number of packets to show up.
4326 n_packets=`expr $n_packets + $2 - 1 + $3`
4327 echo "waiting for $n_packets packets..."
4328 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4329
4330 # Wait for the expected number of NXT_RESUMEs to be logged.
4331 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4332 echo "waiting for $n_resumes NXT_RESUMEs..."
4333 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4334
4335 # Eliminate one "pause" from the actions.
4336 #
4337 # If there were none left, then we're done.
4338 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4339 if test X"$actions0" = X"$next_actions0"; then
4340 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4341 if test X"$actions1" = X"$next_actions1"; then
4342 break
4343 else
4344 actions1=$next_actions1
4345 fi
4346 else
4347 actions0=$next_actions0
4348 fi
4349
4350 # Delete all the flows and verify that there are none, so that we
4351 # can be sure that our updated flow tables is actually in use
4352 # later.
4353 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4354 [NXST_FLOW reply:
4355])
4356 m4_if([$3], [0], [],
4357 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4358 [NXST_FLOW reply:
4359])])
4360 done
4361 OVS_VSWITCHD_STOP
4362 AT_CLEANUP
4363])
4364
4365# Check that pause at the end of the pipeline works OK.
4366#
4367# (xlate_continuation() has a special case for no-op actions; this
4368# fails without that special case.)
4369CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4370
4371# Check that remaining actions are preserved following resume.
4372CHECK_CONTINUATION([actions], [7], [0],
4373 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4374
4375# Check that multiple levels of resubmit continue following resume.
4376#
4377# The "resubmit:55", which is relative to the current table, is
4378# particularly interesting because it checks that the notion of the
4379# current table is correctly preserved.
4380CHECK_CONTINUATION([resubmit], [10], [0],
4381 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4382 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4383 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4384 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4385 table=3 in_port=55 actions=pause 6 pause])
4386
4387# Check that the action set is preserved across pause/resume.
4388CHECK_CONTINUATION([action set], [3], [0],
4389 [in_port=1 actions=1 pause resubmit(,1) pause 2
4390 table=1 actions=write_actions(3)])
4391
4392# Check that metadata and the stack used by push and pop is preserved
4393# across pause/resume.
4394CHECK_CONTINUATION([data stack], [3], [0],
4395 [in_port=1 actions=pause dnl
4396 set_field:1->reg0 dnl
4397 pause dnl
4398 set_field:2->reg1 dnl
4399 pause dnl
4400 output:NXM_NX_REG0[[]] dnl
4401 pause dnl
4402 push:NXM_NX_REG1[[]] dnl
4403 dnl
4404 pop:NXM_NX_REG2[[]] dnl
4405 pause dnl
4406 output:NXM_NX_REG2[[]] dnl
4407 pause dnl
4408 3])
4409
4410# Check that mirror output occurs once and once only, even if
4411# separated by pause/resume.
4412CHECK_CONTINUATION([mirroring], [5], [0],
4413 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4414 [ovs-vsctl \
4415 set Bridge br0 mirrors=@m --\
4416 --id=@p2 get Port p2 --\
4417 --id=@p3 get Port p3 --\
4418 --id=@p4 get Port p4 --\
4419 --id=@p5 get Port p5 --\
4420 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4421
4422# Check that pause works in the presence of patch ports.
4423CHECK_CONTINUATION([patch ports], [4], [1],
4424 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4425 table=1 in_port=1 actions=pause 3 pause 10 pause],
4426 [table=0 in_port=11 actions=pause 5 pause],
4427 [ovs-vsctl \
4428 -- add-port br0 patch10 \
4429 -- set interface patch10 type=patch options:peer=patch11 \
4430 ofport_request=10 \
4431 -- add-port br1 patch11 \
4432 -- set interface patch11 type=patch options:peer=patch10 \
4433 ofport_request=11])
4434
22bb3cbc
AW
4435# Two testcases below are for the ofproto/trace command
4436# The first one tests all correct syntax:
4437# ofproto/trace [dp_name] odp_flow [-generate|packet]
4438# ofproto/trace br_name br_flow [-generate|packet]
4439AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4440OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 4441add_of_ports br0 1 2 3
22bb3cbc
AW
4442
4443AT_DATA([flows.txt], [dnl
4444in_port=1 actions=output:2
4445in_port=2 actions=output:1
4446])
4447AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4448
e063a73a 4449odp_flow="in_port(p1)"
22bb3cbc 4450br_flow="in_port=1"
0a37839c
GS
4451# Test command: ofproto/trace odp_flow with in_port as a name.
4452AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4453AT_CHECK([tail -1 stdout], [0], [dnl
4454Datapath actions: 2
4455])
4456
4457odp_flow="in_port(1)"
22bb3cbc
AW
4458# Test command: ofproto/trace odp_flow
4459AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4460AT_CHECK([tail -1 stdout], [0], [dnl
4461Datapath actions: 2
4462])
4463
4464# Test command: ofproto/trace dp_name odp_flow
4465AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4466AT_CHECK([tail -1 stdout], [0], [dnl
4467Datapath actions: 2
4468])
4469# Test commmand: ofproto/trace br_name br_flow
4470AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4471AT_CHECK([tail -1 stdout], [0], [dnl
4472Datapath actions: 2
4473])
4474
4475# Delete the inserted flows
4476AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4477AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4478
78c9486d 4479# This section below tests the [-generate] option
22bb3cbc 4480odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 4481br_flow="arp,in_port=3,vlan_tci=0x0000,dl_src=50:54:00:00:00:05,dl_dst=ff:ff:ff:ff:ff:ff"
22bb3cbc
AW
4482
4483# Test command: ofproto/trace odp_flow
4484AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4485# Check for no MAC learning entry
4486AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4487 port VLAN MAC Age
4488])
4489
4490# Test command: ofproto/trace br_name br_flow
4491AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4492# Check for no MAC learning entry
4493AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4494 port VLAN MAC Age
4495])
4496
4497# Test command: ofproto/trace odp_flow -generate
4498AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4499# Check for the MAC learning entry
4500AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4501 port VLAN MAC Age
4502 3 0 50:54:00:00:00:05 ?
4503])
4504
4505# Test command: ofproto/trace dp_name odp_flow -generate
4506AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4507 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4508 -generate], [0], [stdout])
4509# Check for both MAC learning entries
4510AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4511 port VLAN MAC Age
4512 3 0 50:54:00:00:00:05 ?
4513 1 0 50:54:00:00:00:06 ?
4514])
4515
4516# Test command: ofproto/trace br_name br_flow -generate
4517AT_CHECK([ovs-appctl ofproto/trace br0 \
4518 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4519 -generate], [0], [stdout])
4520# Check for both MAC learning entries.
4521AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4522 port VLAN MAC Age
4523 3 0 50:54:00:00:00:05 ?
4524 1 0 50:54:00:00:00:06 ?
4525 2 0 50:54:00:00:00:07 ?
4526])
4527
4528# This section beflow tests the [packet] option
4529# The ovs-tcpundump of packets between port1 and port2
4530pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4531pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4532
4533# Construct the MAC learning table
4534AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4535 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4536 -generate], [0], [stdout])
4537
4538# Construct the MAC learning table
4539AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4540 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4541 -generate], [0], [stdout])
4542
4543# Test command: ofproto/trace odp_flow packet
4544AT_CHECK([ovs-appctl ofproto/trace \
4545 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4546AT_CHECK([tail -1 stdout], [0], [dnl
4547Datapath actions: 2
4548])
b6f00895 4549AT_CHECK([head -n 2 stdout], [0], [dnl
22bb3cbc 4550Bridge: br0
78c9486d 4551Flow: pkt_mark=0x2,skb_priority=0x1,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
22bb3cbc
AW
4552])
4553
4554# Test command: ofproto/trace dp_name odp_flow packet
4555AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4556 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4557AT_CHECK([tail -1 stdout], [0], [dnl
4558Datapath actions: 2
4559])
b6f00895 4560AT_CHECK([head -n 2 stdout], [0], [dnl
22bb3cbc 4561Bridge: br0
78c9486d 4562Flow: pkt_mark=0x2,skb_priority=0x1,arp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
22bb3cbc
AW
4563])
4564
4565# Test command: ofproto/trace br_name br_flow packet
4566AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 4567 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 4568AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 4569Datapath actions: 1
22bb3cbc
AW
4570])
4571AT_CHECK([head -n 2 stdout], [0], [dnl
b6f00895 4572Bridge: br0
78c9486d 4573Flow: pkt_mark=0x1,skb_priority=0x2,arp,in_port=2,vlan_tci=0x0000,dl_src=50:54:00:00:00:02,dl_dst=50:54:00:00:00:01,arp_spa=0.0.0.0,arp_tpa=0.0.0.0,arp_op=0,arp_sha=00:00:00:00:00:00,arp_tha=00:00:00:00:00:00
22bb3cbc
AW
4574])
4575
4576OVS_VSWITCHD_STOP
4577AT_CLEANUP
4578
4579# The second test tests the corner cases
4580AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4581OVS_VSWITCHD_START
ca5792f0 4582add_of_ports br0 1 2
22bb3cbc
AW
4583
4584# Define flows
4585odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4586br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4587# Define options
4588generate="-generate"
4589pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4590
4591# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4592m4_foreach(
4593[option],
4594[[],
4595["$generate"],
4596["$pkt"]],
4597[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$odp_flow" option],
4598 [2], [], [stderr])
4599AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 4600Cannot find the datapath
22bb3cbc
AW
4601ovs-appctl: ovs-vswitchd: server returned an error
4602])])
4603
4604# Test incorrect command: ofproto/trace empty_string odp_flow [-generate|packet]
4605m4_foreach(
4606[option],
4607[[],
4608["$generate"],
4609["$pkt"]],
4610[AT_CHECK([ovs-appctl ofproto/trace "" "$odp_flow" option],
4611 [2], [], [stderr])
4612AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 4613Cannot find the datapath
22bb3cbc
AW
4614ovs-appctl: ovs-vswitchd: server returned an error
4615])])
4616
4617# Test incorrect command: ofproto/trace nonexist_dp_name odp_flow [-generate|packet]
4618m4_foreach(
4619[option],
4620[[],
4621["$generate"],
4622["$pkt"]],
4623[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$odp_flow" option],
4624 [2], [], [stderr])
4625AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 4626Cannot find the datapath
22bb3cbc
AW
4627ovs-appctl: ovs-vswitchd: server returned an error
4628])])
4629
4630# Test incorrect command: ofproto/trace br_name odp_flow [-generate|packet]
4631m4_foreach(
4632[option],
4633[[],
4634["$generate"],
4635["$pkt"]],
4636[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4637 [2], [], [stderr])
4638AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 4639Cannot find the datapath
22bb3cbc
AW
4640ovs-appctl: ovs-vswitchd: server returned an error
4641])])
4642
4643# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4644m4_foreach(
4645[option],
4646[[],
4647["$generate"],
4648["$pkt"]],
4649[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4650 [2], [], [stderr])
4651AT_CHECK([tail -2 stderr], [0], [dnl
4652Unknown bridge name
4653ovs-appctl: ovs-vswitchd: server returned an error
4654])])
4655
4656# Test incorrect command: ofproto/trace br_flow [-generate|packet]
4657m4_foreach(
4658[option],
4659[[],
4660["$generate"],
4661["$pkt"]],
4662[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4663 [2], [], [stderr])
4664AT_CHECK([tail -2 stderr], [0], [dnl
4665Must specify bridge name
4666ovs-appctl: ovs-vswitchd: server returned an error
4667])])
4668
4669# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4670AT_CHECK([ovs-appctl ofproto/trace \
4671 ovs-dummy "$odp_flow" garbage_option],
4672 [2], [stdout],[stderr])
4673AT_CHECK([tail -2 stderr], [0], [dnl
4674Trailing garbage in packet data
4675ovs-appctl: ovs-vswitchd: server returned an error
4676])
4677
4678# Test incorrect command: ofproto/trace with 4 arguments
4679AT_CHECK([ovs-appctl ofproto/trace \
4680 arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4681AT_CHECK([tail -2 stderr], [0], [dnl
4682"ofproto/trace" command takes at most 3 arguments
4683ovs-appctl: ovs-vswitchd: server returned an error
4684])
4685
4686# Test incorrect command: ofproto/trace with 0 argument
4687AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4688AT_CHECK([tail -2 stderr], [0], [dnl
4689"ofproto/trace" command requires at least 1 arguments
4690ovs-appctl: ovs-vswitchd: server returned an error
4691])
4692
4693OVS_VSWITCHD_STOP
4694AT_CLEANUP
4695
b6ec827f
JS
4696# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
4697AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
4698OVS_VSWITCHD_START([dnl
4699 set Open_vSwitch . other_config:max-idle=10000 \
4700 -- add-port br0 p1 -- set Interface p1 type=dummy])
4701
4702AT_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)'])
4703ovs-appctl revalidator/wait
4704AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
4705
4706odp_flow=`cat dp_flows1.txt`
4707AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4708Bridge: br0
4709Flow: <cleared>
4710No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4711
4712Rule: table=254 cookie=0 priority=0,reg0=0x2
4713OpenFlow actions=drop
4714
4715Final flow: <cleared>
4716Megaflow: <cleared>
4717Datapath actions: drop
4718])
4719
4720dnl Now, try again without megaflows:
4721ovs-appctl upcall/disable-megaflows
4722
4723AT_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)'])
4724ovs-appctl revalidator/wait
4725AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
4726
4727odp_flow=`cat dp_flows2.txt`
4728AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4729Bridge: br0
4730Flow: <cleared>
4731No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4732
4733Rule: table=254 cookie=0 priority=0,reg0=0x2
4734OpenFlow actions=drop
4735
4736Final flow: <cleared>
4737Megaflow: <cleared>
4738Datapath actions: drop
4739])
4740
4741OVS_VSWITCHD_STOP
4742AT_CLEANUP
4743
aee0979b
BP
4744AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
4745OVS_VSWITCHD_START
ca5792f0 4746add_of_ports br0 1 2 3
aee0979b
BP
4747
4748AT_DATA([flows.txt], [dnl
4749in_port=1 actions=output:2
4750in_port=2 actions=output:1
4751])
4752AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4753
4754AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
4755AT_CHECK([tail -1 stdout], [0], [dnl
4756Datapath actions: push_vlan(vid=123,pcp=0),2
4757])
4758
4759OVS_VSWITCHD_STOP
4760AT_CLEANUP
4761
4762
b44a10b7
BP
4763m4_define([OFPROTO_TRACE],
4764 [flow="$2"
4765 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
4766 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4767 expected="$4"
4768 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
4769 [0], [stdout])
4770 mv stdout expout
4771 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
4772 [0], [expout])])
4773
4774AT_SETUP([ofproto-dpif - MAC learning])
432fca23 4775OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 4776add_of_ports br0 1 2 3
b44a10b7 4777
b44a10b7
BP
4778arp='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)'
4779
4780# Trace an ARP packet arriving on p3, to create a MAC learning entry.
4781OFPROTO_TRACE(
50aa28fd 4782 [ovs-dummy],
247527db 4783 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4784 [-generate],
e44768b7 4785 [1,2,100])
b44a10b7
BP
4786
4787# Check for the MAC learning entry.
83664f72 4788AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4789 port VLAN MAC Age
247527db 4790 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
4791])
4792
4793# Trace a packet arrival destined for the learned MAC.
4794# (This will also learn a MAC.)
4795OFPROTO_TRACE(
50aa28fd 4796 [ovs-dummy],
247527db 4797 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 4798 [-generate],
247527db 4799 [3])
b44a10b7
BP
4800
4801# Check for both MAC learning entries.
83664f72 4802AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4803 port VLAN MAC Age
247527db
BP
4804 3 0 50:54:00:00:00:05 ?
4805 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
4806])
4807
4808# Trace a packet arrival that updates the first learned MAC entry.
4809OFPROTO_TRACE(
50aa28fd 4810 [ovs-dummy],
247527db 4811 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4812 [-generate],
e44768b7 4813 [1,3,100])
b44a10b7
BP
4814
4815# Check that the MAC learning entry was updated.
83664f72 4816AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4817 port VLAN MAC Age
247527db
BP
4818 1 0 50:54:00:00:00:06 ?
4819 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
4820])
4821
4822# Add another bridge.
4823AT_CHECK(
4824 [ovs-vsctl \
4825 -- add-br br1 \
ad28062f 4826 -- set bridge br1 datapath-type=dummy])
ca5792f0 4827add_of_ports br1 4 5
b44a10b7
BP
4828
4829# Trace some packet arrivals in br1 to create MAC learning entries there too.
4830OFPROTO_TRACE(
50aa28fd 4831 [ovs-dummy],
247527db 4832 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4833 [-generate],
e44768b7 4834 [5,101])
b44a10b7 4835OFPROTO_TRACE(
50aa28fd 4836 [ovs-dummy],
247527db 4837 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4838 [-generate],
e44768b7 4839 [4,101])
b44a10b7
BP
4840
4841# Check that the MAC learning entries were added.
83664f72 4842AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4843 port VLAN MAC Age
247527db
BP
4844 4 0 50:54:00:00:00:06 ?
4845 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
4846])
4847
4848# Delete port p1 and see that its MAC learning entry disappeared, and
4849# that the MAC learning entry for the same MAC was also deleted from br1.
4850AT_CHECK([ovs-vsctl del-port p1])
83664f72 4851AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4852 port VLAN MAC Age
247527db 4853 2 0 50:54:00:00:00:05 ?
b44a10b7 4854])
83664f72 4855AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4856 port VLAN MAC Age
247527db 4857 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
4858])
4859
4860OVS_VSWITCHD_STOP
4861AT_CLEANUP
17f7f7e0 4862
c4069512
BP
4863AT_SETUP([ofproto-dpif - MAC table overflow])
4864OVS_VSWITCHD_START(
ad28062f 4865 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 4866add_of_ports br0 1 2 3
c4069512
BP
4867
4868arp='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)'
4869
4870AT_CHECK([ovs-appctl time/stop])
4871
4872# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
4873for i in 0 1 2 3 4 5 6 7 8 9; do
4874 OFPROTO_TRACE(
50aa28fd 4875 [ovs-dummy],
c4069512
BP
4876 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
4877 [-generate],
4878 [1,2,100])
4879 ovs-appctl time/warp 1000
4880done
4881
4882# Check for the MAC learning entries.
4883AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4884 [0], [dnl
4885 3 0 50:54:00:00:00:00
4886 3 0 50:54:00:00:00:01
4887 3 0 50:54:00:00:00:02
4888 3 0 50:54:00:00:00:03
4889 3 0 50:54:00:00:00:04
4890 3 0 50:54:00:00:00:05
4891 3 0 50:54:00:00:00:06
4892 3 0 50:54:00:00:00:07
4893 3 0 50:54:00:00:00:08
4894 3 0 50:54:00:00:00:09
4895 port VLAN MAC Age
4896])
4897
4898# Trace another ARP packet on another MAC.
4899OFPROTO_TRACE(
50aa28fd 4900 [ovs-dummy],
c4069512
BP
4901 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
4902 [-generate],
4903 [1,2,100])
4904
4905# Check that the new one chased the oldest one out of the table.
4906AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
4907 [0], [dnl
4908 3 0 50:54:00:00:00:01 ?
4909 3 0 50:54:00:00:00:02 ?
4910 3 0 50:54:00:00:00:03 ?
4911 3 0 50:54:00:00:00:04 ?
4912 3 0 50:54:00:00:00:05 ?
4913 3 0 50:54:00:00:00:06 ?
4914 3 0 50:54:00:00:00:07 ?
4915 3 0 50:54:00:00:00:08 ?
4916 3 0 50:54:00:00:00:09 ?
4917 3 0 50:54:00:00:00:10 ?
4918 port VLAN MAC Age
4919])
4920OVS_VSWITCHD_STOP
4921AT_CLEANUP
4922
9d078ec2
BP
4923AT_SETUP([ofproto-dpif - MAC table overflow fairness])
4924OVS_VSWITCHD_START(
4925 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 4926add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
4927
4928arp='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)'
4929
4930AT_CHECK([ovs-appctl time/stop])
4931
4932# Trace packets with 2 different source MACs arriving on each of the 5
4933# ports, filling up the 10-entry learning table.
4934for i in 0 1 2 3 4 5 6 7 8 9; do
4935 p=`expr $i / 2 + 1`
4936 ovs-appctl ofproto/trace ovs-dummy "in_port($p),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
4937 ovs-appctl time/warp 1000
4938done
4939
4940# Check for the MAC learning entries.
4941AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4942 [0], [dnl
4943 1 0 50:54:00:00:00:00
4944 1 0 50:54:00:00:00:01
4945 2 0 50:54:00:00:00:02
4946 2 0 50:54:00:00:00:03
4947 3 0 50:54:00:00:00:04
4948 3 0 50:54:00:00:00:05
4949 4 0 50:54:00:00:00:06
4950 4 0 50:54:00:00:00:07
4951 5 0 50:54:00:00:00:08
4952 5 0 50:54:00:00:00:09
4953 port VLAN MAC Age
4954])
4955
4956# Now trace 16 new MACs on another port.
4957for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
4958 ovs-appctl ofproto/trace ovs-dummy "in_port(6),eth(src=50:54:00:00:0$i:ff,dst=ff:ff:ff:ff:ff:ff),$arp" -generate
4959 ovs-appctl time/warp 1000
4960done
4961
4962# Check the results.
4963#
4964# Our eviction algorithm on overflow is that an arbitrary (but deterministic)
4965# one of the ports with the most learned MACs loses the least recently used
4966# one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
4967# MAC each, and the other 2 of the old ports with 2 MACs each.
4968#
4969# (If someone changes lib/heap.c to do something different with equal-priority
4970# nodes, then the output below could change, but it would still follow the
4971# rules explained above.)
4972AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4973 [0], [dnl
4974 1 0 50:54:00:00:00:01
4975 2 0 50:54:00:00:00:03
4976 3 0 50:54:00:00:00:04
4977 3 0 50:54:00:00:00:05
4978 4 0 50:54:00:00:00:07
4979 5 0 50:54:00:00:00:08
4980 5 0 50:54:00:00:00:09
4981 6 0 50:54:00:00:0d:ff
4982 6 0 50:54:00:00:0e:ff
4983 6 0 50:54:00:00:0f:ff
4984 port VLAN MAC Age
4985])
4986OVS_VSWITCHD_STOP
4987AT_CLEANUP
4988
4819b3a5 4989# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
4990#
4991# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 4992m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 4993 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
4994 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
4995
53eb8cb8 4996 on_exit 'kill `cat test-sflow.pid`'
eadd1644 4997 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 4998 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 4999 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
5000 ovs-appctl time/stop
5001
ca5792f0 5002 add_of_ports br0 1 2
e731d71b
AS
5003 ovs-vsctl \
5004 set Interface br0 options:ifindex=1002 -- \
5005 set Interface p1 options:ifindex=1004 -- \
5006 set Interface p2 options:ifindex=1003 -- \
5007 set Bridge br0 sflow=@sf -- \
5008 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
9a9808d7 5009 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
5010
5011 dnl open with ARP packets to seed the bridge-learning. The output
5012 dnl ifIndex numbers should be reported predictably after that.
5013 dnl Since we set sampling=1 we should see all of these packets
5014 dnl reported. Sorting the output by data-source and seqNo makes
5015 dnl it deterministic. Ensuring that we send at least two packets
5016 dnl into each port means we get to check the seq nos are
5017 dnl incrementing correctly.
5018 dnl because packets from different ports can be handled by separate
5019 dnl threads, put some sleeps
5020
5021 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)'
5022 sleep 1
5023 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)'
5024 sleep 1
5025 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)'
5026 sleep 1
5027 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)'
5028 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)'
5029
5030 dnl sleep long enough to get more than one counter sample
5031 dnl from each datasource so we can check sequence numbers
bdba1947 5032 ovs-appctl time/warp 3000 100
e731d71b
AS
5033 OVS_VSWITCHD_STOP
5034 ovs-appctl -t test-sflow exit
8073dd31 5035
e731d71b 5036 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
8073dd31
NM
5037 /g']], [0], [dnl
5038HEADER
5039 dgramSeqNo=1
743cea45 5040 ds=127.0.0.1>2:1000
8073dd31
NM
5041 fsSeqNo=1
5042 in_vlan=0
5043 in_priority=0
5044 out_vlan=0
5045 out_priority=0
5046 meanSkip=1
5047 samplePool=1
5048 dropEvents=0
743cea45 5049 in_ifindex=1004
8073dd31
NM
5050 in_format=0
5051 out_ifindex=2
5052 out_format=2
5053 hdr_prot=1
5054 pkt_len=64
5055 stripped=4
5056 hdr_len=60
743cea45 5057 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
8073dd31
NM
5058HEADER
5059 dgramSeqNo=1
743cea45 5060 ds=127.0.0.1>2:1000
8073dd31
NM
5061 fsSeqNo=2
5062 in_vlan=0
5063 in_priority=0
5064 out_vlan=0
5065 out_priority=0
5066 meanSkip=1
5067 samplePool=2
5068 dropEvents=0
5069 in_ifindex=1003
5070 in_format=0
743cea45
NM
5071 out_ifindex=2
5072 out_format=2
8073dd31
NM
5073 hdr_prot=1
5074 pkt_len=64
5075 stripped=4
5076 hdr_len=60
743cea45 5077 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
8073dd31
NM
5078HEADER
5079 dgramSeqNo=1
743cea45 5080 ds=127.0.0.1>2:1000
8073dd31
NM
5081 fsSeqNo=3
5082 in_vlan=0
5083 in_priority=0
5084 out_vlan=0
5085 out_priority=0
5086 meanSkip=1
5087 samplePool=3
5088 dropEvents=0
743cea45 5089 in_ifindex=1004
8073dd31 5090 in_format=0
743cea45 5091 out_ifindex=1003
8073dd31
NM
5092 out_format=0
5093 hdr_prot=1
5094 pkt_len=64
5095 stripped=4
5096 hdr_len=60
743cea45 5097 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
8073dd31
NM
5098HEADER
5099 dgramSeqNo=1
743cea45
NM
5100 ds=127.0.0.1>2:1000
5101 fsSeqNo=4
8073dd31
NM
5102 in_vlan=0
5103 in_priority=0
5104 out_vlan=0
5105 out_priority=0
5106 meanSkip=1
743cea45 5107 samplePool=4
8073dd31 5108 dropEvents=0
743cea45 5109 in_ifindex=1003
8073dd31 5110 in_format=0
743cea45
NM
5111 out_ifindex=1004
5112 out_format=0
8073dd31
NM
5113 hdr_prot=1
5114 pkt_len=64
5115 stripped=4
5116 hdr_len=60
743cea45 5117 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
8073dd31
NM
5118HEADER
5119 dgramSeqNo=1
743cea45
NM
5120 ds=127.0.0.1>2:1000
5121 fsSeqNo=5
8073dd31
NM
5122 in_vlan=0
5123 in_priority=0
5124 out_vlan=0
5125 out_priority=0
5126 meanSkip=1
743cea45 5127 samplePool=5
8073dd31 5128 dropEvents=0
743cea45 5129 in_ifindex=1003
8073dd31 5130 in_format=0
743cea45 5131 out_ifindex=1004
8073dd31
NM
5132 out_format=0
5133 hdr_prot=1
5134 pkt_len=64
5135 stripped=4
5136 hdr_len=60
52105b67 5137 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
8073dd31
NM
5138])
5139
50b9699f 5140 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
8073dd31
NM
5141 /g']], [0], [dnl
5142IFCOUNTERS
5143 dgramSeqNo=2
5144 ds=127.0.0.1>0:1002
5145 csSeqNo=1
5146 ifindex=1002
5147 type=6
5148 ifspeed=100000000
5149 direction=0
1839c356 5150 status=0
8073dd31
NM
5151 in_octets=0
5152 in_unicasts=0
5153 in_multicasts=0
5154 in_broadcasts=4294967295
5155 in_discards=0
5156 in_errors=0
5157 in_unknownprotos=4294967295
5158 out_octets=120
5159 out_unicasts=2
5160 out_multicasts=4294967295
5161 out_broadcasts=4294967295
5162 out_discards=0
5163 out_errors=0
5164 promiscuous=0
5165IFCOUNTERS
5166 dgramSeqNo=2
5167 ds=127.0.0.1>0:1003
5168 csSeqNo=1
5169 ifindex=1003
5170 type=6
5171 ifspeed=100000000
5172 direction=0
5173 status=0
52105b67 5174 in_octets=138
8073dd31
NM
5175 in_unicasts=3
5176 in_multicasts=0
5177 in_broadcasts=4294967295
5178 in_discards=0
5179 in_errors=0
5180 in_unknownprotos=4294967295
5181 out_octets=120
5182 out_unicasts=2
5183 out_multicasts=4294967295
5184 out_broadcasts=4294967295
5185 out_discards=0
5186 out_errors=0
5187 promiscuous=0
5188IFCOUNTERS
5189 dgramSeqNo=2
5190 ds=127.0.0.1>0:1004
5191 csSeqNo=1
5192 ifindex=1004
5193 type=6
5194 ifspeed=100000000
5195 direction=0
5196 status=0
5197 in_octets=84
5198 in_unicasts=2
5199 in_multicasts=0
5200 in_broadcasts=4294967295
5201 in_discards=0
5202 in_errors=0
5203 in_unknownprotos=4294967295
5204 out_octets=180
5205 out_unicasts=3
5206 out_multicasts=4294967295
5207 out_broadcasts=4294967295
5208 out_discards=0
5209 out_errors=0
5210 promiscuous=0
5211IFCOUNTERS
5212 dgramSeqNo=3
5213 ds=127.0.0.1>0:1002
5214 csSeqNo=2
5215 ifindex=1002
5216 type=6
5217 ifspeed=100000000
5218 direction=0
1839c356 5219 status=0
8073dd31
NM
5220 in_octets=0
5221 in_unicasts=0
5222 in_multicasts=0
5223 in_broadcasts=4294967295
5224 in_discards=0
5225 in_errors=0
5226 in_unknownprotos=4294967295
5227 out_octets=120
5228 out_unicasts=2
5229 out_multicasts=4294967295
5230 out_broadcasts=4294967295
5231 out_discards=0
5232 out_errors=0
5233 promiscuous=0
5234IFCOUNTERS
5235 dgramSeqNo=3
5236 ds=127.0.0.1>0:1003
5237 csSeqNo=2
5238 ifindex=1003
5239 type=6
5240 ifspeed=100000000
5241 direction=0
5242 status=0
52105b67 5243 in_octets=138
8073dd31
NM
5244 in_unicasts=3
5245 in_multicasts=0
5246 in_broadcasts=4294967295
5247 in_discards=0
5248 in_errors=0
5249 in_unknownprotos=4294967295
5250 out_octets=120
5251 out_unicasts=2
5252 out_multicasts=4294967295
5253 out_broadcasts=4294967295
5254 out_discards=0
5255 out_errors=0
5256 promiscuous=0
5257IFCOUNTERS
5258 dgramSeqNo=3
5259 ds=127.0.0.1>0:1004
5260 csSeqNo=2
5261 ifindex=1004
5262 type=6
5263 ifspeed=100000000
5264 direction=0
5265 status=0
5266 in_octets=84
5267 in_unicasts=2
5268 in_multicasts=0
5269 in_broadcasts=4294967295
5270 in_discards=0
5271 in_errors=0
5272 in_unknownprotos=4294967295
5273 out_octets=180
5274 out_unicasts=3
5275 out_multicasts=4294967295
5276 out_broadcasts=4294967295
5277 out_discards=0
5278 out_errors=0
5279 promiscuous=0
50b9699f
NM
5280OPENFLOWPORT
5281 datapath_id=18364758544493064720
5282 port_no=1
5283OPENFLOWPORT
5284 datapath_id=18364758544493064720
5285 port_no=1
5286OPENFLOWPORT
5287 datapath_id=18364758544493064720
5288 port_no=2
5289OPENFLOWPORT
5290 datapath_id=18364758544493064720
5291 port_no=2
5292OPENFLOWPORT
5293 datapath_id=18364758544493064720
5294 port_no=65534
5295OPENFLOWPORT
5296 datapath_id=18364758544493064720
5297 port_no=65534
5298PORTNAME
5299 portName=br0
5300PORTNAME
5301 portName=br0
5302PORTNAME
5303 portName=p1
5304PORTNAME
5305 portName=p1
5306PORTNAME
5307 portName=p2
5308PORTNAME
5309 portName=p2
4819b3a5 5310])])
17f7f7e0 5311
4819b3a5
BP
5312AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
5313CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
5314AT_CLEANUP
5315
5316AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
5317AT_SKIP_IF([test $HAVE_IPV6 = no])
5318CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
5319AT_CLEANUP
1e04fcc8 5320
50b9699f 5321dnl Test sFlow LAG structures
7321bda3 5322AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 5323AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f
NM
5324OVS_VSWITCHD_START([dnl
5325 add-bond br0 bond p1 p2 -- \
5326 set Port bond lacp=active bond-mode=active-backup \
5327 other_config:lacp-time="fast" \
5328 other_config:lacp-system-id=11:22:33:44:55:66 \
5329 other_config:lacp-system-priority=54321 -- \
5330 set Interface p1 type=dummy \
5331 other_config:lacp-port-id=11 \
5332 other_config:lacp-port-priority=111 \
5333 other_config:lacp-aggregation-key=3333 -- \
5334 set Interface p2 type=dummy \
5335 other_config:lacp-port-id=22 \
5336 other_config:lacp-port-priority=222 \
5337 other_config:lacp-aggregation-key=3333 ])
5338
53eb8cb8 5339on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
5340AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5341AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5342PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
5343
5344ovs-appctl time/stop
5345
5346ovs-vsctl \
5347 set Interface p1 options:ifindex=1003 -- \
5348 set Bridge br0 sflow=@sf -- \
5349 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5350 header=128 sampling=1 polling=1
5351
5352dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
5353AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
5354AT_CHECK([ovs-appctl revalidator/purge], [0])
50b9699f
NM
5355OVS_VSWITCHD_STOP
5356ovs-appctl -t test-sflow exit
5357AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5358 /g']], [0], [dnl
5359LACPCOUNTERS
5360 sysID=11:22:33:44:55:66
5361 partnerID=00:00:00:00:00:00
5362 aggID=3333
5363 actorAdmin=0x7
5364 actorOper=0xbf
5365 partnerAdmin=0x0
5366 partnerOper=0x2
f7aa71fb 5367 LACPDUsRx=0
50b9699f
NM
5368 markerPDUsRx=4294967295
5369 markerRespPDUsRx=4294967295
5370 unknownRx=4294967295
5371 illegalRx=0
f7aa71fb 5372 LACPDUsTx=1
50b9699f
NM
5373 markerPDUsTx=4294967295
5374 markerRespPDUsTx=4294967295
5375])
5376
5377AT_CLEANUP
5378
7321bda3
NM
5379AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
5380AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5381OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5382
5383dnl set up sFlow logging
7321bda3
NM
5384AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5385AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5386PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5387ovs-appctl time/stop
5388
5389OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5390AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5391 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
5392AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
5393
5394AT_CHECK([ovs-ofctl add-flow br0 action=3])
5395
5396dnl enable sflow
5397ovs-vsctl \
5398 set Bridge br0 sflow=@sf -- \
5399 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5400 header=128 sampling=1 polling=0
5401
5402dnl introduce a packet that will be flooded to the tunnel
5403AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(4),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.10.10.2,dst=10.10.10.1,proto=1,tos=1,ttl=128,frag=no),icmp(type=8,code=0)'])
5404
5405dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5406for i in `seq 1 30`; do
5407 ovs-appctl time/warp 100
5408done
5409
5410ovs-appctl -t test-sflow exit
5411
5412AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5413 /g']], [0], [dnl
5414HEADER
5415 dgramSeqNo=1
5416 ds=127.0.0.1>2:1000
5417 fsSeqNo=1
5418 tunnel4_out_length=0
5419 tunnel4_out_protocol=47
5420 tunnel4_out_src=0.0.0.0
5421 tunnel4_out_dst=1.1.1.1
5422 tunnel4_out_src_port=0
5423 tunnel4_out_dst_port=0
5424 tunnel4_out_tcp_flags=0
5425 tunnel4_out_tos=1
5426 tunnel_out_vni=456
5427 in_vlan=0
5428 in_priority=0
5429 out_vlan=0
5430 out_priority=0
5431 meanSkip=1
5432 samplePool=1
5433 dropEvents=0
5434 in_ifindex=0
5435 in_format=0
5436 out_ifindex=1
5437 out_format=2
5438 hdr_prot=1
5439 pkt_len=64
5440 stripped=4
5441 hdr_len=60
5442 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-01-00-1C-00-00-00-00-80-01-12-CA-0A-0A-0A-02-0A-0A-0A-01-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
5443])
5444
5445OVS_VSWITCHD_STOP
5446AT_CLEANUP
5447
5448AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
5449AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5450
5451OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
5452
5453dnl set up sFlow logging
7321bda3
NM
5454AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5455AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5456PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5457ovs-appctl time/stop
5458
5459AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5460AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
5461AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
5462 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
5463 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
5464 options:ifindex=2011 ofport_request=5
5465 ], [0])
5466
5467AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5468dummy@ovs-dummy: hit:0 missed:0
5469 br0:
5470 br0 65534/100: (dummy)
5471 p0 1/1: (dummy: ifindex=1010)
5472 int-br:
5473 int-br 65534/2: (dummy)
5474 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
5475 vm1 5/3: (dummy: ifindex=2011)
5476])
5477
5478dnl set up route to 1.1.2.92 via br0 and action=normal
5479AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
5480])
5481AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
5482])
5483AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
5484])
5485AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5486
5487dnl Prime ARP Cache for 1.1.2.92
5488AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=1,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
5489
5490dnl configure sflow on int-br only
5491ovs-vsctl \
5492 set Bridge int-br sflow=@sf -- \
5493 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5494 header=128 sampling=1 polling=0
5495
5496dnl add rule for int-br to force packet onto tunnel. There is no ifindex
5497dnl for this port so the sFlow output will just report that it went to
5498dnl 1 output (out_format=2, out_ifindex=1)
5499AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
5500
5501AT_CHECK([ovs-appctl netdev-dummy/receive vm1 'in_port(3),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=192.168.1.1,dst=192.168.2.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'])
5502
5503dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5504for i in `seq 1 30`; do
5505 ovs-appctl time/warp 100
5506done
5507
5508ovs-appctl -t test-sflow exit
5509
5510AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5511 /g']], [0], [dnl
5512HEADER
5513 dgramSeqNo=1
5514 ds=127.0.0.1>2:1000
5515 fsSeqNo=1
5516 tunnel4_out_length=0
5517 tunnel4_out_protocol=47
5518 tunnel4_out_src=1.1.2.88
5519 tunnel4_out_dst=1.1.2.92
5520 tunnel4_out_src_port=0
5521 tunnel4_out_dst_port=0
5522 tunnel4_out_tcp_flags=0
5523 tunnel4_out_tos=0
5524 tunnel_out_vni=456
5525 in_vlan=0
5526 in_priority=0
5527 out_vlan=0
5528 out_priority=0
5529 meanSkip=1
5530 samplePool=1
5531 dropEvents=0
5532 in_ifindex=2011
5533 in_format=0
5534 out_ifindex=1
5535 out_format=2
5536 hdr_prot=1
5537 pkt_len=64
5538 stripped=4
5539 hdr_len=60
5540 hdr=50-54-00-00-00-0A-50-54-00-00-00-05-08-00-45-00-00-1C-00-00-00-00-80-01-B6-8D-C0-A8-01-01-C0-A8-02-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
5541])
5542
5543OVS_VSWITCHD_STOP
5544AT_CLEANUP
5545
5546AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 5547AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
5548OVS_VSWITCHD_START
5549AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 5550add_of_ports br0 1 2
7321bda3
NM
5551AT_DATA([flows.txt], [dnl
5552table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,set_mpls_label:789,set_mpls_tc:4,set_mpls_ttl:32,2
5553table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5554])
5555AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5556
5557dnl set up sFlow logging
7321bda3
NM
5558AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5559AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5560PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5561ovs-appctl time/stop
5562
5563dnl configure sflow
5564ovs-vsctl \
5565 set Bridge br0 sflow=@sf -- \
5566 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5567 header=128 sampling=1 polling=0
5568
5569AT_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)'])
5570AT_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)'])
5571
5572dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5573for i in `seq 1 30`; do
5574 ovs-appctl time/warp 100
5575done
5576
5577ovs-appctl -t test-sflow exit
5578
5579AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5580 /g']], [0], [dnl
5581HEADER
5582 dgramSeqNo=1
5583 ds=127.0.0.1>2:1000
5584 fsSeqNo=1
5585 mpls_label_0=789
5586 mpls_tc_0=4
5587 mpls_ttl_0=32
5588 mpls_bos_0=0
5589 mpls_label_1=11
5590 mpls_tc_1=3
5591 mpls_ttl_1=64
5592 mpls_bos_1=1
5593 in_vlan=0
5594 in_priority=0
5595 out_vlan=0
5596 out_priority=0
5597 meanSkip=1
5598 samplePool=1
5599 dropEvents=0
5600 in_ifindex=0
5601 in_format=0
5602 out_ifindex=1
5603 out_format=2
5604 hdr_prot=1
5605 pkt_len=64
5606 stripped=4
5607 hdr_len=60
5608 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-88-47-00-00-B7-40-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5609HEADER
5610 dgramSeqNo=1
5611 ds=127.0.0.1>2:1000
5612 fsSeqNo=2
5613 mpls_label_0=789
5614 mpls_tc_0=4
5615 mpls_ttl_0=32
5616 mpls_bos_0=1
5617 in_vlan=0
5618 in_priority=0
5619 out_vlan=0
5620 out_priority=0
5621 meanSkip=1
5622 samplePool=2
5623 dropEvents=0
5624 in_ifindex=0
5625 in_format=0
5626 out_ifindex=1
5627 out_format=2
5628 hdr_prot=1
5629 pkt_len=64
5630 stripped=4
5631 hdr_len=60
5632 hdr=50-54-00-00-00-0A-50-54-00-00-00-09-08-00-45-00-00-14-00-00-00-00-00-00-BA-EB-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
5633])
5634
5635OVS_VSWITCHD_STOP
5636AT_CLEANUP
5637
5638
4819b3a5 5639# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
5640#
5641# Test that basic NetFlow reports flow statistics correctly:
5642# The initial packet of a flow are correctly accounted.
5643# Later packets within a flow are correctly accounted.
5644# Flow actions changing (in this case, due to MAC learning)
5645# cause a record to be sent.
e731d71b 5646m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 5647 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 5648 add_of_ports br0 1 2
e731d71b
AS
5649
5650 ovs-appctl time/stop
53eb8cb8 5651 on_exit 'kill `cat test-netflow.pid`'
eadd1644 5652 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 5653 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 5654 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
5655
5656 ovs-vsctl \
5657 set Bridge br0 netflow=@nf -- \
5658 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5659 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
5660
5661 for delay in 1000 30000; do
5662 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)'
5788e39f 5663 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
5664 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)'
5665
5666 ovs-appctl time/warp $delay
5667 done
17f7f7e0 5668
e731d71b 5669 ovs-appctl time/warp 6000
27f57736 5670 ovs-appctl revalidator/wait
e731d71b
AS
5671 OVS_VSWITCHD_STOP
5672 ovs-appctl -t test-netflow exit
e79a6c83 5673
e731d71b 5674 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])
e79a6c83 5675
e731d71b 5676 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])
e79a6c83 5677
e731d71b
AS
5678 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
5679 separate=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 1 pkts, 60 bytes, ICMP 0:0" netflow.log | wc -l`
4819b3a5 5680 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 5681
4819b3a5
BP
5682AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
5683CHECK_NETFLOW_EXPIRATION([127.0.0.1])
5684AT_CLEANUP
17f7f7e0 5685
4819b3a5
BP
5686AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
5687AT_SKIP_IF([test $HAVE_IPV6 = no])
5688CHECK_NETFLOW_EXPIRATION([[[::1]]])
5689AT_CLEANUP
1e04fcc8 5690
4819b3a5 5691# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
5692#
5693# Test that basic NetFlow reports active expirations correctly.
e731d71b 5694m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 5695 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 5696 add_of_ports br0 1 2
17f7f7e0 5697
53eb8cb8 5698 on_exit 'kill `cat test-netflow.pid`'
eadd1644 5699 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 5700 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 5701 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 5702
e731d71b
AS
5703 ovs-vsctl \
5704 set Bridge br0 netflow=@nf -- \
5705 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5706 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
17f7f7e0 5707
e731d71b
AS
5708 AT_CHECK([ovs-appctl time/stop])
5709 n=1
5710 while test $n -le 60; do
5711 n=`expr $n + 1`
17f7f7e0 5712
e731d71b
AS
5713 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)'
5714 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)'
17f7f7e0 5715
e731d71b
AS
5716 ovs-appctl time/warp 1000
5717 done
17f7f7e0 5718
e731d71b
AS
5719 ovs-appctl time/warp 10000
5720
27f57736 5721 ovs-appctl revalidator/wait
e731d71b
AS
5722 OVS_VSWITCHD_STOP
5723 ovs-appctl -t test-netflow exit
5724
5725 # Count the number of reported packets:
5726 # - From source to destination before MAC learning kicks in (just one).
5727 # - From source to destination after that.
5728 # - From destination to source.
5729 n_learn=0
5730 n_in=0
5731 n_out=0
5732 n_other=0
5733 n_recs=0
5734 none=0
5735 while read line; do
5736 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
5737 case $pkts in
5738 [[0-9]]*) ;;
5739 *) continue ;;
5740 esac
5741
5742 case $line in
5743 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5744 counter=n_learn
5745 ;;
5746 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5747 counter=n_in
5748 ;;
5749 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
5750 counter=n_out
5751 ;;
5752 *)
5753 counter=n_other
5754 ;;
5755 esac
5756 eval $counter=\`expr \$$counter + \$pkts\`
5757 n_recs=`expr $n_recs + 1`
5758 done < netflow.log
5759
5760 # There should be exactly 1 MAC learning packet,
5761 # exactly 59 other packets in that direction,
5762 # and exactly 60 packets in the other direction.
5763 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4819b3a5 5764])])
e731d71b 5765
4819b3a5
BP
5766AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
5767CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
5768AT_CLEANUP
e731d71b 5769
4819b3a5
BP
5770AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
5771AT_SKIP_IF([test $HAVE_IPV6 = no])
5772CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
5773AT_CLEANUP
f27f2134 5774
3d198ea5
JS
5775dnl In the absence of an IPFIX collector to verify protocol correctness, simply
5776dnl configure IPFIX and ensure that sample action generation works at the
5777dnl datapath level.
5778AT_SETUP([ofproto-dpif - Basic IPFIX sanity check])
5779OVS_VSWITCHD_START
ca5792f0 5780add_of_ports br0 1 2
3d198ea5
JS
5781
5782dnl Sample every packet using bridge-based sampling
5783AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
5784 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
5785 sampling=1], [0], [ignore])
5786
5787dnl Send some packets that should be sampled
5788for i in `seq 1 3`; do
5789 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)'])
5790done
5791AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5792flow-dump from non-dpdk interfaces:
5793packets:2, bytes:120, used:0.001s, actions:sample(sample=100.0%,actions(userspace(pid=0,ipfix(output_port=4294967295))))
5794])
5795
5796dnl Remove the IPFIX configuration
5797AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
5798AT_CHECK([ovs-appctl revalidator/purge])
5799
5800dnl Send some more packets, to ensure that these are not sampled.
5801for i in `seq 1 3`; do
5802 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)'])
5803done
5804AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5805flow-dump from non-dpdk interfaces:
5806packets:2, bytes:120, used:0.001s, actions:drop
5807])
5808
5809OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
5810AT_CLEANUP
5811
23a7d252
JS
5812AT_SETUP([ofproto-dpif - flow stats])
5813OVS_VSWITCHD_START
5814AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5815AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5816
5817ovs-appctl time/stop
5818
5819for i in `seq 1 10`; do
5820 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)'
5821done
5822
cea4a6d7
JS
5823AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
5824AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 5825AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 5826AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 5827 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
11f9de00 5828 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
e96a5c24
JS
5829])
5830OVS_VSWITCHD_STOP
5831AT_CLEANUP
5832
5833AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
5834OVS_VSWITCHD_START
5835AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5836AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5837
5838ovs-appctl time/stop
5839
5840for i in `seq 1 10`; do
5841 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)'
5842done
5843
5844ovs-appctl time/warp 100
5845AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
5846ovs-appctl time/warp 1000
5847
23a7d252 5848AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 5849AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 5850 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
11f9de00 5851 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
23a7d252
JS
5852])
5853OVS_VSWITCHD_STOP
5854AT_CLEANUP
5855
5f5ebd4c 5856AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
5857OVS_VSWITCHD_START
5858
5859# get_ages DURATION HARD IDLE
5860#
5861# Fetch the flow duration, hard age, and idle age into the variables
5862# whose names are given as arguments. Rounds DURATION down to the
5863# nearest integer. If hard_age doesn't appear in the output, sets
5864# HARD to "none". If idle_age doesn't appear in the output, sets IDLE
5865# to 0.
5866get_ages () {
5867 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5868
5869 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
5870 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
5871 AS_VAR_COPY([$1], [duration])
5872
5873 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
5874 if test X"$hard" = X; then
5875 hard=none
5876 else
5877 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
5878 fi
5879 AS_VAR_COPY([$2], [hard])
5880
5881 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
5882 if test X"$idle" = X; then
5883 idle=0
5884 else
5885 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
5886 fi
5887 AS_VAR_COPY([$3], [idle])
5888}
5889
5890# Add a flow and get its initial hard and idle age.
5891AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
5892get_ages duration1 hard1 idle1
5893
31ef9f51 5894ovs-appctl time/stop
f27f2134
BP
5895# Warp time forward by 10 seconds, then modify the flow's actions.
5896ovs-appctl time/warp 10000
5897get_ages duration2 hard2 idle2
5898AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
5899
5900# Warp time forward by 10 seconds.
5901ovs-appctl time/warp 10000
5902get_ages duration3 hard3 idle3
5903
5904# Warp time forward 10 more seconds, then pass some packets through the flow,
5905# then warp forward a few more times because idle times are only updated
5906# occasionally.
5907ovs-appctl time/warp 10000
5908ovs-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)'
bdba1947 5909ovs-appctl time/warp 3000 1000
c0526804 5910sleep 1
f27f2134
BP
5911get_ages duration4 hard4 idle4
5912
5913printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
5914printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
5915printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
5916
5917# Duration should increase steadily over time.
5918AT_CHECK([test $duration1 -lt $duration2])
5919AT_CHECK([test $duration2 -lt $duration3])
5920AT_CHECK([test $duration3 -lt $duration4])
5921
5922# Hard age should be "none" initially because it's the same as flow_duration,
5923# then it should increase.
5924AT_CHECK([test $hard1 = none])
5925AT_CHECK([test $hard2 = none])
5926AT_CHECK([test $hard3 != none])
5927AT_CHECK([test $hard4 != none])
5928AT_CHECK([test $hard3 -lt $hard4])
5929
5930# Idle age should increase from 1 to 2 to 3, then decrease.
5931AT_CHECK([test $idle1 -lt $idle2])
5932AT_CHECK([test $idle2 -lt $idle3])
5933AT_CHECK([test $idle3 -gt $idle4])
5934
5935# Check some invariant relationships.
5936AT_CHECK([test $duration1 = $idle1])
5937AT_CHECK([test $duration2 = $idle2])
5938AT_CHECK([test $duration3 = $idle3])
5939AT_CHECK([test $idle3 -gt $hard3])
5940AT_CHECK([test $idle4 -lt $hard4])
5941AT_CHECK([test $hard4 -lt $duration4])
5942
5943OVS_VSWITCHD_STOP
5944AT_CLEANUP
0e553d9c
BP
5945
5946AT_SETUP([ofproto-dpif - fin_timeout])
5947OVS_VSWITCHD_START
b5c1a5df 5948ovs-appctl time/stop
0e553d9c
BP
5949AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
5950AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5951[NXST_FLOW reply:
5952 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5953])
31ef9f51 5954
0e553d9c
BP
5955# Check that a TCP SYN packet does not change the timeout. (Because
5956# flow stats updates are mainly what implements the fin_timeout
5957# feature, we warp forward a couple of times to ensure that flow stats
5958# run before re-checking the flow table.)
323cc924 5959AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
5960AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5961warped
5962])
cea4a6d7 5963AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
5964AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5965[NXST_FLOW reply:
5966 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5967])
5968# Check that a TCP FIN packet does change the timeout.
323cc924 5969AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
5970AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5971warped
5972])
5973AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5974[NXST_FLOW reply:
5975 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
5976])
5977OVS_VSWITCHD_STOP
5978AT_CLEANUP
27022416
JP
5979
5980AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
5981OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
5982add_of_ports br0 1 2
5983add_of_ports br1 3
27022416
JP
5984
5985AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
5986dummy@br0
5987dummy@br1
5988])
5989OVS_VSWITCHD_STOP
5990AT_CLEANUP
5991
5992AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
5993OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
5994add_of_ports br0 1 2
5995add_of_ports br1 3
27022416
JP
5996
5997AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 5998dummy@ovs-dummy: hit:0 missed:0
e79a6c83 5999 br0:
dc54ef36
EJ
6000 br0 65534/100: (dummy)
6001 p1 1/1: (dummy)
6002 p2 2/2: (dummy)
e79a6c83 6003 br1:
dc54ef36
EJ
6004 br1 65534/101: (dummy)
6005 p3 3/3: (dummy)
27022416
JP
6006])
6007OVS_VSWITCHD_STOP
6008AT_CLEANUP
6009
6010AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 6011# bump max-idle to avoid the flows being reclaimed behind us
27022416 6012OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6
YT
6013 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6014 set Open_vSwitch . other_config:max-idle=10000])
ca5792f0
BP
6015add_of_ports br0 1 2
6016add_of_ports br1 3
27022416 6017
323cc924
BP
6018AT_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)'])
6019AT_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)'])
6020AT_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)'])
27f57736 6021ovs-appctl revalidator/wait
3a18d0c2 6022AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
16194afd
DDP
6023recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6024recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
6025])
6026
3a18d0c2 6027AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
16194afd 6028recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
6029])
6030
3a18d0c2 6031AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
16194afd
DDP
6032skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p1),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
6033skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p2),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=0/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
6034])
6035
3a18d0c2 6036AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
16194afd 6037skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(p3),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions:drop
818650e6
JS
6038])
6039
6040OVS_VSWITCHD_STOP
6041AT_CLEANUP
6042
6043AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow])
6044
6045OVS_VSWITCHD_START([add-br br1 -- \
6046 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6047 set Open_vSwitch . other_config:max-idle=10000])
ca5792f0 6048add_of_ports br0 1 2
818650e6
JS
6049
6050AT_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)'])
6051ovs-appctl revalidator/wait
6052AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
6053
10e92b4f 6054UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
818650e6
JS
6055AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
6056recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
6057])
6058
27022416
JP
6059OVS_VSWITCHD_STOP
6060AT_CLEANUP
6061
50c1efc9 6062AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
6063OVS_VSWITCHD_START([dnl
6064 add-port br0 p1 -- set Interface p1 type=dummy
6065])
623540e4 6066AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 6067on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
6068
6069AT_CAPTURE_FILE([ofctl_monitor.log])
6070AT_DATA([flows.txt], [dnl
6071dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 6072dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
6073])
6074AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6075
6076dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 6077dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 6078dnl
47fb7f71 6079dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 6080dnl 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)
8bfd0fda
BP
6081dnl (label 20, exp 0, [S], ttl 32)
6082dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6083dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6084
6085for dl_src in 00 01; do
47fb7f71 6086 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"])
e3b9e3aa
YT
6087done
6088sleep 1 # wait for the datapath flow installed
2be3fe44 6089AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6090recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=60:66:66:66:66:00,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
6091recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=60:66:66:66:66:01,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
8bfd0fda 6092])
8bfd0fda
BP
6093
6094OVS_VSWITCHD_STOP
6095AT_CLEANUP
6096
6097
50c1efc9 6098AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
6099OVS_VSWITCHD_START([dnl
6100 add-port br0 p1 -- set Interface p1 type=dummy
6101])
623540e4 6102AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 6103on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
6104
6105AT_CAPTURE_FILE([ofctl_monitor.log])
6106AT_DATA([flows.txt], [dnl
6107dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 6108dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
6109])
6110AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6111
6112dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
6113dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
47fb7f71 6114dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
6115dnl
6116dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
6117dnl 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)
6118dnl (label 20, exp 0, ttl 32)
6119dnl (label 20, exp 0, ttl 32)
6120dnl (label 20, exp 0, [S], ttl 32)
6121dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6122dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 6123
47fb7f71
JS
6124for dl_src in 00 01; do
6125 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"])
e3b9e3aa
YT
6126done
6127sleep 1 # wait for the datapath flow installed
2be3fe44 6128AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6129recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=60:66:66:66:66:00,mpls_label=20,mpls_tc=0,mpls_ttl=32,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
6130recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=60:66:66:66:66:01,mpls_bos=0,mpls_lse1=82208, actions:userspace(pid=0,slow_path(controller))
8bfd0fda
BP
6131])
6132
6133OVS_VSWITCHD_STOP
6134AT_CLEANUP
6135
0a740f48
EJ
6136AT_SETUP([ofproto-dpif - patch ports])
6137OVS_VSWITCHD_START([add-br br1 \
6138-- set bridge br1 datapath-type=dummy fail-mode=secure \
6139-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6140-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6141
ca5792f0
BP
6142add_of_ports br0 2
6143add_of_ports br1 3
0a740f48 6144
64bb477f
JS
6145AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6146], [])
aef0491b 6147AT_CHECK([ovs-appctl time/stop])
623540e4 6148AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 6149
0a740f48
EJ
6150AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
6151AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
6152
6153for i in $(seq 1 10); do
6154 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)'
3b401f9b
BP
6155 if [[ $i -eq 1 ]]; then
6156 sleep 1
6157 fi
0a740f48
EJ
6158done
6159
6160for i in $(seq 1 5); do
6161 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)'
3b401f9b
BP
6162 if [[ $i -eq 1 ]]; then
6163 sleep 1
6164 fi
0a740f48
EJ
6165done
6166
0a8763fc
EJ
6167AT_CHECK([ovs-appctl time/warp 500], [0],
6168[warped
735d7efb 6169])
732207ad 6170sleep 1 # wait for log writer
735d7efb 6171
0a740f48 6172AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 6173dummy@ovs-dummy: hit:13 missed:2
e79a6c83 6174 br0:
dc54ef36
EJ
6175 br0 65534/100: (dummy)
6176 p2 2/2: (dummy)
6177 pbr0 1/none: (patch: peer=pbr1)
e79a6c83 6178 br1:
dc54ef36
EJ
6179 br1 65534/101: (dummy)
6180 p3 3/3: (dummy)
6181 pbr1 1/none: (patch: peer=pbr0)
0a740f48
EJ
6182])
6183
2be3fe44 6184AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6185recirc_id=0,ip,in_port=100,vlan_tci=0x0000,nw_frag=no, actions:101,3,2
6186recirc_id=0,ip,in_port=101,vlan_tci=0x0000,nw_frag=no, actions:100,2,3
c2a77f33
JS
6187])
6188
2be3fe44 6189AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
16194afd 6190skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(100),eth(src=50:54:00:00:00:05/00:00:00:00:00:00,dst=50:54:00:00:00:07/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.1/0.0.0.0,dst=192.168.0.2/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:9, bytes:540, used:0.0s, actions:101,3,2
c2a77f33 6191])
2be3fe44 6192AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
16194afd 6193skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(101),eth(src=50:54:00:00:00:07/00:00:00:00:00:00,dst=50:54:00:00:00:05/00:00:00:00:00:00),eth_type(0x0800),ipv4(src=192.168.0.2/0.0.0.0,dst=192.168.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:4, bytes:240, used:0.0s, actions:100,2,3
0a740f48
EJ
6194])
6195
6196AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
6197OFPST_PORT reply (xid=0x4): 1 ports
6198 port 1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
6199 tx pkts=10, bytes=600, drop=0, errs=0, coll=0
6200])
6201
6202AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
6203OFPST_PORT reply (xid=0x4): 1 ports
6204 port 1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
6205 tx pkts=5, bytes=300, drop=0, errs=0, coll=0
6206])
6207
6208OVS_VSWITCHD_STOP
6209AT_CLEANUP
655ab909 6210
1774d762
JR
6211AT_SETUP([ofproto-dpif - patch ports - stack])
6212OVS_VSWITCHD_START([add-br br1 \
6213-- set bridge br1 datapath-type=dummy fail-mode=secure \
6214-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6215-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6216
ca5792f0
BP
6217add_of_ports br0 2
6218add_of_ports br1 3
1774d762
JR
6219
6220AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6221], [])
6222AT_CHECK([ovs-appctl time/stop])
6223AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6224
6225AT_CHECK([ovs-ofctl add-flow br0 "ip actions=push:OXM_OF_IN_PORT[[0..31]],output:1,pop:OXM_OF_IPV4_SRC[[0..31]],output:2"])
6226# Try to pop from empty stack, and push and leave data to stack.
6227AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
6228
6229ovs-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)'
6230
6231AT_CHECK([ovs-appctl time/warp 500], [0],
6232[warped
6233])
6234
6235OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
6236
6237AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6238dummy@ovs-dummy: hit:0 missed:1
6239 br0:
6240 br0 65534/100: (dummy)
6241 p2 2/2: (dummy)
6242 pbr0 1/none: (patch: peer=pbr1)
6243 br1:
6244 br1 65534/101: (dummy)
6245 p3 3/3: (dummy)
6246 pbr1 1/none: (patch: peer=pbr0)
6247])
6248
2be3fe44 6249AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131 6250recirc_id=0,ip,in_port=100,vlan_tci=0x0000,nw_src=192.168.0.1,nw_frag=no, actions:101,set(ipv4(src=255.255.255.254)),2
1774d762
JR
6251])
6252
2be3fe44 6253AT_CHECK([grep -e '|nx_match|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
1774d762
JR
6254Failed to pop from an empty stack. On flow
6255])
6256
6257OVS_VSWITCHD_STOP(["/Failed to pop from an empty stack/d"])
6258AT_CLEANUP
6259
65e0be10
BP
6260AT_SETUP([ofproto-dpif - port duration])
6261OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 6262add_of_ports br0 1 2
65e0be10 6263
31ef9f51 6264ovs-appctl time/stop
65e0be10
BP
6265ovs-appctl time/warp 10000
6266
6267AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 6268AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 6269[dnl
65e0be10 6270 duration=?s
65e0be10 6271 duration=?s
65e0be10
BP
6272 duration=?s
6273])
6274OVS_VSWITCHD_STOP
6275AT_CLEANUP
bcd2633a
JP
6276
6277dnl ----------------------------------------------------------------------
6278AT_BANNER([ofproto-dpif -- megaflows])
6279
bcd2633a
JP
6280AT_SETUP([ofproto-dpif megaflow - port classification])
6281OVS_VSWITCHD_START
623540e4 6282AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6283add_of_ports br0 1 2
bcd2633a
JP
6284AT_DATA([flows.txt], [dnl
6285table=0 in_port=1 actions=output(2)
6286])
6287AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6288AT_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)'])
53555f51 6289sleep 1
bcd2633a 6290AT_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)'])
ae692725 6291sleep 1
2be3fe44 6292AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6293recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions: <del>
bcd2633a
JP
6294])
6295OVS_VSWITCHD_STOP
6296AT_CLEANUP
6297
6298AT_SETUP([ofproto-dpif megaflow - L2 classification])
6299OVS_VSWITCHD_START
623540e4 6300AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6301add_of_ports br0 1 2
bcd2633a
JP
6302AT_DATA([flows.txt], [dnl
6303table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
6304])
6305AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6306AT_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)'])
6307AT_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)'])
ae692725 6308sleep 1
2be3fe44 6309AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6310recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6311recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
bcd2633a
JP
6312])
6313OVS_VSWITCHD_STOP
6314AT_CLEANUP
6315
6316AT_SETUP([ofproto-dpif megaflow - L3 classification])
6317OVS_VSWITCHD_START
623540e4 6318AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6319add_of_ports br0 1 2
13751fd8 6320AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
bcd2633a
JP
6321AT_DATA([flows.txt], [dnl
6322table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
6323])
6324AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6325AT_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)'])
6326AT_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)'])
ae692725 6327sleep 1
2be3fe44 6328AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6329recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
6330recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
bcd2633a
JP
6331])
6332OVS_VSWITCHD_STOP
6333AT_CLEANUP
6334
13751fd8
JR
6335AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
6336OVS_VSWITCHD_START
623540e4 6337AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6338add_of_ports br0 1 2
13751fd8
JR
6339AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
6340AT_DATA([flows.txt], [dnl
6341table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
6342])
6343AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6344AT_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)'])
6345AT_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)'])
ae692725 6346sleep 1
2be3fe44 6347AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6348recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:1:2:3:4:5,nw_frag=no, actions: <del>
6349recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:5:4:3:2:1/0:0:0:4::,nw_frag=no, actions: <del>
13751fd8
JR
6350])
6351OVS_VSWITCHD_STOP
6352AT_CLEANUP
6353
bcd2633a
JP
6354AT_SETUP([ofproto-dpif megaflow - L4 classification])
6355OVS_VSWITCHD_START
623540e4 6356AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6357add_of_ports br0 1 2
bcd2633a
JP
6358AT_DATA([flows.txt], [dnl
6359table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
6360])
6361AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6362AT_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)'])
53555f51 6363sleep 1
bcd2633a 6364AT_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)'])
53555f51 6365sleep 1
2be3fe44 6366AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6367recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x8/0xff, actions: <del>
bcd2633a
JP
6368])
6369OVS_VSWITCHD_STOP
6370AT_CLEANUP
6371
6372AT_SETUP([ofproto-dpif megaflow - normal])
6373OVS_VSWITCHD_START
623540e4 6374AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6375add_of_ports br0 1 2
bcd2633a
JP
6376AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6377AT_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)'])
6378AT_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)'])
ae692725 6379sleep 1
2be3fe44 6380AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6381recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
6382recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
bcd2633a
JP
6383])
6384OVS_VSWITCHD_STOP
6385AT_CLEANUP
6386
6387AT_SETUP([ofproto-dpif megaflow - mpls])
6388OVS_VSWITCHD_START
623540e4 6389AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6390add_of_ports br0 1 2
bcd2633a
JP
6391AT_DATA([flows.txt], [dnl
6392table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
6393table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6394])
6395AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6396AT_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)'])
6397AT_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)'])
ae692725 6398sleep 1
3fd12197
JR
6399AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
6400recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,mpls_label=11,mpls_tc=3,mpls_ttl=64,mpls_bos=1, actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
8bf009bf
JR
6401recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,mpls_bos=1, actions:pop_mpls(eth_type=0x800),recirc(0x1)
6402recirc_id=0x1,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions:2
bcd2633a
JP
6403])
6404OVS_VSWITCHD_STOP
6405AT_CLEANUP
6406
4819b3a5 6407# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 6408m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 6409 [OVS_VSWITCHD_START
623540e4 6410 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6411 add_of_ports br0 1 2
e731d71b
AS
6412
6413 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 6414 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6415 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6416 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6417 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
6418 ovs-vsctl \
6419 set Bridge br0 netflow=@nf -- \
6420 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6421 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6422
6423 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6424 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)'])
6425 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)'])
6426 sleep 1
2be3fe44 6427 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6428recirc_id=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_frag=no,icmp_type=0x8/0xff,icmp_code=0x0/0xff, actions: <del>
6429recirc_id=0,icmp,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_frag=no,icmp_type=0x8/0xff,icmp_code=0x0/0xff, actions: <del>
bcd2633a 6430])
4819b3a5 6431 OVS_VSWITCHD_STOP])
e731d71b 6432
4819b3a5 6433AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 6434CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
6435AT_CLEANUP
6436
6437AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
6438AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 6439CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 6440AT_CLEANUP
bcd2633a
JP
6441
6442AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
6443OVS_VSWITCHD_START(
6444 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
6445 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
6446 set interface p2 type=dummy ofport_request=2 -- \
6447 set interface p3 type=dummy ofport_request=3])
6448AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6449])
623540e4 6450AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
6451
6452AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6453AT_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)'])
6454AT_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)'])
ae692725 6455sleep 1
2be3fe44 6456AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6457recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
6458recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
bcd2633a
JP
6459])
6460OVS_VSWITCHD_STOP
6461AT_CLEANUP
6462
6463AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
6464OVS_VSWITCHD_START(
6465 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
6466 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
6467 set interface p2 type=dummy ofport_request=2 -- \
6468 set interface p3 type=dummy ofport_request=3])
6469AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6470])
623540e4 6471AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
6472
6473AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6474AT_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)'])
6475AT_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)'])
ae692725 6476sleep 1
2be3fe44 6477AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6478recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
6479recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
bcd2633a
JP
6480])
6481OVS_VSWITCHD_STOP
6482AT_CLEANUP
6483
6484AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
6485# Create bond0 on br0 with interfaces p0 and p1
6486# and bond1 on br1 with interfaces p2 and p3
6487# with p0 patched to p2 and p1 patched to p3.
6488OVS_VSWITCHD_START(
6489 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
6490 other-config:lacp-time=fast \
6491 other-config:bond-rebalance-interval=0 -- \
6492 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
6493 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
6494 add-br br1 -- \
6495 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
6496 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
6497 fail-mode=secure -- \
6498 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
6499 other-config:lacp-time=fast \
6500 other-config:bond-rebalance-interval=0 -- \
6501 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
6502 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
6503
6504AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6505])
623540e4 6506AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6507add_of_ports br0 7
bcd2633a
JP
6508AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6509AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 6510ovs-appctl time/stop
bcd2633a
JP
6511ovs-appctl time/warp 5000
6512AT_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)'])
6513AT_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)'])
53555f51 6514sleep 1
2be3fe44 6515AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6516recirc_id=0,ip,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions: <del>
6517recirc_id=0,ip,in_port=7,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions: <del>
bcd2633a
JP
6518])
6519OVS_VSWITCHD_STOP
6520AT_CLEANUP
6521
6522AT_SETUP([ofproto-dpif megaflow - resubmit port action])
6523OVS_VSWITCHD_START
623540e4 6524AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6525add_of_ports br0 1 2
bcd2633a
JP
6526AT_DATA([flows.txt], [dnl
6527table=0 in_port=1,ip actions=resubmit(90)
6528table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
6529])
6530AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6531AT_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)'])
6532AT_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)'])
ae692725 6533sleep 1
2be3fe44 6534AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6535recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6536recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
bcd2633a
JP
6537])
6538OVS_VSWITCHD_STOP
6539AT_CLEANUP
6540
6541AT_SETUP([ofproto-dpif megaflow - resubmit table action])
6542OVS_VSWITCHD_START
623540e4 6543AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6544add_of_ports br0 1 2
bcd2633a
JP
6545AT_DATA([flows.txt], [dnl
6546table=0 in_port=1,ip actions=resubmit(,1)
6547table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6548])
6549AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6550AT_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)'])
6551AT_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=
65521,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 6553sleep 1
2be3fe44 6554AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6555recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6556recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6557])
6558OVS_VSWITCHD_STOP
6559AT_CLEANUP
6560
6561AT_SETUP([ofproto-dpif megaflow - goto_table action])
6562OVS_VSWITCHD_START
623540e4 6563AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6564add_of_ports br0 1 2
bcd2633a
JP
6565AT_DATA([flows.txt], [dnl
6566table=0 in_port=1,ip actions=goto_table(1)
6567table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6568])
6569AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
6570AT_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)'])
6571AT_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)'])
ae692725 6572sleep 1
2be3fe44 6573AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6574recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6575recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6576])
6577OVS_VSWITCHD_STOP
6578AT_CLEANUP
6579
6580AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 6581AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 6582OVS_VSWITCHD_START
623540e4 6583AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6584add_of_ports br0 1 2 3
bcd2633a
JP
6585ovs-vsctl \
6586 set Bridge br0 mirrors=@m --\
6587 --id=@p3 get Port p3 --\
6588 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
6589
6590AT_DATA([flows.txt], [dnl
6591in_port=1 actions=output:2
6592])
6593AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6594AT_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)'])
53555f51 6595sleep 1
bcd2633a 6596AT_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)'])
ae692725 6597sleep 1
2be3fe44 6598AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6599recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions: <del>
bcd2633a
JP
6600])
6601OVS_VSWITCHD_STOP
6602AT_CLEANUP
6603
6604AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
6605OVS_VSWITCHD_START
623540e4 6606AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6607add_of_ports br0 1 2 3
bcd2633a
JP
6608ovs-vsctl \
6609 set Bridge br0 mirrors=@m --\
6610 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
6611 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
6612
6613AT_DATA([flows.txt], [dnl
6614in_port=1 actions=output:2
6615])
6616AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6617AT_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))'])
6618AT_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)'])
ae692725 6619sleep 1
2be3fe44 6620AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6621recirc_id=0,ip,in_port=1,dl_vlan=11,nw_frag=no, actions: <del>
6622recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,nw_frag=no, actions: <del>
bcd2633a
JP
6623])
6624OVS_VSWITCHD_STOP
6625AT_CLEANUP
6626
6627AT_SETUP([ofproto-dpif megaflow - move action])
6628OVS_VSWITCHD_START
623540e4 6629AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6630add_of_ports br0 1 2
bcd2633a
JP
6631AT_DATA([flows.txt], [dnl
6632table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
6633table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
6634table=0 in_port=91 reg0=0x0a000002,actions=output(2)
6635])
6636AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6637AT_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)'])
6638AT_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)'])
ae692725 6639sleep 1
2be3fe44 6640AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6641recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2,nw_frag=no, actions: <del>
6642recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
bcd2633a
JP
6643])
6644OVS_VSWITCHD_STOP
6645AT_CLEANUP
6646
6647AT_SETUP([ofproto-dpif megaflow - push action])
6648OVS_VSWITCHD_START
623540e4 6649AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6650add_of_ports br0 1 2
bcd2633a
JP
6651AT_DATA([flows.txt], [dnl
6652table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
6653])
6654AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6655AT_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)'])
6656AT_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)'])
ae692725 6657sleep 1
2be3fe44 6658AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6659recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2,nw_frag=no, actions: <del>
6660recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
bcd2633a
JP
6661])
6662OVS_VSWITCHD_STOP
6663AT_CLEANUP
6664
6665AT_SETUP([ofproto-dpif megaflow - learning])
6666OVS_VSWITCHD_START
623540e4 6667AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6668add_of_ports br0 1 2
bcd2633a
JP
6669AT_DATA([flows.txt], [dnl
6670table=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
6671])
6672AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 6673ovs-appctl time/stop
956f2bf0
BP
6674# We send each packet twice because the first packet in each flow causes the
6675# flow table to change and thus revalidations, which (depending on timing)
6676# can keep a megaflow from being installed. The revalidations are done by
6677# the second iteration, allowing the flows to be installed.
6678for i in 1 2; do
6679 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)'])
6680 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)'])
6681 ovs-appctl time/warp 100
6682done
ae692725 6683sleep 1
bcd2633a 6684dnl The original flow is missing due to a revalidation.
2be3fe44 6685AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
d8485a90
AW
6686recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6687recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6688])
6689OVS_VSWITCHD_STOP
6690AT_CLEANUP
d4f4a9b2
JP
6691
6692AT_SETUP([ofproto-dpif megaflow - tunnels])
6693OVS_VSWITCHD_START(
2c0ea78f 6694 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 6695AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
6696AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
6697 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
6698AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
6699 ofport_request=3])
6700AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
6701 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
6702 ofport_request=4 options:key=flow])
d4f4a9b2
JP
6703AT_DATA([flows.txt], [dnl
6704in_port=1,actions=output(2)
6705in_port=3,actions=output(4)
6706])
6707AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6708dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
6709dnl will cause the packet to be dropped.
6710AT_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)'])
53555f51 6711sleep 1
d4f4a9b2
JP
6712AT_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)'])
6713AT_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)'])
53555f51 6714sleep 1
d4f4a9b2 6715AT_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)'])
ae692725 6716sleep 1
2be3fe44 6717AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6718recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_ecn=1,nw_frag=no, actions: <del>
6719recirc_id=0,ip,in_port=3,vlan_tci=0x0000,nw_tos=0,nw_ecn=1,nw_ttl=64,nw_frag=no, actions: <del>
6720recirc_id=0,ip,in_port=3,vlan_tci=0x0000,nw_tos=252,nw_ecn=1,nw_ttl=128,nw_frag=no, actions: <del>
1dd35f8a
JP
6721])
6722OVS_VSWITCHD_STOP
6723AT_CLEANUP
6724
6725AT_SETUP([ofproto-dpif megaflow - dec_ttl])
6726OVS_VSWITCHD_START
623540e4 6727AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6728add_of_ports br0 1 2
13751fd8 6729AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=nw_dst,nw_src], [0], [ignore], [])
1dd35f8a
JP
6730AT_DATA([flows.txt], [dnl
6731table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
6732])
6733AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6734AT_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)'])
6735AT_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)'])
ae692725 6736sleep 1
2be3fe44 6737AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6738recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_ttl=64,nw_frag=no, actions: <del>
6739recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
d4f4a9b2
JP
6740])
6741OVS_VSWITCHD_STOP
6742AT_CLEANUP
74cc3969 6743
f74e7df7
JP
6744AT_SETUP([ofproto-dpif megaflow - set dl_dst])
6745OVS_VSWITCHD_START
623540e4 6746AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6747add_of_ports br0 1 2
f74e7df7
JP
6748AT_DATA([flows.txt], [dnl
6749table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
6750])
6751AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6752AT_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)'])
6753AT_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)'])
ae692725 6754sleep 1
d23df9a8
JR
6755dnl The first packet is essentially a no-op, as the new destination MAC is the
6756dnl same as the original. The second entry actually updates the destination
6757dnl MAC.
2be3fe44 6758AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6759recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions:2
6760recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_dst=50:54:00:00:00:0c,nw_frag=no, actions:set(eth(dst=50:54:00:00:00:0a)),2
f74e7df7
JP
6761])
6762OVS_VSWITCHD_STOP
6763AT_CLEANUP
6764
8c301900
JR
6765AT_SETUP([ofproto-dpif megaflow - disabled])
6766OVS_VSWITCHD_START
623540e4 6767AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6768add_of_ports br0 1 2
8c301900
JR
6769AT_DATA([flows.txt], [dnl
6770table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
6771table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
6772])
e79a6c83 6773AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 6774], [])
64bb477f
JS
6775AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6776], [])
8c301900
JR
6777AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
6778AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6779for i in 1 2 3 4; do
6780 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)'])
6781 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)'])
53555f51
YT
6782 if [[ $i -eq 1 ]]; then
6783 sleep 1
6784 fi
8c301900 6785done
ae692725 6786sleep 1
2be3fe44 6787AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9daf2348
JS
6788pkt_mark=0,recirc_id=0,dp_hash=0,skb_priority=0,ct_state=0,ct_zone=0,ct_mark=0,ct_label=0,icmp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,nw_src=10.0.0.2,nw_dst=10.0.0.1,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0, actions:2
6789pkt_mark=0,recirc_id=0,dp_hash=0,skb_priority=0,ct_state=0,ct_zone=0,ct_mark=0,ct_label=0,icmp,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,dl_dst=50:54:00:00:00:0c,nw_src=10.0.0.4,nw_dst=10.0.0.3,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=8,icmp_code=0, actions:drop
c2a77f33 6790])
2be3fe44 6791AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
7d170098 6792skb_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
7d170098 6793skb_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
8c301900
JR
6794])
6795OVS_VSWITCHD_STOP
6796AT_CLEANUP
6797
74cc3969
BP
6798AT_SETUP([ofproto-dpif - datapath port number change])
6799OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6800add_of_ports br0 1
74cc3969
BP
6801
6802# Trace a flow that should output to p1.
6803AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6804 [0], [stdout])
6805AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
6806])
6807
6808# Change p1's port number to 5.
6809AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
6810
6811# Trace a flow that should output to p1 in its new location.
6812AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6813 [0], [stdout])
6814AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
6815])
6816OVS_VSWITCHD_STOP
6817AT_CLEANUP
2d344ba5
AW
6818
6819# Tests the bundling with various bfd and cfm configurations.
6820AT_SETUP([ofproto - bundle with variable bfd/cfm config])
6821OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
6822 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
6823 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
6824 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
6825 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
6826 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
6827 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
6828 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
6829 set Interface p0 cfm_mpid=1 -- \
6830 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
6831
6832ovs-appctl time/stop
6833# advance the clock to stablize everything.
bdba1947 6834ovs-appctl time/warp 5000 100
2d344ba5
AW
6835# cfm/show should show 'recv' fault.
6836AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6837 fault: recv
6838])
6839# bfd/show should show 'up'.
6840AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6841 Local Session State: up
6842 Remote Session State: up
6843 Local Session State: up
6844 Remote Session State: up
6845])
6846# bond/show should show 'may-enable: true' for all slaves.
6847AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6848 may_enable: true
6849 may_enable: true
6850 may_enable: true
6851 may_enable: true
6852])
6853
6854# now disable the bfd on p1.
6855AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
6856# advance the clock to stablize everything.
bdba1947 6857ovs-appctl time/warp 5000 100
2d344ba5
AW
6858# cfm/show should show 'recv' fault.
6859AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6860 fault: recv
6861])
6862# bfd/show should show 'down'.
6863AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6864 Local Session State: down
6865 Remote Session State: down
6866])
6867# bond/show should show 'may-enable: false' for p0.
125bf01d 6868AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2d344ba5
AW
6869 may_enable: false
6870 may_enable: true
2d344ba5
AW
6871])
6872
6873# now enable the bfd on p1 and disable bfd on p0.
6874AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
6875AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
6876# advance the clock to stablize everything.
bdba1947 6877ovs-appctl time/warp 5000 100
2d344ba5
AW
6878# cfm/show should show 'recv' fault.
6879AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6880 fault: recv
6881])
6882# bfd/show should show 'down'.
6883AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6884 Local Session State: down
6885 Remote Session State: down
6886])
6887# bond/show should show 'may-enable: false' for p0 and p1.
6888AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6889 may_enable: false
6890 may_enable: true
6891 may_enable: false
6892 may_enable: true
6893])
6894
e441a806
AW
6895OVS_VSWITCHD_STOP
6896AT_CLEANUP
6897
6898AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
6899OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
6900
6901# enable bfd on p0.
6902AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6903# check log.
1335a8d5 6904OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6905# disable bfd on p0.
6906AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6907# check log.
1335a8d5 6908OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e353c8d1 6909AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
6910
6911# enable cfm on p0.
6912AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
6913# check log.
1335a8d5 6914OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6915# disable cfm on p0.
6916AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
6917# check log.
1335a8d5 6918OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e353c8d1 6919AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
6920
6921# enable both bfd and cfm on p0.
6922AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
6923# check log.
1335a8d5 6924OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6925# disable bfd on p0.
6926AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6927# check log, there should not be the log of thread terminated.
738cd849 6928AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
6929])
6930# reenable bfd on p0.
6931AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6932# check log, should still be on log of thread created.
738cd849 6933AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
6934monitor thread created
6935])
6936# disable bfd and cfm together.
6937AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
6938# check log.
1335a8d5 6939OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
6940
6941OVS_VSWITCHD_STOP
6942AT_CLEANUP
6943
6944# this test helps avoid the deadlock between the main thread and monitor thread.
6945AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
6946OVS_VSWITCHD_START
6947
6948for i in `seq 1 199`
6949do
6950 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])
6951done
6952
98cf638b
AW
6953OVS_VSWITCHD_STOP
6954AT_CLEANUP
98b07853
BP
6955\f
6956AT_BANNER([ofproto-dpif - flow translation resource limits])
6957
6958AT_SETUP([ofproto-dpif - infinite resubmit])
6959OVS_VSWITCHD_START
6960AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 6961AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 6962 [0], [stdout])
fff1b9c0
JR
6963AT_CHECK([tail -1 stdout], [0],
6964 [Translation failed (Recursion too deep), packet is dropped.
98b07853 6965])
fff1b9c0 6966AT_CHECK([grep -c 'resubmit actions recursed over 64 times' stdout],
98b07853
BP
6967 [0], [1
6968])
6969OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
6970AT_CLEANUP
6971
6972AT_SETUP([ofproto-dpif - exponential resubmit chain])
6973OVS_VSWITCHD_START
ca5792f0 6974add_of_ports br0 1
98b07853
BP
6975(for i in `seq 1 64`; do
6976 j=`expr $i + 1`
6977 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6978 done
6979 echo "in_port=65, actions=local") > flows
6980 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 6981AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
6982AT_CHECK([tail -1 stdout], [0],
6983 [Translation failed (Too many resubmits), packet is dropped.
6984])
6985AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
6986])
6987OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
6988AT_CLEANUP
6989
6990AT_SETUP([ofproto-dpif - too many output actions])
6991OVS_VSWITCHD_START
ca5792f0 6992add_of_ports br0 1
98b07853
BP
6993(for i in `seq 1 12`; do
6994 j=`expr $i + 1`
6995 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
6996 done
6997 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
542024c4 6998AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 6999AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
7000AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
7001 [0], [1
98b07853 7002])
fff1b9c0 7003AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 7004])
0f032e95 7005OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
7006AT_CLEANUP
7007
7008AT_SETUP([ofproto-dpif - stack too deep])
7009OVS_VSWITCHD_START
ca5792f0 7010add_of_ports br0 1
98b07853
BP
7011(for i in `seq 1 12`; do
7012 j=`expr $i + 1`
7013 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7014 done
7015 push="push:NXM_NX_REG0[[]]"
7016 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
7017 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 7018AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
7019AT_CHECK([tail -1 stdout], [0],
7020 [Translation failed (Stack too deep), packet is dropped.
7021])
7022AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
7023])
7024OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
7025AT_CLEANUP
d611866c
SH
7026
7027
2608616d 7028AT_SETUP([ofproto-dpif packet-out controller])
d611866c 7029OVS_VSWITCHD_START
ca5792f0 7030add_of_ports br0 1 2
d611866c
SH
7031
7032AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
7033
7034AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7035AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7036
7037for i in 1 2 3; do
7038 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
7039done
7040
7041OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7042AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7043NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7044vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7045dnl
7046NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7047vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7048dnl
7049NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7050vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7051])
7052
7053AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7054 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7055NXST_FLOW reply:
7056])
7057
3c1bb396
BP
7058(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7059 table 0:
8811fc0a
BP
7060 active=1, lookup=0, matched=0
7061
7062 table 1:
7063 active=0, lookup=0, matched=0
7064"
7065 for i in `seq 2 253`; do
7066 printf ' table %d: ditto\n' $i
d611866c
SH
7067 done) > expout
7068AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7069
7070OVS_VSWITCHD_STOP
7071AT_CLEANUP
7072
2608616d 7073AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
7074OVS_VSWITCHD_START(
7075 [-- \
7076 add-port br0 p1 -- \
7077 set interface p1 type=patch options:peer=p2 -- \
7078 add-br br1 -- \
7079 set bridge br1 datapath-type=dummy -- \
7080 set bridge br1 fail-mode=secure -- \
7081 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
7082 add-port br1 p2 -- \
7083 set interface p2 type=patch options:peer=p1 --])
7084
7085AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7086AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7087
7088for i in 1 2 3; do
7089 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
7090done
7091
7092OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7093AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7094NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7095vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7096dnl
7097NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7098vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7099dnl
7100NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7101vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7102])
7103
8811fc0a
BP
7104(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7105 table 0:
7106 active=0, lookup=0, matched=0
7107"
7108 for i in `seq 1 253`; do
7109 printf ' table %d: ditto\n' $i
d611866c
SH
7110 done) > expout
7111AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7112
3c1bb396
BP
7113(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7114 table 0:
8811fc0a
BP
7115 active=0, lookup=3, matched=0
7116
7117 table 1:
7118 active=0, lookup=0, matched=0
7119"
7120 for i in `seq 2 253`; do
7121 printf ' table %d: ditto\n' $i
d611866c
SH
7122 done) > expout
7123AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
7124
7125OVS_VSWITCHD_STOP
7126AT_CLEANUP
7127
7128
2608616d 7129AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 7130OVS_VSWITCHD_START
ca5792f0 7131add_of_ports br0 1 2
d611866c
SH
7132
7133AT_DATA([flows.txt], [dnl
7134table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
7135table=1 dl_dst=50:54:00:00:00:0a actions=controller
7136])
7137AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
7138
7139AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7140AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7141
7142for i in 1 2 3; do
7143 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)'
7144done
7145
7146OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
7147OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7148AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7149NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7150vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7151dnl
7152NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7153vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7154dnl
7155NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7156vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7157])
7158
cea4a6d7 7159AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c
SH
7160AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
7161 n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
7162 table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7163OFPST_FLOW reply (OF1.3):
7164])
7165
3c1bb396
BP
7166(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7167 table 0:
7168 active=1, lookup=3, matched=3
7169
8811fc0a
BP
7170 table 1: ditto
7171 table 2:
7172 active=0, lookup=0, matched=0
7173"
7174 for i in `seq 3 253`; do
7175 printf ' table %d: ditto\n' $i
d611866c
SH
7176 done) > expout
7177AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7178
7179OVS_VSWITCHD_STOP
7180AT_CLEANUP
7181
7182
2608616d 7183AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 7184OVS_VSWITCHD_START
ca5792f0 7185add_of_ports br0 1 2
d611866c 7186
3c1bb396
BP
7187AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
7188AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
7189
7190AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7191AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7192
7193for i in 1 2 3; do
7194 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)'
7195done
7196
7197OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
7198OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7199AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7200NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7201vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7202dnl
7203NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7204vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7205dnl
7206NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7207vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7208])
7209
cea4a6d7 7210AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 7211AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
d611866c 7212 table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 7213OFPST_FLOW reply (OF1.1):
d611866c
SH
7214])
7215
3c1bb396
BP
7216(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7217 table 0:
7218 active=0, lookup=3, matched=0
7219
7220 table 1:
8811fc0a
BP
7221 active=1, lookup=3, matched=3
7222
7223 table 2:
7224 active=0, lookup=0, matched=0
7225"
7226 for i in `seq 3 253`; do
7227 printf ' table %d: ditto\n' $i
d611866c
SH
7228 done) > expout
7229AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7230
7231OVS_VSWITCHD_STOP
7232AT_CLEANUP
b0e2ec32
JR
7233
7234AT_SETUP([ofproto-dpif - ICMPv6])
7235OVS_VSWITCHD_START
ca5792f0 7236add_of_ports br0 1
b0e2ec32
JR
7237
7238AT_CAPTURE_FILE([ofctl_monitor.log])
7239
6409e008 7240AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
7241
7242ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7243
7244OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7245
7246AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7247NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 7248icmp6,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 icmp6_csum:68bd
b0e2ec32
JR
7249])
7250
7251OVS_VSWITCHD_STOP
7252AT_CLEANUP
e60e935b
SRCSA
7253
7254AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
7255OVS_VSWITCHD_START
ca5792f0 7256add_of_ports br0 1
e60e935b
SRCSA
7257AT_CHECK([ovs-ofctl add-flow br0 icmp6,icmpv6_type=135,action=set_field:fe80::1-\>nd_target,set_field:32:21:14:86:11:74-\>nd_sll,output:controller])
7258
7259AT_CAPTURE_FILE([ofctl_monitor.log])
7260
6409e008 7261AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
7262
7263ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7264
7265OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
7266
7267AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7268NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 7269icmp6,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::1,nd_sll=32:21:14:86:11:74,nd_tll=00:00:00:00:00:00 icmp6_csum:19d3
e60e935b
SRCSA
7270])
7271
7272OVS_VSWITCHD_STOP
7273AT_CLEANUP
7274
f171fa88
AW
7275# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
7276AT_SETUP([ofproto-dpif - vlan matching])
7277OVS_VSWITCHD_START(
7278 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
7279AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7280
7281AT_CHECK([ovs-ofctl del-flows br0])
7282AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
7283
7284AT_CHECK([ovs-appctl netdev-dummy/receive p0 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=10,pcp=0),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))'])
7285
47567945 7286OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
2be3fe44 7287AT_CHECK([grep 'in_port=[[1]]' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
f171fa88
AW
7288recirc_id=0,ip,in_port=1,dl_vlan=10,nw_frag=no, actions: <del>
7289])
7290OVS_VSWITCHD_STOP
7291AT_CLEANUP
43b2f131
EJ
7292
7293# Tests in place modification of installed datapath flows.
7294AT_SETUP([ofproto-dpif - in place modification])
7295OVS_VSWITCHD_START(
7296 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7297AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7298
7299AT_CHECK([ovs-ofctl del-flows br0])
7300AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
7301
7302ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7303
7304ovs-appctl time/stop
7305
7306for i in 1 2 3; do
7307 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)'
7308done
7309
3a18d0c2 7310AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
43b2f131
EJ
7311recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
7312])
7313
7314AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
7315
7316ovs-appctl time/warp 500
7317ovs-appctl time/warp 500
7318
7319for i in 1 2 3; do
7320 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)'
7321done
7322
3a18d0c2 7323AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
43b2f131
EJ
7324recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
7325])
7326
38b0b29f 7327AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
43b2f131
EJ
7328dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/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(0x1234), actions:push_vlan(vid=4,pcp=0),100
7329])
7330OVS_VSWITCHD_STOP
7331AT_CLEANUP
449b8131
JR
7332
7333# Tests in place modification of installed datapath flows with vlans.
7334AT_SETUP([ofproto-dpif - in place modification (vlan)])
7335OVS_VSWITCHD_START(
7336 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7337AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7338
7339AT_CHECK([ovs-ofctl del-flows br0])
7340AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
7341
7342ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7343
7344ovs-appctl time/stop
7345
7346# Check that a correct datapath flow is created.
7347for i in 1 2 3; do
7348 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)'
7349done
7350
3a18d0c2 7351AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7352recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:100
7353])
7354
7355# Delete the flow. Then check that the datapath flow is modified to
7356# drop the packets. A modified flow inherits the stats, a new
7357# datapath flow would start from sero.
7358AT_CHECK([ovs-ofctl del-flows br0])
7359
7360ovs-appctl time/warp 500
7361ovs-appctl time/warp 500
7362
7363for i in 1 2 3; do
7364 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)'
7365done
7366
3a18d0c2 7367AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7368recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:drop
7369])
7370
7371# Add a flow that matches the non-presence of a vlan tag, and check
7372# that the datapath flow is modified accordingly.
7373AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
7374
7375ovs-appctl time/warp 500
7376ovs-appctl time/warp 500
7377
7378for i in 1 2 3; do
7379 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)'
7380done
7381
3a18d0c2 7382AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7383recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
7384])
7385
7386# Check that VLAN packets will not hit the same datapath megaflow.
7387for i in 1 2 3; do
7388 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=99,pcp=7),encap(eth_type(0x1234))'
7389done
7390
3a18d0c2 7391AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7392recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
7393recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99/0x0,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:120, used:0.0s, actions:drop
7394])
7395
7396# Check that the new flow matches the CFI bit, while both vid and pcp
7397# are wildcarded.
38b0b29f 7398AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
449b8131
JR
7399dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0x0000,dl_type=0x1234, actions:100
7400dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/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(0x1234)
7401dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/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(0x1234), actions:100
7402dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0xf063/0x1000,dl_type=0x1234, actions:drop
7403])
7404OVS_VSWITCHD_STOP
7405AT_CLEANUP