]> git.proxmox.com Git - ovs.git/blame - tests/ofproto-dpif.at
dpif-netdev.at: Run tests with dummy-pmd.
[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
3a6e67fa 440 AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:0$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])
0c4b9393
SH
441 tail -1 stdout >> results
442done
443sort results | uniq -c
3a6e67fa
BP
444AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0],
445 [Datapath actions: 1?
0c4b9393
SH
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])
d9c8c57c 726OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
f0fd1a17 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
ace39a6f
JS
785dnl As of OVS-2.5, a note action after 4 set_field actions are likely to
786dnl trigger ofpbuf reallocation during decode (~1KB into ofpacts buffer).
787dnl Using `make check-valgrind' here checks for use-after-free in this
788dnl codepath.
789AT_SETUP([ofproto-dpif - note action deep inside ofpacts])
790OVS_VSWITCHD_START
791AT_CHECK([ovs-ofctl add-flow br0 'actions=set_field:0x1->metadata,set_field:0x2->metadata,set_field:0x3->metadata,set_field:0x4->metadata,note:00000000000000000000000000000000,note:00000000000000000000000000000000'])
792OVS_VSWITCHD_STOP
793AT_CLEANUP
794
77750738 795AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
e44768b7 796OVS_VSWITCHD_START
ca5792f0 797add_of_ports br0 1 2
77750738 798
77750738
JP
799AT_CHECK([ovs-ofctl add-flow br0 action=normal])
800
801# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 802flow="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 803AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
72d64e33
EJ
804AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //' | tr "," "\n" | sort -n], [0], [dnl
8051
8062
807100
808])
77750738
JP
809
810OVS_VSWITCHD_STOP
811AT_CLEANUP
812
8b36f51e 813AT_SETUP([ofproto-dpif - DSCP])
8b36f51e 814OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy])
ca5792f0 815add_of_ports br0 9
8b36f51e 816AT_DATA([flows.txt], [dnl
bdda5aca 817actions=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
818])
819AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
820AT_CHECK([ovs-vsctl -- \
821 set Port p1 qos=@newqos --\
822 --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\
823 --id=@q1 create Queue dscp=1 --\
824 --id=@q2 create Queue dscp=2], [0], [ignore])
50aa28fd 825AT_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 826AT_CHECK([tail -2 stdout], [0],
d23df9a8 827 [Megaflow: recirc_id=0,skb_priority=0,ip,in_port=9,nw_tos=252,nw_frag=no
ce58df5b 828Datapath actions: dnl
e44768b7 829100,dnl
d23df9a8
JR
830set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
831set(ipv4(tos=0x8/0xfc)),set(skb_priority(0x2)),1,dnl
8b36f51e 8321,dnl
d23df9a8
JR
833set(ipv4(tos=0x4/0xfc)),set(skb_priority(0x1)),1,dnl
834set(ipv4(tos=0xfc/0xfc)),set(skb_priority(0)),1,dnl
835set(ipv4(tos=0/0xfc)),1,100
8b36f51e
EJ
836])
837OVS_VSWITCHD_STOP
838AT_CLEANUP
839
fd19297b 840AT_SETUP([ofproto-dpif - output/flood flags])
f7b8e494 841OVS_VSWITCHD_START
ca5792f0 842add_of_ports br0 1 2 3 4 5 6 7
fd19297b
EJ
843
844AT_DATA([flows.txt], [dnl
a0fbe94a 845in_port=local actions=local,flood
fd19297b
EJ
846in_port=1 actions=flood
847in_port=2 actions=all
bdda5aca
BP
848in_port=3 actions=output:LOCAL,output:1,output:2,output:3,output:4,output:5,output:6,output:7
849in_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
850])
851AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
852AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
853AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
854
50aa28fd 855AT_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
856AT_CHECK([tail -1 stdout \
857| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
8581
8592
8603
8614
8627
863])
864
50aa28fd 865AT_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
866AT_CHECK([tail -1 stdout \
867| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
e44768b7 868100
fd19297b
EJ
8692
8703
8714
8727
873])
874
50aa28fd 875AT_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
876AT_CHECK([tail -1 stdout \
877| sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
fd19297b 8781
e44768b7 879100
fd19297b
EJ
8803
8814
8826
8837
884])
885
50aa28fd 886AT_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 887AT_CHECK([tail -1 stdout], [0],
e44768b7 888 [Datapath actions: 100,1,2,4,6,7
fd19297b
EJ
889])
890
50aa28fd 891AT_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 892AT_CHECK([tail -1 stdout], [0],
1b567fb9 893 [Datapath actions: set(skb_priority(0x1)),100,1,2,set(skb_priority(0x2)),3,set(skb_priority(0x1)),6,7
fd19297b
EJ
894])
895OVS_VSWITCHD_STOP
896AT_CLEANUP
897
6b83a3c5 898AT_SETUP([ofproto-dpif - Default Table Miss - OF1.0 (OFPTC_TABLE_MISS_CONTROLLER)])
6d328fa2
SH
899OVS_VSWITCHD_START([dnl
900 add-port br0 p1 -- set Interface p1 type=dummy
901])
53eb8cb8 902on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
903
904AT_CAPTURE_FILE([ofctl_monitor.log])
905
6409e008 906AT_CHECK([ovs-ofctl -P nxt_packet_in monitor br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
907
908for i in 1 2 3 ; do
ea2735d3 909 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 910done
8bd16974 911OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 912OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
913AT_CHECK([cat ofctl_monitor.log], [0], [dnl
914NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 915tcp,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
916dnl
917NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 918tcp,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
919dnl
920NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 921tcp,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
922])
923
924AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
925AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
926NXST_FLOW reply:
927])
928
929OVS_VSWITCHD_STOP
930AT_CLEANUP
931
6b83a3c5
SH
932AT_SETUP([ofproto-dpif - Default Table Miss - OF1.3 (OFPTC_TABLE_MISS_DROP)])
933OVS_VSWITCHD_START([dnl
934 add-port br0 p1 -- set Interface p1 type=dummy
935])
53eb8cb8 936on_exit 'kill `cat ovs-ofctl.pid`'
6b83a3c5
SH
937
938AT_CAPTURE_FILE([ofctl_monitor.log])
939AT_CHECK([ovs-ofctl del-flows br0])
940
6409e008 941AT_CHECK([ovs-ofctl monitor -OOpenFlow13 -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6b83a3c5
SH
942
943dnl Test that missed packets are droped
944for i in 1 2 3 ; do
ea2735d3 945 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 946done
d9c8c57c 947OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6b83a3c5
SH
948
949AT_CHECK([cat ofctl_monitor.log], [0], [dnl
950])
951
952AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
953AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
954OFPST_FLOW reply (OF1.3):
955])
956
957OVS_VSWITCHD_STOP
958AT_CLEANUP
959
6d328fa2
SH
960AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTROLLER])
961OVS_VSWITCHD_START([dnl
962 add-port br0 p1 -- set Interface p1 type=dummy
963])
53eb8cb8 964on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
965
966AT_CAPTURE_FILE([ofctl_monitor.log])
967AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
968
6409e008 969AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
970
971for i in 1 2 3 ; do
8e4c1621 972 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 973done
8bd16974 974OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 975OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
976AT_CHECK([cat ofctl_monitor.log], [0], [dnl
977OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 978tcp,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
979dnl
980OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 981tcp,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
982dnl
983OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 984tcp,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
985])
986
cea4a6d7 987AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
988AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
989 n_packets=3, n_bytes=180, actions=goto_table:1
990OFPST_FLOW reply (OF1.2):
991])
992
993OVS_VSWITCHD_STOP
994AT_CLEANUP
995
996AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTROLLER])
997OVS_VSWITCHD_START([dnl
998 add-port br0 p1 -- set Interface p1 type=dummy
999])
53eb8cb8 1000on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1001
1002AT_CAPTURE_FILE([ofctl_monitor.log])
1003AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1004
6409e008 1005AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1006
1007for i in 1 2 3 ; do
1008 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)'
1009done
1010
d9c8c57c 1011OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1012AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1013])
1014
cea4a6d7 1015AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1016AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1017 n_packets=3, n_bytes=180, actions=resubmit(1,1)
1018OFPST_FLOW reply (OF1.2):
1019])
1020
1021OVS_VSWITCHD_STOP
1022AT_CLEANUP
1023
1024AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_CONTINUE])
1025OVS_VSWITCHD_START([dnl
1026 add-port br0 p1 -- set Interface p1 type=dummy
1027])
53eb8cb8 1028on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1029
1030AT_CAPTURE_FILE([ofctl_monitor.log])
1031AT_CHECK([ovs-ofctl add-flow br0 'table=1 dl_src=10:11:11:11:11:11 actions=controller'])
1032AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1033
1034dnl Miss table 0, Hit table 1
6409e008 1035AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1036
1037for i in 1 2 3 ; do
1038 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)'
1039done
8bd16974 1040OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1041OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1042
1043AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1044NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1045tcp,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
1046dnl
1047NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1048tcp,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
1049dnl
1050NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1051tcp,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
1052])
1053
1054dnl Hit table 0, Miss all other tables, sent to controller
6409e008 1055AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1056
1057for i in 1 2 3 ; do
1058 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)'
1059done
8bd16974 1060OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1061OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1062
1063AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1064NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1065tcp,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
1066dnl
1067NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1068tcp,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
1069dnl
1070NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1071tcp,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
1072])
1073
cea4a6d7 1074AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1075AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1076 table=1, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1077OFPST_FLOW reply (OF1.2):
1078])
1079
1080OVS_VSWITCHD_STOP
1081AT_CLEANUP
1082
1083AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_CONTINUE])
1084OVS_VSWITCHD_START([dnl
1085 add-port br0 p1 -- set Interface p1 type=dummy
1086])
53eb8cb8 1087on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1088
1089AT_CAPTURE_FILE([ofctl_monitor.log])
1090AT_DATA([flows.txt], [dnl
1091table=0 actions=goto_table(1)
1092table=2 dl_src=10:11:11:11:11:11 actions=controller
1093])
1094AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1095AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1096
1097dnl Hit table 0, Miss table 1, Hit table 2
6409e008 1098AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1099
1100for i in 1 2 3 ; do
1101 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)'
1102done
8bd16974 1103OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1104OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1105
1106AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1107NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1108tcp,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
1109dnl
1110NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1111tcp,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
1112dnl
1113NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1114tcp,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
1115])
1116
1117dnl Hit table 1, Miss all other tables, sent to controller
6409e008 1118AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1119
1120for i in 1 2 3 ; do
1121 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)'
1122done
8bd16974 1123OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1124OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1125
1126AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1127NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1128tcp,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
1129dnl
1130NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1131tcp,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
1132dnl
1133NXT_PACKET_IN (xid=0x0): table_id=253 cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1134tcp,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
1135])
1136
cea4a6d7 1137AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1138AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1139 n_packets=6, n_bytes=360, actions=goto_table:1
1140 table=2, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1141OFPST_FLOW reply (OF1.2):
1142])
1143
1144OVS_VSWITCHD_STOP
1145AT_CLEANUP
1146
1147AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_CONTINUE])
1148OVS_VSWITCHD_START([dnl
1149 add-port br0 p1 -- set Interface p1 type=dummy
1150])
53eb8cb8 1151on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1152
1153AT_CAPTURE_FILE([ofctl_monitor.log])
1154AT_DATA([flows.txt], [dnl
1155table=0 actions=resubmit(1,1)
1156table=2 dl_src=10:11:11:11:11:11 actions=controller
1157])
1158AT_CHECK([ovs-ofctl -OOpenFlow12 add-flows br0 flows.txt])
1159AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all continue])
1160
1161dnl Hit table 0, Miss table 1, Dropped
6409e008 1162AT_CHECK([ovs-ofctl monitor br0 65534 -P standard --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1163
1164for i in 1 2 3 ; do
1165 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)'
1166done
0c473314 1167OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
6d328fa2
SH
1168
1169AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1170])
1171
1172dnl Hit table 1, Dropped
6409e008 1173AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1174
1175for i in 1 2 3 ; do
1176 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)'
1177done
d9c8c57c 1178OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1179
1180AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1181])
1182
cea4a6d7 1183AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1184AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1185 n_packets=6, n_bytes=360, actions=resubmit(1,1)
1186 table=2, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1187OFPST_FLOW reply (OF1.2):
1188])
1189
1190OVS_VSWITCHD_STOP
1191AT_CLEANUP
1192
1193AT_SETUP([ofproto-dpif - Table Miss - OFPTC_TABLE_MISS_DROP])
1194OVS_VSWITCHD_START([dnl
1195 add-port br0 p1 -- set Interface p1 type=dummy
1196])
53eb8cb8 1197on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1198
1199AT_CAPTURE_FILE([ofctl_monitor.log])
1200AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1201
6409e008 1202AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1203
1204dnl Test that missed packets are droped
1205for i in 1 2 3 ; do
1206 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)'
1207done
d9c8c57c 1208OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1209
1210AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1211])
1212
1213AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1214AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1215NXST_FLOW reply:
1216])
1217
1218OVS_VSWITCHD_STOP
1219AT_CLEANUP
1220
1221AT_SETUP([ofproto-dpif - Table Miss - goto table and OFPTC_TABLE_MISS_DROP])
1222OVS_VSWITCHD_START([dnl
1223 add-port br0 p1 -- set Interface p1 type=dummy
1224])
53eb8cb8 1225on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1226
1227AT_CAPTURE_FILE([ofctl_monitor.log])
1228AT_CHECK([ovs-ofctl del-flows br0])
1229AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=goto_table(1)'])
1230AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1231
6409e008 1232AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1233
1234dnl Test that missed packets are droped
1235for i in 1 2 3 ; do
1236 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)'
1237done
d9c8c57c 1238OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1239
1240AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1241])
1242
cea4a6d7 1243AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1244AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1245 n_packets=3, n_bytes=180, actions=goto_table:1
1246OFPST_FLOW reply (OF1.2):
1247])
1248
1249OVS_VSWITCHD_STOP
1250AT_CLEANUP
1251
1252AT_SETUP([ofproto-dpif - Table Miss - resubmit and OFPTC_TABLE_MISS_DROP])
1253OVS_VSWITCHD_START([dnl
1254 add-port br0 p1 -- set Interface p1 type=dummy
1255])
53eb8cb8 1256on_exit 'kill `cat ovs-ofctl.pid`'
6d328fa2
SH
1257
1258AT_CAPTURE_FILE([ofctl_monitor.log])
1259AT_CHECK([ovs-ofctl del-flows br0])
1260AT_CHECK([ovs-ofctl -OOpenFlow12 add-flow br0 'table=0 actions=resubmit(1,1)'])
1261AT_CHECK([ovs-ofctl -OOpenFlow11 mod-table br0 all drop])
1262
6409e008 1263AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
6d328fa2
SH
1264
1265dnl Test that missed packets are droped
1266for i in 1 2 3 ; do
1267 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)'
1268done
d9c8c57c 1269OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
6d328fa2
SH
1270
1271AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1272])
1273
cea4a6d7 1274AT_CHECK([ovs-appctl revalidator/purge], [0])
6d328fa2
SH
1275AT_CHECK([ovs-ofctl -OOpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
1276 n_packets=3, n_bytes=180, actions=resubmit(1,1)
1277OFPST_FLOW reply (OF1.2):
1278])
1279
1280OVS_VSWITCHD_STOP
1281AT_CLEANUP
1282
15056dc8
EJ
1283AT_SETUP([ofproto-dpif - controller])
1284OVS_VSWITCHD_START([dnl
1285 add-port br0 p1 -- set Interface p1 type=dummy
1286])
53eb8cb8 1287on_exit 'kill `cat ovs-ofctl.pid`'
15056dc8
EJ
1288
1289AT_CAPTURE_FILE([ofctl_monitor.log])
1290AT_DATA([flows.txt], [dnl
1291cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
54834960 1292cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
15056dc8
EJ
1293cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
1294
54834960
EJ
1295cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
1296cookie=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)
1297cookie=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)
1298cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
1299cookie=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)
1300cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
1301cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
78cef7fd 1302cookie=0xa dl_src=40:44:44:44:44:41 actions=mod_vlan_vid:99,mod_vlan_pcp:1,controller
56d72f37 1303cookie=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
1304])
1305AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1306
1307dnl Flow miss.
6409e008 1308AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1309
1310for i in 1 2 3 ; do
dc235f7f 1311 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 1312done
57c94f35 1313OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1314OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1315
15056dc8 1316AT_CHECK([cat ofctl_monitor.log], [0], [dnl
f0fd1a17 1317OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1318tcp,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 1319dnl
f0fd1a17 1320OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1321tcp,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 1322dnl
f0fd1a17 1323OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 1324tcp,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
1325])
1326
1327dnl Singleton controller action.
6409e008 1328AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1329
1330for i in 1 2 3 ; do
dc235f7f 1331 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 1332done
57c94f35 1333OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1334OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1335
15056dc8
EJ
1336AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1337OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1338tcp,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
1339dnl
1340OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1341tcp,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
1342dnl
1343OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1344tcp,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
1345])
1346
1347dnl Modified controller action.
6409e008 1348AT_CHECK([ovs-ofctl monitor -P standard br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
15056dc8
EJ
1349
1350for i in 1 2 3 ; do
dc235f7f 1351 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 1352done
57c94f35 1353OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1354OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
15056dc8 1355
15056dc8
EJ
1356AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1357OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1358tcp,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
1359dnl
1360OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1361tcp,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
1362dnl
1363OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1364tcp,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
1365])
1366
363dd1d9 1367dnl Modified VLAN controller action.
6409e008 1368AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
363dd1d9
JS
1369
1370for i in 1 2 3; do
8249a1fe 1371 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 1372done
57c94f35 1373OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1374OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
363dd1d9 1375
363dd1d9
JS
1376AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1377NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1378ip,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
1379dnl
1380NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1381ip,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
1382dnl
1383NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1384ip,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
1385])
1386
349fbdc2 1387dnl Checksum TCP.
6409e008 1388AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1389
1390for i in 1 ; do
1391 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)'
1392done
1393OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1394OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1395
1396AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1397NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1398tcp,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 1399dnl
50dcbd8e 1400NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1401tcp,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 1402dnl
50dcbd8e 1403NXT_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 1404tcp,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 1405dnl
50dcbd8e 1406NXT_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 1407tcp,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 1408dnl
50dcbd8e 1409NXT_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 1410tcp,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 1411dnl
50dcbd8e 1412NXT_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 1413tcp,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 1414dnl
50dcbd8e 1415NXT_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 1416tcp,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 1417dnl
50dcbd8e 1418NXT_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 1419tcp,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 1420dnl
50dcbd8e 1421NXT_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 1422tcp,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
1423])
1424
1425dnl Checksum UDP.
6409e008 1426AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1427
1428for i in 1 ; do
1429 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'
1430done
1431OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1432OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1433
1434AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1435NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1436udp,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 1437dnl
50dcbd8e 1438NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 reg0=0x1,in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1439udp,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 1440dnl
50dcbd8e 1441NXT_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 1442udp,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 1443dnl
50dcbd8e 1444NXT_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 1445udp,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 1446dnl
50dcbd8e 1447NXT_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 1448udp,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 1449dnl
50dcbd8e 1450NXT_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 1451udp,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 1452dnl
50dcbd8e 1453NXT_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 1454udp,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 1455dnl
50dcbd8e 1456NXT_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 1457udp,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 1458dnl
50dcbd8e 1459NXT_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 1460udp,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
1461])
1462
1463dnl Modified ARP controller action.
6409e008 1464AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1465
1466for i in 1 2 3; do
1467 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)'
1468done
1469
368a198a 1470OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1471OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1472AT_CHECK([cat ofctl_monitor.log], [0], [dnl
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=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 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.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 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=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 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=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 1481NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1482arp,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 1483NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1484arp,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 1485NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1486arp,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 1487NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1488arp,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 1489NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1490arp,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
1491])
1492
1493AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1494
1495dnl Checksum SCTP.
6409e008 1496AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
349fbdc2
SH
1497
1498for i in 1 ; do
1499 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'
1500done
1501
f7a22c7e 1502AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
349fbdc2 1503OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 18])
d9c8c57c 1504OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
349fbdc2
SH
1505AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1506NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=98 in_port=1 (via action) data_len=98 (unbuffered)
e6d9ab56 1507sctp,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 1508dnl
50dcbd8e 1509NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=102 reg0=0x1,in_port=1 (via action) data_len=102 (unbuffered)
e6d9ab56 1510sctp,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 1511dnl
50dcbd8e 1512NXT_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 1513sctp,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 1514dnl
50dcbd8e 1515NXT_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 1516sctp,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 1517dnl
50dcbd8e 1518NXT_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 1519sctp,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 1520dnl
50dcbd8e 1521NXT_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 1522sctp,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 1523dnl
50dcbd8e 1524NXT_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 1525sctp,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 1526dnl
50dcbd8e 1527NXT_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 1528sctp,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 1529dnl
50dcbd8e 1530NXT_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 1531sctp,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
1532])
1533
1534AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
1535 cookie=0x1, n_packets=3, n_bytes=218, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1)
1536 cookie=0x2, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535
1537 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)
1538 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)
1539 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)
1540 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)
1541 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)
1542 cookie=0x8, table=6, n_packets=3, n_bytes=218, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7)
1543 cookie=0x9, table=7, n_packets=3, n_bytes=218, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
1544 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
1545 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
1546 n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
1547NXST_FLOW reply:
1548])
1549
1550OVS_VSWITCHD_STOP
1551AT_CLEANUP
1552
1553AT_SETUP([ofproto-dpif - MPLS handling])
1554OVS_VSWITCHD_START([dnl
1555 add-port br0 p1 -- set Interface p1 type=dummy
1556])
53eb8cb8 1557on_exit 'kill `cat ovs-ofctl.pid`'
349fbdc2
SH
1558
1559AT_CAPTURE_FILE([ofctl_monitor.log])
1560AT_DATA([flows.txt], [dnl
1561cookie=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
1562cookie=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
1563cookie=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
1564cookie=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
1565cookie=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
1566cookie=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
1567cookie=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
1568cookie=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 1569cookie=0xa mpls,dl_src=40:44:44:44:44:49 actions=push_mpls:0x8848,load:10->OXM_OF_MPLS_LABEL[[]],CONTROLLER:65535
349fbdc2
SH
1570cookie=0xb dl_src=50:55:55:55:55:55 dl_type=0x8847 actions=load:1000->OXM_OF_MPLS_LABEL[[]],controller
1571cookie=0xd dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,controller
1572cookie=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
1573
1574cookie=0xd dl_src=60:66:66:66:00:01 actions=pop_mpls:0x0800,dec_ttl,controller
1575cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
1576cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
1577cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
961cf8e0 1578cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller
1ffd16af
SH
1579cookie=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
1580cookie=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
1581
1582cookie=0xd dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
1583cookie=0xd table=1 arp actions=controller
1584
e672ff9b
JR
1585cookie=0xdeadbeef table=2 dl_src=60:66:66:66:00:09 actions=pop_mpls:0x0800,mod_nw_tos:48
1586cookie=0xd dl_src=60:66:66:66:00:09 actions=resubmit(,2),controller
1ffd16af
SH
1587cookie=0xd dl_src=60:66:66:66:00:0a actions=pop_mpls:0x0800,mod_nw_dst:10.0.0.1,controller
1588cookie=0xd dl_src=60:66:66:66:00:0b actions=pop_mpls:0x0800,mod_nw_src:10.0.0.1,controller
1589
1590cookie=0xd dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,controller
1591cookie=0xd dl_src=60:66:66:66:01:01 actions=pop_mpls:0x8847,dec_mpls_ttl,controller
1592cookie=0xd dl_src=60:66:66:66:01:02 actions=pop_mpls:0x8848,load:3->OXM_OF_MPLS_TC[[]],controller
1593
1594cookie=0xd dl_src=60:66:66:66:02:00 actions=pop_mpls:0x8847,pop_mpls:0x0800,controller
e672ff9b
JR
1595cookie=0xe dl_src=60:66:66:66:02:01 actions=pop_mpls:0x8848,pop_mpls:0x0800,dec_ttl,controller
1596cookie=0xe dl_src=60:66:66:66:02:10 actions=pop_mpls:0x8847,dec_mpls_ttl,pop_mpls:0x0800,dec_ttl,controller
1ffd16af 1597
e672ff9b
JR
1598cookie=0xe dl_src=60:66:66:66:03:00 actions=pop_mpls:0x8848,pop_mpls:0x8848,controller
1599cookie=0xe dl_src=60:66:66:66:03:01 actions=pop_mpls:0x8847,pop_mpls:0x8847,dec_mpls_ttl,controller
1600cookie=0xe dl_src=60:66:66:66:03:10 actions=pop_mpls:0x8848,dec_mpls_ttl,pop_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1601
e672ff9b
JR
1602cookie=0xf dl_src=60:66:66:66:04:00 actions=pop_mpls:0x0800,push_mpls:0x8847,controller
1603cookie=0xf dl_src=60:66:66:66:04:01 actions=pop_mpls:0x0800,push_mpls:0x8848,dec_mpls_ttl,controller
1604cookie=0xf dl_src=60:66:66:66:04:10 actions=pop_mpls:0x0800,dec_ttl,push_mpls:0x8848,dec_mpls_ttl,controller
1ffd16af 1605
e672ff9b
JR
1606cookie=0x5 dl_src=60:66:66:66:05:00 actions=push_mpls:0x8848,pop_mpls:0x8847,controller
1607cookie=0x5 dl_src=60:66:66:66:05:01 actions=push_mpls:0x8847,pop_mpls:0x8848,dec_mpls_ttl,controller
1608cookie=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
1609])
1610AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
1611
b02475c5 1612dnl Modified MPLS controller action.
6409e008 1613AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1614
1615for i in 1 2 3; do
791a09be 1616 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 1617done
57c94f35 1618OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1619OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1620
b02475c5
SH
1621AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1622NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1623mpls,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
1624dnl
1625NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1626mpls,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
1627dnl
1628NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1629mpls,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
1630])
1631
1632dnl Modified MPLS controller action.
6409e008 1633AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5 1634
b0a17866 1635for i in 1 2 3; do
8249a1fe 1636 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
1637done
1638OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1639OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b0a17866
SH
1640
1641AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1642NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1643ip,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
1644dnl
1645NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1646ip,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
1647dnl
1648NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1649ip,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
1650])
1651
1652dnl Modified MPLS controller action.
6409e008 1653AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b0a17866 1654
b02475c5
SH
1655dnl 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)
1656
1657for i in 1 2 3; do
1658 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)'
1659done
bece9ea7 1660OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1661OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
bece9ea7 1662
b02475c5
SH
1663AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1664NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1665mpls,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
1666dnl
1667NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1668mpls,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
1669dnl
1670NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1671mpls,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
1672])
1673
1674dnl Modified MPLS controller action.
6409e008 1675AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1676
1677for i in 1 2 3; do
8249a1fe 1678 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 1679done
57c94f35 1680OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1681OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1682
b02475c5
SH
1683AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1684NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1685mpls,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
1686dnl
1687NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1688mpls,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
1689dnl
1690NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1691mpls,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
1692])
1693
b676167a 1694dnl Modified MPLS controller action.
6409e008 1695AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b676167a
SH
1696
1697for i in 1 2 3; do
8249a1fe 1698 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 1699done
57c94f35 1700OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1701OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b676167a 1702
b676167a
SH
1703AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1704NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1705mpls,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
1706dnl
1707NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1708mpls,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
1709dnl
1710NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1711mpls,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
1712])
1713
0f3f3c3d 1714dnl Modified MPLS controller action.
6409e008 1715AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1716
1717for i in 1 2 3; do
8249a1fe 1718 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 1719done
57c94f35 1720OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1721OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1722
0f3f3c3d
SH
1723AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1724NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1725mpls,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
1726dnl
1727NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1728mpls,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
1729dnl
1730NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1731mpls,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
1732])
1733
1734dnl Modified MPLS controller action.
6409e008 1735AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1736
1737for i in 1 2 3; do
8249a1fe 1738 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 1739done
57c94f35 1740OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1741OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1742
0f3f3c3d
SH
1743AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1744NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1745mpls,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
1746dnl
1747NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1748mpls,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
1749dnl
1750NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1751mpls,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
1752])
1753
1ffd16af
SH
1754AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1755
1756dnl Modified MPLS controller action.
6409e008 1757AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1758
1759for i in 1 2 3; do
1760 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)'
1761done
1762OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 1763OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
1ffd16af
SH
1764
1765AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1766NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1767mplsm,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
1768dnl
1769NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1770mplsm,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
1771dnl
1772NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1773mplsm,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
1774])
1775
1776AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1777
0f3f3c3d 1778dnl Modified MPLS controller action.
6409e008 1779AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
0f3f3c3d
SH
1780
1781for i in 1 2 3; do
8249a1fe 1782 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 1783done
57c94f35 1784OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1785OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
0f3f3c3d 1786
0f3f3c3d
SH
1787AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1788NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1789mpls,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
1790dnl
1791NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1792mpls,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
1793dnl
1794NXT_PACKET_IN (xid=0x0): cookie=0xa total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1795mpls,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
1796])
1797
b02475c5 1798dnl Modified MPLS actions.
6409e008 1799AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1800
1801for i in 1 2 3; do
02830175 1802 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 1803done
57c94f35 1804OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1805OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1806
b02475c5
SH
1807AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1808NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1809mpls,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
1810dnl
1811NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1812mpls,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
1813dnl
1814NXT_PACKET_IN (xid=0x0): cookie=0xb total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 1815mpls,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
1816])
1817
1818dnl Modified MPLS ipv6 controller action.
6409e008 1819AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1820
1821for i in 1 2 3; do
1822 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)'
1823done
57c94f35 1824OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1825OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1826
b02475c5
SH
1827AT_CHECK([cat ofctl_monitor.log], [0], [dnl
1828NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1829mplsm,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
1830dnl
1831NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1832mplsm,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
1833dnl
1834NXT_PACKET_IN (xid=0x0): cookie=0xc total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 1835mplsm,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
1836])
1837
1838
1839dnl Modified MPLS pop action.
cff78c88
SH
1840dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
1841dnl 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)
1842dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44)
1843
6409e008 1844AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
b02475c5
SH
1845
1846for i in 1 2 3; do
cff78c88 1847 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 1848done
cff78c88
SH
1849#for i in 2 3; do
1850# 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)'
1851#done
57c94f35 1852OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
0c473314 1853OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
b02475c5 1854
b02475c5 1855AT_CHECK([cat ofctl_monitor.log], [0], [dnl
cff78c88 1856NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1857tcp,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 1858dnl
cff78c88 1859NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1860tcp,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 1861dnl
cff78c88 1862NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1863tcp,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
1864])
1865
5c0243a9 1866AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
0d56eaf2 1867
1ffd16af
SH
1868dnl Modified MPLS pop action.
1869dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1870dnl 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)
1871dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1872dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1873AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1874
1875for i in 1 2 3; do
1876 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'
1877done
1878OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1879OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1880
2be3fe44 1881AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1882NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1883tcp,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 1884dnl
e672ff9b 1885NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1886tcp,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 1887dnl
e672ff9b 1888NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1889tcp,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
1890])
1891
1892AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1893
1894dnl Modified MPLS pop action.
1895dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1896dnl 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)
1897dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1898dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1899AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1900
1901for i in 1 2 3; do
1902 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'
1903done
1904OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1905OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1906
2be3fe44 1907AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1908NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1909tcp,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 1910dnl
e672ff9b 1911NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1912tcp,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 1913dnl
e672ff9b 1914NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1915tcp,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
1916])
1917
1918AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1919
1920dnl Modified MPLS pop action.
1921dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1922dnl 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)
1923dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1924dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1925AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1926
1927for i in 1 2 3; do
1928 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'
1929done
1930OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1931OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1932
2be3fe44 1933AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1934NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1935tcp,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 1936dnl
e672ff9b 1937NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1938tcp,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 1939dnl
e672ff9b 1940NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1941tcp,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
1942])
1943
1944AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1945
1946dnl Modified MPLS pop action.
1947dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1948dnl 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)
1949dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1950dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1951AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1952
1953for i in 1 2 3; do
1954 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'
1955done
1956OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1957OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1958
2be3fe44 1959AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1960NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1961tcp,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 1962dnl
e672ff9b 1963NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1964tcp,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 1965dnl
e672ff9b 1966NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 1967tcp,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
1968])
1969
1970AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1971
1972dnl Modified MPLS pop action.
1973dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
1974dnl 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)
1975dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
1976dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 1977AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
1978
1979for i in 1 2 3; do
1980 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'
1981done
1982OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
1983OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
1984
2be3fe44 1985AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 1986NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 1987tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,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 1988dnl
e672ff9b 1989NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 1990tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,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 1991dnl
e672ff9b 1992NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
961cf8e0 1993tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,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
1994])
1995
1996AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
1997
1998dnl Modified MPLS pop action.
1999dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2000dnl 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)
2001dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2002dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2003AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2004
2005for i in 1 2 3; do
2006 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'
2007done
2008OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2009OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2010
2be3fe44 2011AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2012NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2013tcp,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 2014dnl
e672ff9b 2015NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2016tcp,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 2017dnl
e672ff9b 2018NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2019tcp,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
2020])
2021
2022AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2023
2024dnl Modified MPLS pop action.
2025dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2026dnl 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)
2027dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2028dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2029AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2030
2031for i in 1 2 3; do
2032 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'
2033done
2034OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2035OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2036
2be3fe44 2037AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2038NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2039tcp,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 2040dnl
e672ff9b 2041NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2042tcp,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 2043dnl
e672ff9b 2044NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2045tcp,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
2046])
2047
2048AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2049
2050dnl Modified MPLS pop action.
2051dnl The input is an ARP frame with a single MPLS label stack entry which tcpdump -vve shows as:
2052dnl 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 2053AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2054
2055for i in 1 2 3; do
2056 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'
2057done
2058OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2059OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2060
2be3fe44 2061AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2062NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2063arp,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
2064dnl
2065NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2066arp,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
2067dnl
2068NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0xd total_len=56 in_port=1 (via action) data_len=56 (unbuffered)
e6d9ab56 2069arp,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
2070])
2071
2072AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2073
2074dnl Modified MPLS pop action.
2075dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2076dnl 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)
2077dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2078dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2079AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2080
2081for i in 1 2 3; do
2082 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'
2083done
2084OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2085OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2086
2be3fe44 2087AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2088NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2089tcp,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 2090dnl
e672ff9b 2091NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2092tcp,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 2093dnl
e672ff9b 2094NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2095tcp,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
2096])
2097
2098AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2099
2100dnl Modified MPLS pop action.
2101dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2102dnl 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)
2103dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2104dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2105AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2106
2107for i in 1 2 3; do
2108 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'
2109done
2110OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2111OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2112
2be3fe44 2113AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2114NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2115tcp,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 2116dnl
e672ff9b 2117NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2118tcp,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 2119dnl
e672ff9b 2120NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2121tcp,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
2122])
2123
2124AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2125
2126dnl Modified MPLS pop action.
2127dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2128dnl 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)
2129dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2130dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2131AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2132
2133for i in 1 2 3; do
2134 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'
2135done
2136OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2137OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2138
2be3fe44 2139AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2140NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2141tcp,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 2142dnl
e672ff9b 2143NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2144tcp,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 2145dnl
e672ff9b 2146NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2147tcp,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
2148])
2149
2150AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2151
2152dnl Modified MPLS pop action.
2153dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2154dnl 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)
2155dnl (label 20, exp 0, [S], ttl 31)
2156dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2157dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2158AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2159
2160for i in 1 2 3; do
2161 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'
2162done
2163OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2164OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2165
2166AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2167NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2168mplsm,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
2169dnl
2170NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2171mplsm,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
2172dnl
2173NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2174mplsm,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
2175])
2176
2177AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2178
2179dnl Modified MPLS pop action.
2180dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2181dnl 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)
2182dnl (label 20, exp 0, [S], ttl 31)
2183dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2184dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2185AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2186
2187for i in 1 2 3; do
2188 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'
2189done
2190OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2191OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2192
2193AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2194NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2195mpls,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 2196dnl
e672ff9b 2197NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2198mpls,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 2199dnl
e672ff9b 2200NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2201mpls,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
2202])
2203
2204AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2205
2206dnl Modified MPLS pop action.
2207dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2208dnl 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)
2209dnl (label 20, exp 0, [S], ttl 31)
2210dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2211dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2212AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2213
2214for i in 1 2 3; do
2215 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'
2216done
2217OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2218OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2219
2220AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2221NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2222mplsm,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
2223dnl
2224NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2225mplsm,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
2226dnl
2227NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2228mplsm,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
2229])
2230
2231AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2232
2233dnl Modified MPLS pop action.
2234dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2235dnl 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)
2236dnl (label 20, exp 0, [S], ttl 31)
2237dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2238dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2239AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2240
2241for i in 1 2 3; do
2242 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'
2243done
2244OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2245OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2246
2247AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2248NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2249tcp,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 2250dnl
e672ff9b 2251NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2252tcp,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 2253dnl
e672ff9b 2254NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2255tcp,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
2256])
2257
2258AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2259
2260dnl Modified MPLS pop action.
2261dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
2262dnl 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)
2263dnl (label 20, exp 0, [S], ttl 31)
2264dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2265dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2266AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2267
2268for i in 1 2 3; do
2269 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'
2270done
e672ff9b 2271
1ffd16af
SH
2272OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2273OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2274
2be3fe44 2275AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2276NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2277tcp,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 2278dnl
e672ff9b 2279NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2280tcp,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 2281dnl
e672ff9b 2282NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2283tcp,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
2284])
2285
2286AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2287
2288dnl Modified MPLS pop action.
2289dnl The input is a frame with two MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2290dnl 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
2291dnl (label 20, exp 0, [S], ttl 31)
2292dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2293dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2294AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2295
2296for i in 1 2 3; do
2297 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'
2298done
2299OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2300OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2301
2be3fe44 2302AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2303NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2304tcp,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 2305dnl
e672ff9b 2306NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2307tcp,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 2308dnl
e672ff9b 2309NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2310tcp,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
2311])
2312
2313AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2314
2315dnl Modified MPLS pop action.
2316dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
e672ff9b 2317dnl 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
2318dnl (label 20, exp 0, ttl 31)
2319dnl (label 20, exp 0, [S], ttl 30)
2320dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2321dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2322AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2323
2324for i in 1 2 3; do
2325 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'
2326done
2327OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2328OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2329
2330AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2331NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2332mplsm,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 2333dnl
e672ff9b 2334NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2335mplsm,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 2336dnl
e672ff9b 2337NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2338mplsm,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
2339])
2340
2341AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2342
2343dnl Modified MPLS pop action.
2344dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2345dnl 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)
2346dnl (label 20, exp 0, ttl 31)
2347dnl (label 20, exp 0, [S], ttl 30)
2348dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2349dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2350AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2351
2352for i in 1 2 3; do
2353 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'
2354done
2355OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2356OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2357
2358AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2359NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2360mpls,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 2361dnl
e672ff9b 2362NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2363mpls,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 2364dnl
e672ff9b 2365NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2366mpls,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
2367])
2368
2369AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2370
2371dnl Modified MPLS pop action.
2372dnl The input is a frame with three MPLS label stack entries which tcpdump -vve shows as:
2373dnl 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)
2374dnl (label 20, exp 0, ttl 31)
2375dnl (label 20, exp 0, [S], ttl 30)
2376dnl (tos 0x0, ttl 254, id 0, offset 0, flags [none], proto TCP (6), length 44)
2377dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6409e008 2378AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2379
2380for i in 1 2 3; do
2381 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'
2382done
2383OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2384OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2385
2386AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2387NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2388mplsm,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 2389dnl
e672ff9b 2390NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2391mplsm,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 2392dnl
e672ff9b 2393NXT_PACKET_IN (xid=0x0): cookie=0xe total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2394mplsm,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
2395])
2396
2397AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2398
2399dnl Modified MPLS pop action.
2400dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2401dnl 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)
2402dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2403dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2404AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2405
2406for i in 1 2 3; do
2407 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'
2408done
2409OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2410OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2411
2be3fe44 2412AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2413NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2414mpls,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 2415dnl
e672ff9b 2416NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2417mpls,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 2418dnl
e672ff9b 2419NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2420mpls,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
2421])
2422
2423AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2424
2425dnl Modified MPLS pop action.
2426dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2427dnl 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)
2428dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2429dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2430AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2431
2432for i in 1 2 3; do
2433 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'
2434done
2435OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2436OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2437
2be3fe44 2438AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2439NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2440mplsm,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 2441dnl
e672ff9b 2442NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2443mplsm,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 2444dnl
e672ff9b 2445NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2446mplsm,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
2447])
2448
2449AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2450
2451dnl Modified MPLS pop action.
2452dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2453dnl 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)
2454dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2455dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2456AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2457
2458for i in 1 2 3; do
2459 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'
2460done
2461OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2462OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2463
2be3fe44 2464AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2465NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2466mplsm,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 2467dnl
e672ff9b 2468NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2469mplsm,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 2470dnl
e672ff9b 2471NXT_PACKET_IN (xid=0x0): cookie=0xf total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2472mplsm,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
2473])
2474
2475AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2476
2477dnl Modified MPLS pop action.
2478dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2479dnl 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)
2480dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2481dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2482AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2483
2484for i in 1 2 3; do
2485 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'
2486done
e672ff9b 2487
1ffd16af
SH
2488OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2489OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2490
2491AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2492NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2493mpls,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 2494dnl
e672ff9b 2495NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2496mpls,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 2497dnl
e672ff9b 2498NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2499mpls,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
2500])
2501
2502AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2503
2504dnl Modified MPLS pop action.
2505dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2506dnl 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)
2507dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2508dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2509AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2510
2511for i in 1 2 3; do
2512 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'
2513done
2514OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2515OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2516
2517AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2518NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2519mplsm,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 2520dnl
e672ff9b 2521NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2522mplsm,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 2523dnl
e672ff9b 2524NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2525mplsm,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
2526])
2527
2528AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2529
2530dnl Modified MPLS pop action.
2531dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2532dnl 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)
2533dnl (tos 0x0, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2534dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2535AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2536
2537for i in 1 2 3; do
2538 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'
2539done
e672ff9b 2540
1ffd16af
SH
2541OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2542OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2543
2544AT_CHECK([cat ofctl_monitor.log], [0], [dnl
e672ff9b 2545NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2546mpls,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 2547dnl
e672ff9b 2548NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2549mpls,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 2550dnl
e672ff9b 2551NXT_PACKET_IN (xid=0x0): cookie=0x5 total_len=62 in_port=1 (via action) data_len=62 (unbuffered)
e6d9ab56 2552mpls,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
2553])
2554
cea4a6d7 2555AT_CHECK([ovs-appctl revalidator/purge], [0])
ef0ce8ae 2556AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
e672ff9b
JR
2557 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
2558 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
2559 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
2560 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
2561 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
2562 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 2563 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
2564 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
2565 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
2566 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 2567 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 2568 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 2569 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 2570 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 2571 cookie=0xd, n_packets=3, n_bytes=180, dl_src=60:66:66:66:00:08 actions=pop_mpls:0x0806,resubmit(1,1)
c2d936a4 2572 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
2573 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
2574 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
2575 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
961cf8e0 2576 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,1,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
1ffd16af
SH
2577 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
2578 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 2579 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
1ffd16af
SH
2580 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
2581 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 2582 cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:66:66 actions=pop_mpls:0x0800,CONTROLLER:65535
1ffd16af
SH
2583 cookie=0xd, n_packets=3, n_bytes=198, dl_src=60:66:66:66:01:00 actions=pop_mpls:0x8848,CONTROLLER:65535
2584 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
2585 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
2586 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 2587 cookie=0xd, table=1, n_packets=3, n_bytes=168, arp actions=CONTROLLER:65535
e672ff9b
JR
2588 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
2589 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
2590 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
2591 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
2592 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
2593 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
2594 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
2595 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
2596 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 2597NXST_FLOW reply:
15056dc8
EJ
2598])
2599
2600OVS_VSWITCHD_STOP
8e9ce036 2601AT_CLEANUP
04c956fc 2602
1ffd16af
SH
2603AT_SETUP([ofproto-dpif - MPLS handling with goto_table])
2604OVS_VSWITCHD_START([dnl
2605 add-port br0 p1 -- set Interface p1 type=dummy
2606])
53eb8cb8 2607on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2608
2609AT_CAPTURE_FILE([ofctl_monitor.log])
2610AT_DATA([flows.txt], [dnl
2611table=0 mplsm actions=pop_mpls:0x800,goto_table(1)
2612table=1 ip,ip_dscp=8 actions=controller
2613])
2614AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2615
2616
2617dnl Modified MPLS pop action.
2618dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2619dnl 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)
2620dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2621dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2622AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2623
2624for i in 1 2 3; do
2625 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'
2626done
2627OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2628OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2629
2be3fe44 2630AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
1ffd16af 2631OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2632tcp,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
2633dnl
2634OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2635tcp,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
2636dnl
2637OFPT_PACKET_IN (OF1.2) (xid=0x0): table_id=1 total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2638tcp,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
2639])
2640
cea4a6d7 2641AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2642AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2643 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,goto_table:1
2644 table=1, n_packets=3, n_bytes=174, ip,nw_tos=32 actions=CONTROLLER:65535
2645OFPST_FLOW reply (OF1.2):
2646])
2647
2648OVS_VSWITCHD_STOP
2649AT_CLEANUP
2650
2651AT_SETUP([ofproto-dpif - MPLS handling with write_actions])
2652OVS_VSWITCHD_START([dnl
2653 add-port br0 p1 -- set Interface p1 type=dummy
2654])
53eb8cb8 2655on_exit 'kill `cat ovs-ofctl.pid`'
1ffd16af
SH
2656
2657dnl N.B: The first (and only) action that accesses L3 data after the
2658dnl pop_mpls action is present in write_actions. This exercises recirculation
2659dnl triggered in write_actions due to a previous action not in write actions.
2660AT_CAPTURE_FILE([ofctl_monitor.log])
2661AT_DATA([flows.txt], [dnl
2662mplsm actions=pop_mpls:0x800,write_actions(dec_ttl,controller)
2663])
2664AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
2665
2666dnl Modified MPLS pop action.
2667dnl The input is a frame with a single MPLS label stack entry which tcpdump -vve shows as:
2668dnl 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)
2669dnl (tos 0x20, ttl 255, id 0, offset 0, flags [none], proto TCP (6), length 44)
2670dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x77ec (correct), seq 42:46, win 10000, length 4
6409e008 2671AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
1ffd16af
SH
2672
2673for i in 1 2 3; do
2674 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'
2675done
2676OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
2677OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
2678
2be3fe44 2679AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
e672ff9b 2680OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2681tcp,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 2682dnl
e672ff9b 2683OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2684tcp,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 2685dnl
e672ff9b 2686OFPT_PACKET_IN (OF1.2) (xid=0x0): total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
e6d9ab56 2687tcp,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
2688])
2689
cea4a6d7 2690AT_CHECK([ovs-appctl revalidator/purge], [0])
1ffd16af
SH
2691AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2692 n_packets=3, n_bytes=186, mplsm actions=pop_mpls:0x0800,write_actions(dec_ttl,CONTROLLER:65535)
2693OFPST_FLOW reply (OF1.2):
2694])
2695
2696OVS_VSWITCHD_STOP
2697AT_CLEANUP
527ae97e
SH
2698
2699AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.0)])
2700OVS_VSWITCHD_START([dnl
2701 add-port br0 p1 -- set Interface p1 type=dummy
2702])
53eb8cb8 2703on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2704
2705AT_CAPTURE_FILE([ofctl_monitor.log])
2706# A table-miss flow has priority 0 and no match
2707AT_CHECK([ovs-ofctl --protocols=OpenFlow10 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2708
2709dnl Singleton controller action.
6409e008 2710AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow10 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2711
2712for i in 1 2 3 ; do
2713 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)'
2714done
2715OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2716OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
2717
2718AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2719OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2720tcp,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
2721dnl
2722OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2723tcp,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
2724dnl
2725OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2726tcp,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
2727])
2728
cea4a6d7 2729AT_CHECK([ovs-appctl revalidator/purge], [0])
527ae97e
SH
2730AT_CHECK([ovs-ofctl --protocols=OpenFlow10 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2731 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2732NXST_FLOW reply:
2733])
2734
2735OVS_VSWITCHD_STOP
2736AT_CLEANUP
2737
2738
2739AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.3)])
2740OVS_VSWITCHD_START([dnl
2741 add-port br0 p1 -- set Interface p1 type=dummy
2742])
53eb8cb8 2743on_exit 'kill `cat ovs-ofctl.pid`'
527ae97e
SH
2744
2745AT_CAPTURE_FILE([ofctl_monitor.log])
2746# A table-miss flow has priority 0 and no match
2747AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2748
2749dnl Singleton controller action.
6409e008 2750AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
527ae97e
SH
2751
2752for i in 1 2 3 ; do
2753 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)'
2754done
2755OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2756OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
527ae97e
SH
2757
2758AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2759
2760AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2761OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2762tcp,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
2763dnl
2764OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2765tcp,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
2766dnl
2767OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2768tcp,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
2769])
2770
cea4a6d7 2771AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
2772AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2773 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2774OFPST_FLOW reply (OF1.3):
2775])
2776
2777OVS_VSWITCHD_STOP
2778AT_CLEANUP
2779
2780AT_SETUP([ofproto-dpif - table-miss flow with async config (OpenFlow 1.3)])
2781OVS_VSWITCHD_START([dnl
2782 add-port br0 p1 -- set Interface p1 type=dummy
2783])
53eb8cb8 2784on_exit 'kill `cat ovs-ofctl.pid`'
ba96552a 2785
5b7278a1
JS
2786ovs-appctl time/stop
2787
ba96552a
SS
2788AT_CAPTURE_FILE([ofctl_monitor.log])
2789# A table-miss flow has priority 0 and no match
2790AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2791
2792dnl Singleton controller action.
6409e008 2793AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
ba96552a
SS
2794
2795# Become slave (OF 1.3), which should disable everything except port status.
2796ovs-appctl -t ovs-ofctl ofctl/send 041800180000000200000003000000000000000000000001
2797
5b7278a1
JS
2798# Ensure that ovs-vswitchd gets a chance to reply before sending another command.
2799ovs-appctl time/warp 500 100
2800
ba96552a
SS
2801# Use OF 1.3 OFPT_SET_ASYNC to enable OFPR_NO_MATCH for slave only.
2802ovs-appctl -t ovs-ofctl ofctl/send 041c002000000002000000000000000100000000000000000000000000000000
2803
5b7278a1 2804ovs-appctl time/warp 500 100
ba96552a
SS
2805for i in 1 2 3 ; do
2806 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)'
2807done
2808OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2809OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
ba96552a 2810
cea4a6d7 2811AT_CHECK([ovs-appctl revalidator/purge], [0])
ba96552a
SS
2812AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2813send: OFPT_ROLE_REQUEST (OF1.3) (xid=0x2): role=slave generation_id=1
2814OFPT_ROLE_REPLY (OF1.3) (xid=0x2): role=slave generation_id=1
2815dnl
2816send: OFPT_SET_ASYNC (OF1.3) (xid=0x2):
2817 master:
2818 PACKET_IN: (off)
2819 PORT_STATUS: (off)
2820 FLOW_REMOVED: (off)
904e5202
BP
2821 ROLE_STATUS: (off)
2822 TABLE_STATUS: (off)
2823 REQUESTFORWARD: (off)
ba96552a
SS
2824
2825 slave:
2826 PACKET_IN: no_match
2827 PORT_STATUS: (off)
2828 FLOW_REMOVED: (off)
904e5202
BP
2829 ROLE_STATUS: (off)
2830 TABLE_STATUS: (off)
2831 REQUESTFORWARD: (off)
ba96552a
SS
2832dnl
2833OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2834tcp,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
2835dnl
2836OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2837tcp,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
2838dnl
2839OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2840tcp,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
2841])
2842
2843AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2844
2845AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2846 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2847OFPST_FLOW reply (OF1.3):
2848])
2849
2850OVS_VSWITCHD_STOP
2851AT_CLEANUP
2852
807c7989
SS
2853
2854AT_SETUP([ofproto-dpif - table-miss flow (OpenFlow 1.4)])
2855OVS_VSWITCHD_START([dnl
2856 add-port br0 p1 -- set Interface p1 type=dummy
2857])
53eb8cb8 2858on_exit 'kill `cat ovs-ofctl.pid`'
807c7989
SS
2859
2860AT_CAPTURE_FILE([ofctl_monitor.log])
2861# A table-miss flow has priority 0 and no match
2862AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flow br0 'priority=0 actions=output:CONTROLLER'])
2863
2864dnl Singleton controller action.
6409e008 2865AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
807c7989
SS
2866
2867for i in 1 2 3 ; do
2868 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)'
2869done
2870OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2871OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
807c7989 2872
cea4a6d7 2873AT_CHECK([ovs-appctl revalidator/purge], [0])
807c7989
SS
2874AT_CHECK([cat ofctl_monitor.log], [0], [dnl
2875OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2876tcp,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
2877dnl
2878OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2879tcp,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
2880dnl
2881OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via no_match) data_len=60 (unbuffered)
e6d9ab56 2882tcp,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
2883])
2884
2885AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2886
2887AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
2888 n_packets=3, n_bytes=180, priority=0 actions=CONTROLLER:65535
2889OFPST_FLOW reply (OF1.4):
2890])
2891
2892OVS_VSWITCHD_STOP
2893AT_CLEANUP
2894
2895
029ca940 2896AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.3)])
3a11fd5b
SS
2897OVS_VSWITCHD_START([dnl
2898 add-port br0 p1 -- set Interface p1 type=dummy
2899])
53eb8cb8 2900on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
2901
2902AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
2903AT_DATA([flows.txt], [dnl
2904table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2905table=1 actions=output(CONTROLLER),goto_table(2)
2906table=2 actions=group:1234
2907])
3a11fd5b 2908AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 2909AT_CHECK([ovs-ofctl --protocols=OpenFlow13 add-flows br0 flows.txt])
3a11fd5b
SS
2910
2911dnl Singleton controller action.
6409e008 2912AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow13 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
2913
2914for i in 1 2 3 ; do
2915 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)'
2916done
2917OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2918OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
2919
2920AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2921
2922AT_CHECK([cat ofctl_monitor.log], [0], [dnl
029ca940 2923OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2924tcp,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
2925dnl
2926OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2927tcp,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 2928dnl
3a11fd5b 2929OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2930tcp,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 2931dnl
029ca940 2932OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2933tcp,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
2934dnl
2935OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2936tcp,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 2937dnl
3a11fd5b 2938OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2939tcp,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 2940dnl
029ca940 2941OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2942tcp,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
2943dnl
2944OFPT_PACKET_IN (OF1.3) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2945tcp,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 2946dnl
3a11fd5b 2947OFPT_PACKET_IN (OF1.3) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2948tcp,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
2949])
2950
2951AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2952
2953AT_CHECK([ovs-ofctl --protocols=OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
029ca940
SS
2954 n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
2955 table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
2956 table=2, n_packets=3, n_bytes=180, actions=group:1234
3a11fd5b
SS
2957OFPST_FLOW reply (OF1.3):
2958])
2959
2960OVS_VSWITCHD_STOP
2961AT_CLEANUP
2962
2963
029ca940 2964AT_SETUP([ofproto-dpif - packet-in reasons (Openflow 1.4)])
3a11fd5b
SS
2965OVS_VSWITCHD_START([dnl
2966 add-port br0 p1 -- set Interface p1 type=dummy
2967])
53eb8cb8 2968on_exit 'kill `cat ovs-ofctl.pid`'
3a11fd5b
SS
2969
2970AT_CAPTURE_FILE([ofctl_monitor.log])
029ca940
SS
2971AT_DATA([flows.txt], [dnl
2972table=0 in_port=1 actions=write_actions(output(CONTROLLER)),goto_table(1)
2973table=1 actions=output(CONTROLLER),goto_table(2)
2974table=2 actions=group:1234
2975])
3a11fd5b 2976AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-group br0 'group_id=1234,type=all,bucket=output:10,bucket=output:CONTROLLER'])
029ca940 2977AT_CHECK([ovs-ofctl --protocols=OpenFlow14 add-flows br0 flows.txt])
3a11fd5b
SS
2978
2979dnl Singleton controller action.
6409e008 2980AT_CHECK([ovs-ofctl monitor -P standard --protocols=OpenFlow14 br0 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
3a11fd5b
SS
2981
2982for i in 1 2 3 ; do
2983 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)'
2984done
2985OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 2986OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
3a11fd5b
SS
2987
2988AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
2989
2990AT_CHECK([cat ofctl_monitor.log], [0], [dnl
029ca940 2991OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 2992tcp,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
2993dnl
2994OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 2995tcp,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
2996dnl
2997OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 2998tcp,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
2999dnl
3000OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 3001tcp,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
3002dnl
3003OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 3004tcp,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
3005dnl
3006OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 3007tcp,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
3008dnl
3009OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 3010tcp,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 3011dnl
029ca940 3012OFPT_PACKET_IN (OF1.4) (xid=0x0): table_id=2 cookie=0x0 total_len=60 in_port=1 (via group) data_len=60 (unbuffered)
e6d9ab56 3013tcp,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 3014dnl
029ca940 3015OFPT_PACKET_IN (OF1.4) (xid=0x0): cookie=0x0 total_len=60 in_port=1 (via action_set) data_len=60 (unbuffered)
e6d9ab56 3016tcp,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
3017])
3018
3019AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3020
3021AT_CHECK([ovs-ofctl --protocols=OpenFlow14 dump-flows br0 | ofctl_strip | sort], [0], [dnl
029ca940
SS
3022 n_packets=3, n_bytes=180, in_port=1 actions=write_actions(CONTROLLER:65535),goto_table:1
3023 table=1, n_packets=3, n_bytes=180, actions=CONTROLLER:65535,goto_table:2
3024 table=2, n_packets=3, n_bytes=180, actions=group:1234
3a11fd5b
SS
3025OFPST_FLOW reply (OF1.4):
3026])
3027
3028OVS_VSWITCHD_STOP
3029AT_CLEANUP
3030
029ca940 3031
f6c8a6b1
BP
3032AT_SETUP([ofproto-dpif - ARP modification slow-path])
3033OVS_VSWITCHD_START
ca5792f0 3034add_of_ports br0 1 2
f6c8a6b1
BP
3035
3036ovs-vsctl -- set Interface p2 type=dummy options:pcap=p2.pcap
3037ovs-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'
3038
3039# Input some packets that should follow the arp modification slow-path.
3040for i in 1 2 3; do
3041 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)'
3042done
3043AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
3044
3045# Check the packets that were output.
3046AT_CHECK([ovs-ofctl parse-pcap p2.pcap], [0], [dnl
78c9486d
JR
3047arp,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
3048arp,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
3049arp,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
3050arp,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
3051arp,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
3052arp,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
3053arp,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
3054arp,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
3055arp,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
3056])
3057
f6c8a6b1
BP
3058OVS_VSWITCHD_STOP
3059AT_CLEANUP
3060
ecac4ebf 3061AT_SETUP([ofproto-dpif - VLAN handling])
04c956fc 3062OVS_VSWITCHD_START(
023e1e0a
BP
3063 [set Bridge br0 fail-mode=standalone -- \
3064 add-port br0 p1 trunks=10,12 -- \
ecac4ebf 3065 add-port br0 p2 tag=10 -- \
5e9ceccd
BP
3066 add-port br0 p3 tag=12 \
3067 other-config:priority-tags=true -- \
ecac4ebf
BP
3068 add-port br0 p4 tag=12 -- \
3069 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
3070 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
3071 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
5e9ceccd
BP
3072 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
3073 other-config:priority-tags=true -- \
ecac4ebf
BP
3074 set Interface p1 type=dummy -- \
3075 set Interface p2 type=dummy -- \
3076 set Interface p3 type=dummy -- \
3077 set Interface p4 type=dummy -- \
3078 set Interface p5 type=dummy -- \
3079 set Interface p6 type=dummy -- \
3080 set Interface p7 type=dummy -- \
3081 set Interface p8 type=dummy --])
04c956fc 3082
247527db
BP
3083dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
3084dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
ecac4ebf 3085dnl actions.
04c956fc 3086for tuple in \
e44768b7
JP
3087 "100 none 0 drop" \
3088 "100 0 0 drop" \
3089 "100 0 1 drop" \
3090 "100 10 0 1,5,6,7,8,pop_vlan,2" \
3091 "100 10 1 1,5,6,7,8,pop_vlan,2" \
3092 "100 11 0 5,7" \
3093 "100 11 1 5,7" \
3094 "100 12 0 1,5,6,pop_vlan,3,4,7,8" \
3095 "100 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
247527db
BP
3096 "1 none 0 drop" \
3097 "1 0 0 drop" \
3098 "1 0 1 drop" \
e44768b7
JP
3099 "1 10 0 5,6,7,8,100,pop_vlan,2" \
3100 "1 10 1 5,6,7,8,100,pop_vlan,2" \
247527db
BP
3101 "1 11 0 drop" \
3102 "1 11 1 drop" \
e44768b7
JP
3103 "1 12 0 5,6,100,pop_vlan,3,4,7,8" \
3104 "1 12 1 5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3105 "2 none 0 push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3106 "2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),1,5,6,7,8,100" \
3107 "2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),1,5,6,7,8,100" \
247527db
BP
3108 "2 10 0 drop" \
3109 "2 10 1 drop" \
3110 "2 11 0 drop" \
3111 "2 11 1 drop" \
3112 "2 12 0 drop" \
3113 "2 12 1 drop" \
e44768b7
JP
3114 "3 none 0 4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3115 "3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3116 "3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3117 "3 10 0 drop" \
3118 "3 10 1 drop" \
3119 "3 11 0 drop" \
3120 "3 11 1 drop" \
3121 "3 12 0 drop" \
3122 "3 12 1 drop" \
e44768b7
JP
3123 "4 none 0 3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3124 "4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3125 "4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
247527db
BP
3126 "4 10 0 drop" \
3127 "4 10 1 drop" \
3128 "4 11 0 drop" \
3129 "4 11 1 drop" \
3130 "4 12 0 drop" \
3131 "4 12 1 drop" \
e44768b7
JP
3132 "5 none 0 2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3133 "5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,6,7,8,100" \
3134 "5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,6,7,8,100" \
3135 "5 10 0 1,6,7,8,100,pop_vlan,2" \
3136 "5 10 1 1,6,7,8,100,pop_vlan,2" \
3137 "5 11 0 7,100" \
3138 "5 11 1 7,100" \
3139 "5 12 0 1,6,100,pop_vlan,3,4,7,8" \
3140 "5 12 1 1,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3141 "6 none 0 2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3142 "6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),1,5,7,8,100" \
3143 "6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),1,5,7,8,100" \
3144 "6 10 0 1,5,7,8,100,pop_vlan,2" \
3145 "6 10 1 1,5,7,8,100,pop_vlan,2" \
247527db
BP
3146 "6 11 0 drop" \
3147 "6 11 1 drop" \
e44768b7
JP
3148 "6 12 0 1,5,100,pop_vlan,3,4,7,8" \
3149 "6 12 1 1,5,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
3150 "7 none 0 3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3151 "7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),1,5,6,100" \
3152 "7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),1,5,6,100" \
3153 "7 10 0 1,5,6,8,100,pop_vlan,2" \
3154 "7 10 1 1,5,6,8,100,pop_vlan,2" \
3155 "7 11 0 5,100" \
3156 "7 11 1 5,100" \
3157 "7 12 0 1,5,6,100,pop_vlan,3,4,8" \
3158 "7 12 1 1,5,6,100,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
3159 "8 none 0 3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3160 "8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),1,5,6,100" \
3161 "8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),1,5,6,100" \
3162 "8 10 0 1,5,6,7,100,pop_vlan,2" \
3163 "8 10 1 1,5,6,7,100,pop_vlan,2" \
247527db
BP
3164 "8 11 0 drop" \
3165 "8 11 1 drop" \
e44768b7
JP
3166 "8 12 0 1,5,6,100,pop_vlan,3,4,7" \
3167 "8 12 1 1,5,6,100,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
04c956fc
BP
3168do
3169 set $tuple
3170 in_port=$1
3171 vlan=$2
ecac4ebf
BP
3172 pcp=$3
3173 expected=$4
04c956fc
BP
3174
3175 if test $vlan = none; then
247527db 3176 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
04c956fc 3177 else
247527db 3178 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
3179 fi
3180
395e68ce
BP
3181 echo "----------------------------------------------------------------------"
3182 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
3183
50aa28fd 3184 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
ecac4ebf 3185 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
04c956fc 3186
247527db 3187 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
becffb86 3188 mv stdout expout
247527db 3189 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
04c956fc
BP
3190done
3191
3192OVS_VSWITCHD_STOP
3193AT_CLEANUP
7257b535 3194
56879058
JS
3195AT_SETUP([ofproto-dpif - MPLS handling])
3196OVS_VSWITCHD_START([dnl
3197 add-port br0 p1 -- set Interface p1 type=dummy
3198])
53eb8cb8 3199on_exit 'kill `cat ovs-ofctl.pid`'
56879058
JS
3200
3201AT_CAPTURE_FILE([ofctl_monitor.log])
3202AT_DATA([flows.txt], [dnl
3203dl_src=40:44:44:44:00:00 actions=push_mpls:0x8847,controller
63636ee8 3204dl_src=40:44:44:44:00:01,mpls actions=push_mpls:0x8847,controller
0c1625e8 3205dl_src=40:44:44:44:00:02,mpls actions=push_mpls:0x8848,controller
56879058
JS
3206])
3207AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3208
3209dnl In this test, we push an MPLS tag to an ethernet packet.
6409e008 3210AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
56879058
JS
3211
3212for i in 1 2 3; do
3213 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)'
3214done
62022172 3215OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3216OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
56879058 3217
38b0b29f 3218AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
56879058 3219OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3220mpls,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
322100000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
322200000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
322300000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
322400000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3225dnl
3226OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3227mpls,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
322800000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
322900000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
323000000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
323100000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3232dnl
3233OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3234mpls,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
323500000000 50 54 00 00 00 07 40 44-44 44 00 00 88 47 00 00
323600000010 01 40 45 00 00 28 00 00-00 00 40 06 f9 7c c0 a8
323700000020 00 01 c0 a8 00 02 00 00-00 00 00 00 00 00 00 00
323800000030 00 00 50 00 00 00 00 00-00 00 00 00 00 00 00 00
3239])
3240
63636ee8
JS
3241dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3242dnl copied exactly, except for the BOS bit.
6409e008 3243AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
63636ee8
JS
3244
3245for i in 1 2 3; do
3246 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)'
3247done
62022172 3248OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3249OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
63636ee8 3250
38b0b29f 3251AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
63636ee8 3252OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3253mpls,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
325400000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
325500000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
325600000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
325700000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3258dnl
3259OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3260mpls,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
326100000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
326200000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
326300000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
326400000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3265dnl
3266OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3267mpls,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
326800000000 50 54 00 00 00 07 40 44-44 44 00 01 88 47 00 00
326900000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
327000000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
0c1625e8
SH
327100000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3272])
3273
3274dnl In this test, we push an MPLS tag to an MPLS packet. The LSE should be
3275dnl copied exactly, except for the BOS bit. The ethertype should be updated
3276dnl to the MPLS ethertype of the MPLS push action which differs to that
3277dnl of the input packet.
6409e008 3278AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
0c1625e8
SH
3279
3280for i in 1 2 3; do
3281 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)'
3282done
62022172 3283OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3284OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
0c1625e8 3285
38b0b29f 3286AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
0c1625e8 3287OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3288mplsm,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
328900000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
329000000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
329100000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
329200000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3293dnl
3294OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3295mplsm,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
329600000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
329700000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
329800000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
329900000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3300dnl
3301OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3302mplsm,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
330300000000 50 54 00 00 00 07 40 44-44 44 00 02 88 48 00 00
330400000010 a0 40 00 00 a1 40 00 00-00 00 00 00 00 00 00 00
330500000020 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
63636ee8
JS
330600000030 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
3307])
3308
56879058
JS
3309OVS_VSWITCHD_STOP
3310AT_CLEANUP
3311
846e159a
SH
3312AT_SETUP([ofproto-dpif - VLAN+MPLS handling])
3313OVS_VSWITCHD_START([dnl
3314 add-port br0 p1 -- set Interface p1 type=dummy
3315])
53eb8cb8 3316on_exit 'kill `cat ovs-ofctl.pid`'
846e159a
SH
3317
3318AT_CAPTURE_FILE([ofctl_monitor.log])
3319AT_DATA([flows.txt], [dnl
3320cookie=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
3321cookie=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
3322cookie=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
3323cookie=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
3324cookie=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
3325cookie=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
3326cookie=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
3327cookie=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
3328cookie=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
3329cookie=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
3330])
3331AT_CHECK([ovs-ofctl --protocols=OpenFlow12 add-flows br0 flows.txt])
3332
3333dnl Modified MPLS controller action.
3334dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3335dnl both of these in the final flow
6409e008 3336AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3337
3338for i in 1 2 3; do
3339 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)'
3340done
62022172 3341OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3342OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3343
38b0b29f 3344AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3345OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3346mpls,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
334700000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
334800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
334900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
335000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
335100000040 00 00 00 00
3352dnl
3353OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3354mpls,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
335500000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
335600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
335700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
335800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
335900000040 00 00 00 00
3360dnl
3361OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3362mpls,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
336300000000 50 54 00 00 00 07 40 44-44 44 54 50 81 00 20 63
336400000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
336500000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
336600000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
336700000040 00 00 00 00
3368])
3369
3370dnl Modified MPLS controller action.
4dc94d7e 3371dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3372dnl before we push the MPLS and VLAN tags.
6409e008 3373AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3374
3375for i in 1 2 3; do
3376 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))'
3377done
62022172 3378OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3379OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3380
38b0b29f 3381AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3382OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3383mpls,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
338400000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
338500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
338600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
338700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3388dnl
3389OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3390mpls,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
339100000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
339200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
339300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
339400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3395dnl
3396OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3397mpls,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
339800000000 50 54 00 00 00 07 40 44-44 44 54 51 81 00 20 63
339900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
340000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
340100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3402])
3403
3404dnl Modified MPLS controller action.
3405dnl In this test, we push the MPLS tag before pushing a VLAN tag, so we see
3406dnl both of these in the final flow
6409e008 3407AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3408
3409for i in 1 2 3; do
3410 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)'
3411done
62022172 3412OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3413OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3414
38b0b29f 3415AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3416OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3417mpls,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
341800000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
341900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
342000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
342100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
342200000040 00 00 00 00
3423dnl
3424OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3425mpls,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
342600000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
342700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
342800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
342900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
343000000040 00 00 00 00
3431dnl
3432OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3433mpls,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
343400000000 52 54 00 00 00 07 40 44-44 44 54 52 81 00 20 63
343500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
343600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
343700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
343800000040 00 00 00 00
3439])
3440
3441dnl Modified MPLS controller action.
4dc94d7e 3442dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3443dnl before we push the MPLS and VLAN tags.
6409e008 3444AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3445
3446for i in 1 2 3; do
3447 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))'
3448done
62022172 3449OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3450OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3451
38b0b29f 3452AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3453OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3454mpls,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
345500000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
345600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
345700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
345800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3459dnl
3460OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3461mpls,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
346200000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
346300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
346400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
346500000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3466dnl
3467OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3468mpls,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
346900000000 50 54 00 00 00 07 40 44-44 44 54 53 81 00 20 63
347000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
347100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
347200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3473])
3474
3475dnl Modified MPLS controller action.
3476dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3477dnl actions are reordered, so we see both of these in the final flow.
6409e008 3478AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3479
3480for i in 1 2 3; do
3481 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)'
3482done
62022172 3483OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3484OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3485
38b0b29f 3486AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3487OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3488mpls,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
348900000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
349000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
349100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
349200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
349300000040 00 00 00 00
3494dnl
3495OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3496mpls,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
349700000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
349800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
349900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
350000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
350100000040 00 00 00 00
3502dnl
3503OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3504mpls,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
350500000000 50 54 00 00 00 07 40 44-44 44 54 54 81 00 20 63
350600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
350700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
350800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
350900000040 00 00 00 00
3510])
3511
3512dnl Modified MPLS controller action.
4dc94d7e 3513dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3514dnl before we push the MPLS and VLAN tags.
6409e008 3515AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3516
3517for i in 1 2 3; do
3518 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))'
3519done
62022172 3520OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
28ae2f37 3521OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 3522
38b0b29f 3523AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3524OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3525mpls,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
352600000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
352700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
352800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
352900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3530dnl
3531OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3532mpls,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
353300000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
353400000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
353500000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
353600000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3537dnl
3538OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3539mpls,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
354000000000 50 54 00 00 00 07 40 44-44 44 54 55 81 00 20 63
354100000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
354200000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
354300000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3544])
3545
3546dnl Modified MPLS controller action.
3547dnl In this test, we push the VLAN tag before pushing a MPLS tag, but these
3548dnl actions are reordered, so we see both of these in the final flow.
6409e008 3549AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3550
3551for i in 1 2 3; do
3552 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)'
3553done
62022172 3554OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3555OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3556
38b0b29f 3557AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3558OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3559mpls,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
356000000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
356100000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
356200000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
356300000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
356400000040 00 00 00 00
3565dnl
3566OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3567mpls,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
356800000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
356900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
357000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
357100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
357200000040 00 00 00 00
3573dnl
3574OFPT_PACKET_IN (OF1.2): total_len=68 in_port=1 (via action) data_len=68 (unbuffered)
e6d9ab56 3575mpls,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
357600000000 50 54 00 00 00 07 40 44-44 44 54 56 81 00 20 63
357700000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
357800000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
357900000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
358000000040 00 00 00 00
3581])
3582
3583dnl Modified MPLS controller action.
4dc94d7e 3584dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3585dnl before we push the MPLS and VLAN tags.
6409e008 3586AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 -m 65534 -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3587
3588for i in 1 2 3; do
3589 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))'
3590done
62022172 3591OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3592OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3593
38b0b29f 3594AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3595OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3596mpls,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
359700000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
359800000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
359900000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
360000000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3601dnl
3602OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3603mpls,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
360400000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
360500000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
360600000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
360700000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3608dnl
3609OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3610mpls,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
361100000000 50 54 00 00 00 07 40 44-44 44 54 57 81 00 20 63
361200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
361300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
361400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3615])
3616
3617dnl Modified MPLS controller action.
4dc94d7e 3618dnl In this test, the input packet is vlan-tagged, which should be stripped
846e159a 3619dnl before we push the MPLS and VLAN tags.
6409e008 3620AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3621
3622for i in 1 2 3; do
3623 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))'
3624done
62022172 3625OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
0c473314 3626OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
846e159a 3627
38b0b29f 3628AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3629OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3630mpls,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
363100000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
363200000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
363300000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
363400000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3635dnl
3636OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3637mpls,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
363800000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
363900000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
364000000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
364100000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3642dnl
3643OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3644mpls,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
364500000000 50 54 00 00 00 07 40 44-44 44 54 58 81 00 20 63
364600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
364700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
364800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3649])
3650
3651dnl Modified MPLS controller action.
4dc94d7e 3652dnl In this test, the input packet is vlan-tagged, which should be modified
846e159a 3653dnl before we push MPLS and VLAN tags.
6409e008 3654AT_CHECK([ovs-ofctl --protocols=OpenFlow12 monitor br0 65534 -m -P standard --detach --pidfile 2> ofctl_monitor.log])
846e159a
SH
3655
3656for i in 1 2 3; do
3657 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))'
3658done
62022172 3659OVS_WAIT_UNTIL([test `grep OFPT_PACKET_IN ofctl_monitor.log | wc -l` -ge 3])
d9c8c57c 3660OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
846e159a 3661
38b0b29f 3662AT_CHECK([ofctl_strip < ofctl_monitor.log], [0], [dnl
846e159a 3663OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3664mpls,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
366500000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
366600000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
366700000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
366800000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3669dnl
3670OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3671mpls,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
367200000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
367300000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
367400000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
367500000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3676dnl
3677OFPT_PACKET_IN (OF1.2): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
e6d9ab56 3678mpls,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
367900000000 50 54 00 00 00 07 40 44-44 44 54 59 81 00 20 63
368000000010 88 47 00 00 a1 40 45 00-00 28 00 00 00 00 40 06
368100000020 f9 7c c0 a8 00 01 c0 a8-00 02 00 00 00 00 00 00
368200000030 00 00 00 00 00 00 50 00-00 00 00 00 00 00 00 00
3683])
3684
cea4a6d7 3685AT_CHECK([ovs-appctl revalidator/purge], [0])
846e159a
SH
3686AT_CHECK([ovs-ofctl --protocols=OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl
3687 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
3688 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
3689 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
3690 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
3691 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
3692 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
3693 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
3694 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
3695 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
3696 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
3697OFPST_FLOW reply (OF1.2):
3698])
3699
3700OVS_VSWITCHD_STOP
3701AT_CLEANUP
3702
b8778a0d 3703AT_SETUP([ofproto-dpif - fragment handling - trace])
023e1e0a 3704OVS_VSWITCHD_START
ca5792f0 3705add_of_ports br0 1 2 3 4 5 6 90
7257b535 3706AT_DATA([flows.txt], [dnl
12e4681c
JR
3707priority=75 tcp ip_frag=no tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:1
3708priority=75 tcp ip_frag=first tp_dst=80 actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:2
12e4681c
JR
3709priority=50 tcp ip_frag=no actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:4
3710priority=50 tcp ip_frag=first actions=move:OXM_OF_TCP_DST[[]]->OXM_OF_TCP_SRC[[]],output:5
b8778a0d 3711priority=50 tcp ip_frag=later actions=output:6
7257b535
BP
3712])
3713AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3714
a61680c6 3715base_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
3716no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3717first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3718later_flow="$base_flow,frag=later)"
3719
3720 # mode no first later
3721for tuple in \
3722 'normal 1 5 6' \
3723 'drop 1 drop drop' \
3724 'nx-match 1 2 6'
3725do
3726 set $tuple
3727 mode=$1
3728 no=$2
3729 first=$3
3730 later=$4
3731
3732 AT_CHECK([ovs-ofctl set-frags br0 $mode])
3733 for type in no first later; do
3734 eval flow=\$${type}_flow exp_output=\$$type
7fd51d39 3735 printf "\n%s\n" "----$mode $type-----"
50aa28fd 3736 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
7fd51d39
BP
3737 : > expout
3738 if test $mode = drop && test $type != no; then
3739 echo 'Packets dropped because they are IP fragments and the fragment handling mode is "drop".' >> expout
12e4681c 3740 echo "Datapath actions: $exp_output" >> expout
b8778a0d 3741 elif test $type = later; then
12e4681c
JR
3742 echo "Datapath actions: $exp_output" >> expout
3743 else
3744 echo "Datapath actions: set(tcp(src=80,dst=80)),$exp_output" >> expout
7fd51d39 3745 fi
7fd51d39 3746 AT_CHECK([grep 'IP fragments' stdout; tail -1 stdout], [0], [expout])
7257b535
BP
3747 done
3748done
023e1e0a 3749OVS_VSWITCHD_STOP
7257b535 3750AT_CLEANUP
848e8809 3751
b8778a0d
JR
3752AT_SETUP([ofproto-dpif - fragment handling - upcall])
3753OVS_VSWITCHD_START
ca5792f0 3754add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
3755AT_DATA([flows.txt], [dnl
3756priority=75 tcp ip_frag=no tp_dst=80 actions=set_field:81->tcp_dst,output:1
3757priority=75 tcp ip_frag=first tp_dst=80 actions=set_field:81->tcp_dst,output:2
3758priority=50 tcp ip_frag=no actions=set_field:81->tcp_dst,output:4
3759priority=50 tcp ip_frag=first actions=set_field:81->tcp_dst,output:5
3760priority=50 tcp ip_frag=later actions=output:6
3761])
3762AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
3763
3764base_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"
3765no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
3766first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
3767later_flow="$base_flow,frag=later)"
3768
3769AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3770
3771mode=normal
3772
3773AT_CHECK([ovs-ofctl set-frags br0 $mode])
3774for type in no first later; do
3775 eval flow=\$${type}_flow
3776 printf "\n%s\n" "----$mode $type-----"
3777
3778 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3779done
3780
3781AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3782flow-dump from non-dpdk interfaces:
b8778a0d
JR
3783recirc_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
3784recirc_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
3785recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3786])
3787
3788mode=drop
3789
98bb4286 3790AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3791AT_CHECK([ovs-ofctl set-frags br0 $mode])
3792for type in no first later; do
3793 eval flow=\$${type}_flow
3794 printf "\n%s\n" "----$mode $type-----"
3795
3796 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3797done
3798
3799AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3800flow-dump from non-dpdk interfaces:
b8778a0d
JR
3801recirc_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
3802recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=first), packets:0, bytes:0, used:never, actions:drop
3803recirc_id(0),in_port(90),eth_type(0x0800),ipv4(frag=later), packets:0, bytes:0, used:never, actions:drop
3804])
3805
3806mode=nx-match
3807
98bb4286 3808AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3809AT_CHECK([ovs-ofctl set-frags br0 $mode])
3810for type in no first later; do
3811 eval flow=\$${type}_flow
3812 printf "\n%s\n" "----$mode $type-----"
3813
3814 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "$flow"], [0], [stdout])
3815done
3816
3817AT_CHECK([ovs-appctl dpctl/dump-flows], [0], [dnl
1c1e46ed 3818flow-dump from non-dpdk interfaces:
b8778a0d
JR
3819recirc_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
3820recirc_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
3821recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:0, bytes:0, used:never, actions:6
3822])
3823
3824OVS_VSWITCHD_STOP
3825AT_CLEANUP
3826
3827AT_SETUP([ofproto-dpif - fragment handling - actions])
3828OVS_VSWITCHD_START
ca5792f0 3829add_of_ports br0 1 2 3 4 5 6 90
b8778a0d
JR
3830
3831AT_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])
3832AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3833source field tcp_dst lacks correct prerequisites
3834ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3835])
3836
3837AT_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])
3838AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3839destination field tcp_src lacks correct prerequisites
3840ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3841])
3842
3843AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=set_field:8888->udp_src,output:1"], [1], [], [stderr])
3844AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3845set_field udp_src lacks correct prerequisities
3846ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3847])
3848
3849AT_CHECK([ovs-ofctl add-flow br0 "udp,ip_frag=later actions=load:8888->NXM_OF_UDP_DST[[]],output:1"], [1], [], [stderr])
3850AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3851set_field udp_dst lacks correct prerequisities
3852ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3853])
3854
3855AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_src,output:1"], [1], [], [stderr])
3856AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3857set_field sctp_src lacks correct prerequisities
3858ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3859])
3860
3861AT_CHECK([ovs-ofctl add-flow br0 "sctp,ip_frag=later actions=set_field:8888->sctp_dst,output:1"], [1], [], [stderr])
3862AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3863set_field sctp_dst lacks correct prerequisities
3864ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3865])
3866
3867AT_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])
3868AT_CHECK([tail -2 stderr | sed 's/^.*|WARN|//'], [0], [dnl
3869source field tcp_dst lacks correct prerequisites
3870ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT)
3871])
3872
3873AT_DATA([flows.txt], [dnl
3874priority=75 tcp actions=load:42->OXM_OF_TCP_SRC[[0..7]],output:1
3875])
3876AT_CHECK([ovs-ofctl -O OpenFlow12 replace-flows br0 flows.txt])
3877
3878AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
3879
3880mode=normal
3881
3882AT_CHECK([ovs-ofctl set-frags br0 $mode])
3883for frag in 4000 6000 6008 4010; do
3884 printf "\n%s\n" "----$mode $frag-----"
3885
3886 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"])
3887done
3888
4d182934
JS
3889dnl The set_field action only modifies 8 bits of the tcp_src, so both the flow
3890dnl wildcard and the set_field action have a mask of 0xFF. Up to (including)
3891dnl OVS-2.5, the wildcards and set_field mask are shared internally.
b8778a0d 3892AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3893flow-dump from non-dpdk interfaces:
4d182934
JS
3894recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3895recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=33419/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
b8778a0d
JR
3896recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:74, used:0.001s, actions:1
3897])
3898
98bb4286 3899AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3900AT_CHECK([ovs-ofctl set-frags br0 $mode])
3901for frag in 4000 6000 6008 4010; do
3902 printf "\n%s\n" "----$mode $frag truncated transport header -----"
3903
3904 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0018 2e24 $frag 40 06 465d ac11370d ac11370b 828b 0016"])
3905done
3906
3907AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3908flow-dump from non-dpdk interfaces:
4d182934
JS
3909recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3910recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
b8778a0d
JR
3911recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3912])
3913
98bb4286 3914AT_CHECK([ovs-appctl revalidator/purge], [0])
b8778a0d
JR
3915AT_CHECK([ovs-ofctl set-frags br0 $mode])
3916for frag in 4000 6000 6001 4002; do
3917 printf "\n%s\n" "----$mode $frag missing transport header-----"
3918
3919 AT_CHECK([ovs-appctl netdev-dummy/receive p90 "0021853763af 0026b98cb0f9 0800 4500 0014 2e24 $frag 40 06 465d ac11370d ac11370b"])
3920done
3921
3922AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
1c1e46ed 3923flow-dump from non-dpdk interfaces:
4d182934
JS
3924recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=no),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
3925recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=first),tcp(src=0/0xff), packets:0, bytes:0, used:never, actions:set(tcp(src=42/0xff)),1
b8778a0d
JR
3926recirc_id(0),in_port(90),eth_type(0x0800),ipv4(proto=6,frag=later), packets:1, bytes:60, used:0.001s, actions:1
3927])
3928
3929OVS_VSWITCHD_STOP
3930AT_CLEANUP
3931
848e8809
EJ
3932AT_SETUP([ofproto-dpif - exit])
3933OVS_VSWITCHD_START
ca5792f0 3934add_of_ports br0 1 2 3 10 11 12 13 14
848e8809
EJ
3935AT_DATA([flows.txt], [dnl
3936in_port=1 actions=output:10,exit,output:11
3937in_port=2 actions=output:12,resubmit:1,output:12
3938in_port=3 actions=output:13,resubmit:2,output:14
3939])
3940AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 3941AT_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
3942AT_CHECK([tail -1 stdout], [0],
3943 [Datapath actions: 10
3944])
50aa28fd 3945AT_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
3946AT_CHECK([tail -1 stdout], [0],
3947 [Datapath actions: 12,10
3948])
50aa28fd 3949AT_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
3950AT_CHECK([tail -1 stdout], [0],
3951 [Datapath actions: 13,12,10
3952])
3953OVS_VSWITCHD_STOP
3954AT_CLEANUP
c06bba01
JP
3955
3956
3957AT_SETUP([ofproto-dpif - mirroring, select_all])
2d5c1a20 3958AT_KEYWORDS([mirror mirrors mirroring])
432fca23 3959OVS_VSWITCHD_START
ca5792f0 3960add_of_ports br0 1 2 3
432fca23 3961ovs-vsctl \
c06bba01
JP
3962 set Bridge br0 mirrors=@m --\
3963 --id=@p3 get Port p3 --\
432fca23 3964 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 3965
c06bba01
JP
3966AT_DATA([flows.txt], [dnl
3967in_port=1 actions=output:2
3968in_port=2 actions=output:1
3969])
3970AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
3971
247527db 3972flow="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 3973AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3974AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 3975 [Datapath actions: 3,2
c06bba01
JP
3976])
3977
247527db 3978flow="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 3979AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 3980AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 3981 [Datapath actions: 3,1
c06bba01
JP
3982])
3983
3984OVS_VSWITCHD_STOP
3985AT_CLEANUP
3986
3987
3988AT_SETUP([ofproto-dpif - mirroring, select_src])
2d5c1a20 3989AT_KEYWORDS([mirror mirrors mirroring])
432fca23 3990OVS_VSWITCHD_START
ca5792f0 3991add_of_ports br0 1 2 3
432fca23 3992ovs-vsctl \
c06bba01
JP
3993 set Bridge br0 mirrors=@m --\
3994 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
432fca23 3995 --id=@m create Mirror name=mymirror select_src_port=@p1 output_port=@p3
c06bba01 3996
c06bba01
JP
3997AT_DATA([flows.txt], [dnl
3998in_port=1 actions=output:2
3999in_port=2 actions=output:1
4000])
4001AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4002
247527db 4003flow="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 4004AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4005AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4006 [Datapath actions: 3,2
c06bba01
JP
4007])
4008
247527db 4009flow="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 4010AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4011AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4012 [Datapath actions: 1
c06bba01
JP
4013])
4014OVS_VSWITCHD_STOP
4015AT_CLEANUP
4016
33158a18 4017AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
2d5c1a20 4018AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4019OVS_VSWITCHD_START
ca5792f0 4020add_of_ports br0 1 2
432fca23 4021ovs-vsctl \
33158a18
JP
4022 set Bridge br0 mirrors=@m --\
4023 --id=@p2 get Port p2 --\
432fca23 4024 --id=@m create Mirror name=mymirror select_all=true output_port=@p2
33158a18 4025
33158a18
JP
4026AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
4027
4028# "in_port" defaults to OFPP_NONE if it's not specified.
72d64e33 4029flow="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
4030AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4031AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4032 [Datapath actions: 1,2
33158a18
JP
4033])
4034
4035OVS_VSWITCHD_STOP
4036AT_CLEANUP
4037
c06bba01
JP
4038
4039AT_SETUP([ofproto-dpif - mirroring, select_dst])
2d5c1a20 4040AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4041OVS_VSWITCHD_START
ca5792f0 4042add_of_ports br0 1 2 3
432fca23 4043ovs-vsctl \
c06bba01
JP
4044 set Bridge br0 mirrors=@m --\
4045 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4046 --id=@m create Mirror name=mymirror select_dst_port=@p2 output_port=@p3
c06bba01 4047
c06bba01
JP
4048AT_DATA([flows.txt], [dnl
4049in_port=1 actions=output:2
4050in_port=2 actions=output:1
4051])
4052AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4053
247527db 4054flow="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 4055AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4056AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4057 [Datapath actions: 2,3
c06bba01
JP
4058])
4059
247527db 4060flow="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 4061AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4062AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4063 [Datapath actions: 1
c06bba01
JP
4064])
4065
4066OVS_VSWITCHD_STOP
4067AT_CLEANUP
4068
4069
4070AT_SETUP([ofproto-dpif - mirroring, select_vlan])
2d5c1a20 4071AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4072OVS_VSWITCHD_START
ca5792f0 4073add_of_ports br0 1 2 3
432fca23 4074ovs-vsctl \
c06bba01
JP
4075 set Bridge br0 mirrors=@m --\
4076 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
432fca23 4077 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
c06bba01 4078
c06bba01
JP
4079AT_DATA([flows.txt], [dnl
4080in_port=1, actions=output:2
4081])
4082AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4083
247527db 4084flow="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 4085AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4086AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4087 [Datapath actions: 2
c06bba01
JP
4088])
4089
247527db 4090flow="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 4091AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4092AT_CHECK_UNQUOTED([tail -1 stdout], [0],
247527db 4093 [Datapath actions: 2
c06bba01
JP
4094])
4095
247527db 4096flow="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 4097AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4098AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4099 [Datapath actions: 3,2
c06bba01
JP
4100])
4101
4102OVS_VSWITCHD_STOP
4103AT_CLEANUP
4104
4105
4106AT_SETUP([ofproto-dpif - mirroring, output_port])
2d5c1a20 4107AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4108OVS_VSWITCHD_START
ca5792f0 4109add_of_ports br0 1 2 3
432fca23 4110ovs-vsctl \
c06bba01
JP
4111 set Bridge br0 mirrors=@m --\
4112 --id=@p3 get Port p3 --\
432fca23 4113 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
c06bba01 4114
c06bba01
JP
4115AT_DATA([flows.txt], [dnl
4116in_port=1 actions=mod_vlan_vid:17,output:2
4117in_port=2 actions=output:1
4118])
4119AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4120
247527db 4121flow="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 4122AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4123AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4124 [Datapath actions: 3,push_vlan(vid=17,pcp=0),2
c06bba01
JP
4125])
4126
247527db 4127flow="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 4128AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01 4129AT_CHECK_UNQUOTED([tail -1 stdout], [0],
7efbc3b7 4130 [Datapath actions: 3,1
c06bba01
JP
4131])
4132
4133OVS_VSWITCHD_STOP
4134AT_CLEANUP
4135
c06bba01 4136AT_SETUP([ofproto-dpif - mirroring, output_vlan])
2d5c1a20 4137AT_KEYWORDS([mirror mirrors mirroring])
432fca23 4138OVS_VSWITCHD_START
ca5792f0 4139add_of_ports br0 1 2
432fca23 4140ovs-vsctl \
c06bba01 4141 set Bridge br0 mirrors=@m --\
432fca23 4142 --id=@m create Mirror name=mymirror select_all=true output_vlan=12
c06bba01 4143
c06bba01
JP
4144AT_DATA([flows.txt], [dnl
4145in_port=1 actions=output:2
4146in_port=2 actions=mod_vlan_vid:17,output:1
4147])
4148AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4149
247527db 4150flow="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 4151AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4152actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4153
e44768b7 4154expected="2,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4155AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4156mv stdout expout
247527db 4157AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01 4158
247527db 4159flow="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 4160AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow"], [0], [stdout])
c06bba01
JP
4161actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4162
e44768b7 4163expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),1,2,100"
247527db 4164AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
c06bba01 4165mv stdout expout
247527db 4166AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
c06bba01
JP
4167
4168OVS_VSWITCHD_STOP
4169AT_CLEANUP
b44a10b7 4170
faa624b4
BP
4171# This verifies that we don't get duplicate mirroring when mirror_packet()
4172# might be invoked recursively, as a check against regression.
4173AT_SETUP([ofproto-dpif - multiple VLAN output mirrors])
2d5c1a20 4174AT_KEYWORDS([mirror mirrors mirroring])
faa624b4
BP
4175OVS_VSWITCHD_START
4176add_of_ports br0 1 2 3
4177ovs-vsctl \
4178 -- set Bridge br0 fail-mode=standalone mirrors=@m1,@m2 \
4179 -- --id=@m1 create Mirror name=m1 select_all=true output_vlan=500 \
4180 -- --id=@m2 create Mirror name=m2 select_all=true output_vlan=501 \
4181 -- set Port br0 tag=0 \
4182 -- set Port p1 tag=0 \
4183 -- set Port p2 tag=500 \
4184 -- set Port p3 tag=501
4185
4186flow='in_port=1'
4187AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
4188AT_CHECK([tail -1 stdout | sed 's/Datapath actions: //
4189s/,/\
4190/g' | sort], [0], [100
41912
41923
4193])
4194
4195OVS_VSWITCHD_STOP
4196AT_CLEANUP
4197
29bae541
BP
4198# This test verifies that mirror state is preserved across recirculation.
4199#
4200# Otherwise, post-recirculation the ingress and the output to port 4
4201# would cause the packet to be mirrored to port 3 a second time.
4202AT_SETUP([ofproto-dpif - mirroring with recirculation])
2d5c1a20 4203AT_KEYWORDS([mirror mirrors mirroring])
29bae541 4204OVS_VSWITCHD_START
ca5792f0 4205add_of_ports br0 1 2 3 4
29bae541
BP
4206ovs-vsctl \
4207 set Bridge br0 mirrors=@m --\
4208 --id=@p3 get Port p3 --\
4209 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
4210
4211AT_DATA([flows.txt], [dnl
4212in_port=1 actions=2,debug_recirc,4
4213])
4214AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4215
4216flow="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)"
4217AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4218AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3,2,recirc(0x1)
4219])
4220AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4221AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 4
4222])
4223
4224OVS_VSWITCHD_STOP
4225AT_CLEANUP
4226
83a31283
BP
4227# This test verifies that the table ID is preserved across recirculation
4228# when a resubmit action requires it (because the action is relative to
4229# the current table rather than specifying a table).
4230AT_SETUP([ofproto-dpif - resubmit with recirculation])
4231OVS_VSWITCHD_START
ca5792f0 4232add_of_ports br0 1 2 3
83a31283
BP
4233
4234AT_DATA([flows.txt], [dnl
4235table=0 in_port=1 actions=2,resubmit(,1)
4236table=1 in_port=1 actions=debug_recirc,resubmit:55
4237table=1 in_port=55 actions=3
4238])
4239AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4240
4241flow="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)"
4242AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4243AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2,recirc(0x1)
4244])
4245AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4246AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 3
4247])
4248
4249OVS_VSWITCHD_STOP
4250AT_CLEANUP
4251
6b1c5734
BP
4252# This test verifies that "resubmit", when it triggers recirculation
4253# indirectly through the flow that it recursively invokes, is not
4254# re-executed when execution continues later post-recirculation.
4255AT_SETUP([ofproto-dpif - recirculation after resubmit])
4256OVS_VSWITCHD_START
ca5792f0 4257add_of_ports br0 1 2
6b1c5734
BP
4258
4259AT_DATA([flows.txt], [dnl
4260table=0 in_port=1 actions=resubmit(,1),2
4261table=1 in_port=1 actions=debug_recirc
4262])
4263AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4264
4265flow="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)"
4266AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow" -generate], [0], [stdout])
4267AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: recirc(0x1)
4268])
4269AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow,recirc_id(1)" -generate], [0], [stdout])
4270AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: 2
4271])
4272
4273OVS_VSWITCHD_STOP
4274AT_CLEANUP
4275
77ab5fd2
BP
4276dnl CHECK_CONTINUATION(TITLE, N_PORTS0, N_PORTS1, ACTIONS0, ACTIONS1, [EXTRA_SETUP])
4277dnl
4278dnl Checks the implementation of the continuation mechanism that allows the
4279dnl packet processing pipeline to be paused and resumed. Starts by creating
4280dnl bridge br0 with N_PORTS0 ports numbered 1 through N_PORTS0, and adds the
4281dnl flows listed in ACTIONS0 to that bridge. Then, injects a packet at port 1
4282dnl in the bridge, resuming each time the pipeline pauses, and expects a single
4283dnl packet to be output at each port 2 through N_PORTS0. Then, as long as
4284dnl ACTIONS0 still contains at least one "pause" action, removes one of them
4285dnl and repeats the process.
4286dnl
4287dnl If N_PORTS1 is nonzero, also creates a bridge br1 and adds ports numbered
4288dnl N_PORTS0 + 1 to N_PORTS0 + N_PORTS1 to it, as well as flows ACTIONS1.
4289dnl ACTIONS1 may also contain "pause" actions. Packets are only ever injected
4290dnl into port 1 on br0, so br1 only comes into action if a patch port (added
4291dnl by EXTRA_SETUP) jumps from one bridge to another.
4292dnl
4293dnl EXTRA_SETUP is an optional list of extra commands to run after setting up
4294dnl both bridges, e.g. to configure mirrors or patch ports.
4295m4_define([CHECK_CONTINUATION], [dnl
4296 AT_SETUP([ofproto-dpif - continuation - $1])
4297 AT_KEYWORDS([continuations pause resume])
4298 OVS_VSWITCHD_START
4299
4300 # count_matches STRING
4301 #
4302 # Prints on stdout the number of occurrences of STRING in stdin.
4303 count_matches () {
4304 sed -n ":start
4305 s/$[1]//p
4306 t start" | wc -l
4307 }
4308
4309 add_of_ports --pcap br0 `seq 1 $2`
4310 m4_if([$3], [0], [],
4311 [add_of_br 1
4312 add_of_ports --pcap br1 `seq m4_eval([$2 + 1]) m4_eval([$2 + $3])`])
4313
4314 AT_CAPTURE_FILE([ofctl_monitor0.log])
4315 AT_CHECK([ovs-ofctl monitor br0 resume --detach --no-chdir --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log])
4316 m4_if([$3], [0], [],
4317 [AT_CAPTURE_FILE([ofctl_monitor1.log])
4318 AT_CHECK([ovs-ofctl monitor br1 resume --detach --no-chdir --pidfile=ovs-ofctl1.pid 2> ofctl_monitor1.log])])
4319
4320 actions0='$4'
4321 actions1='$5'
4322 $6
4323 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)"
4324 n_packets=0
4325 n_resumes=0
4326 while true; do
4327 printf "\n\nactions for br0:\n%s\n" "$actions0"
4328 m4_if([$3], [0], [], [printf "actions for br1:\n%s\n" "$actions1"])
4329
4330 # Add flows.
4331 AT_CHECK([echo "$actions0" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br0 -])
4332 m4_if([$3], [0], [],
4333 [AT_CHECK([echo "$actions1" | sed 's/pause/controller(pause)/g' | ovs-ofctl -O OpenFlow13 add-flows br1 -])])
4334
4335 # Run a packet through the switch.
4336 AT_CHECK([ovs-appctl netdev-dummy/receive p1 "$flow"], [0], [stdout])
4337
4338 # Wait for the expected number of packets to show up.
4339 n_packets=`expr $n_packets + $2 - 1 + $3`
4340 echo "waiting for $n_packets packets..."
4341 OVS_WAIT_UNTIL([test $n_packets = `ovs-ofctl parse-pcap p*-tx.pcap | wc -l`])
4342
4343 # Wait for the expected number of NXT_RESUMEs to be logged.
4344 n_resumes=$(expr $n_resumes + $(echo "$actions0 $actions1" | count_matches pause) )
4345 echo "waiting for $n_resumes NXT_RESUMEs..."
4346 OVS_WAIT_UNTIL([test $n_resumes = `cat ofctl_monitor*.log | grep -c NXT_RESUME`])
4347
4348 # Eliminate one "pause" from the actions.
4349 #
4350 # If there were none left, then we're done.
4351 next_actions0=`echo "$actions0" | sed '1,/pause/s/pause//'`
4352 if test X"$actions0" = X"$next_actions0"; then
4353 next_actions1=`echo "$actions1" | sed '1,/pause/s/pause//'`
4354 if test X"$actions1" = X"$next_actions1"; then
4355 break
4356 else
4357 actions1=$next_actions1
4358 fi
4359 else
4360 actions0=$next_actions0
4361 fi
4362
4363 # Delete all the flows and verify that there are none, so that we
4364 # can be sure that our updated flow tables is actually in use
4365 # later.
4366 AT_CHECK([ovs-ofctl del-flows br0 && ovs-ofctl dump-flows br0 | strip_xids], [0],
4367 [NXST_FLOW reply:
4368])
4369 m4_if([$3], [0], [],
4370 [AT_CHECK([ovs-ofctl del-flows br1 && ovs-ofctl dump-flows br1 | strip_xids], [0],
4371 [NXST_FLOW reply:
4372])])
4373 done
4374 OVS_VSWITCHD_STOP
4375 AT_CLEANUP
4376])
4377
4378# Check that pause at the end of the pipeline works OK.
4379#
4380# (xlate_continuation() has a special case for no-op actions; this
4381# fails without that special case.)
4382CHECK_CONTINUATION([pause at end of pipeline], [2], [0], [actions=2 pause])
4383
4384# Check that remaining actions are preserved following resume.
4385CHECK_CONTINUATION([actions], [7], [0],
4386 [in_port=1 actions=pause 2 pause 3 pause 4 pause 5 pause 6 pause 7])
4387
4388# Check that multiple levels of resubmit continue following resume.
4389#
4390# The "resubmit:55", which is relative to the current table, is
4391# particularly interesting because it checks that the notion of the
4392# current table is correctly preserved.
4393CHECK_CONTINUATION([resubmit], [10], [0],
4394 [table=0 in_port=1 actions=pause 2 pause resubmit(,1) pause 10 pause
4395 table=1 in_port=1 actions=pause 3 pause resubmit(,2) pause 9 pause
4396 table=2 in_port=1 actions=pause 4 pause resubmit(,3) pause 8 pause
4397 table=3 in_port=1 actions=pause 5 pause resubmit:55 pause 7 pause
4398 table=3 in_port=55 actions=pause 6 pause])
4399
4400# Check that the action set is preserved across pause/resume.
4401CHECK_CONTINUATION([action set], [3], [0],
4402 [in_port=1 actions=1 pause resubmit(,1) pause 2
4403 table=1 actions=write_actions(3)])
4404
4405# Check that metadata and the stack used by push and pop is preserved
4406# across pause/resume.
4407CHECK_CONTINUATION([data stack], [3], [0],
4408 [in_port=1 actions=pause dnl
4409 set_field:1->reg0 dnl
4410 pause dnl
4411 set_field:2->reg1 dnl
4412 pause dnl
4413 output:NXM_NX_REG0[[]] dnl
4414 pause dnl
4415 push:NXM_NX_REG1[[]] dnl
4416 dnl
4417 pop:NXM_NX_REG2[[]] dnl
4418 pause dnl
4419 output:NXM_NX_REG2[[]] dnl
4420 pause dnl
4421 3])
4422
4423# Check that mirror output occurs once and once only, even if
4424# separated by pause/resume.
4425CHECK_CONTINUATION([mirroring], [5], [0],
4426 [in_port=1 actions=pause 2 pause 3 pause 4 pause], [],
4427 [ovs-vsctl \
4428 set Bridge br0 mirrors=@m --\
4429 --id=@p2 get Port p2 --\
4430 --id=@p3 get Port p3 --\
4431 --id=@p4 get Port p4 --\
4432 --id=@p5 get Port p5 --\
4433 --id=@m create Mirror name=mymirror select_dst_port=@p2,@p3,@p4 output_port=@p5])
4434
4435# Check that pause works in the presence of patch ports.
4436CHECK_CONTINUATION([patch ports], [4], [1],
4437 [table=0 in_port=1 actions=pause 2 resubmit(,1) pause 4
4438 table=1 in_port=1 actions=pause 3 pause 10 pause],
4439 [table=0 in_port=11 actions=pause 5 pause],
4440 [ovs-vsctl \
4441 -- add-port br0 patch10 \
4442 -- set interface patch10 type=patch options:peer=patch11 \
4443 ofport_request=10 \
4444 -- add-port br1 patch11 \
4445 -- set interface patch11 type=patch options:peer=patch10 \
4446 ofport_request=11])
4447
22bb3cbc
AW
4448# Two testcases below are for the ofproto/trace command
4449# The first one tests all correct syntax:
4450# ofproto/trace [dp_name] odp_flow [-generate|packet]
4451# ofproto/trace br_name br_flow [-generate|packet]
4452AT_SETUP([ofproto-dpif - ofproto/trace command 1])
4453OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 4454add_of_ports br0 1 2 3
22bb3cbc
AW
4455
4456AT_DATA([flows.txt], [dnl
4457in_port=1 actions=output:2
4458in_port=2 actions=output:1
4459])
4460AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4461
e063a73a 4462odp_flow="in_port(p1)"
22bb3cbc 4463br_flow="in_port=1"
0a37839c
GS
4464# Test command: ofproto/trace odp_flow with in_port as a name.
4465AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4466AT_CHECK([tail -1 stdout], [0], [dnl
4467Datapath actions: 2
4468])
4469
4470odp_flow="in_port(1)"
22bb3cbc
AW
4471# Test command: ofproto/trace odp_flow
4472AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4473AT_CHECK([tail -1 stdout], [0], [dnl
4474Datapath actions: 2
4475])
4476
4477# Test command: ofproto/trace dp_name odp_flow
4478AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$odp_flow"], [0], [stdout])
4479AT_CHECK([tail -1 stdout], [0], [dnl
4480Datapath actions: 2
4481])
4482# Test commmand: ofproto/trace br_name br_flow
4483AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4484AT_CHECK([tail -1 stdout], [0], [dnl
4485Datapath actions: 2
4486])
4487
4488# Delete the inserted flows
4489AT_CHECK([ovs-ofctl del-flows br0 "in_port=1"], [0], [stdout])
4490AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"], [0], [stdout])
4491
78c9486d 4492# This section below tests the [-generate] option
22bb3cbc 4493odp_flow="in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff)"
78c9486d 4494br_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
4495
4496# Test command: ofproto/trace odp_flow
4497AT_CHECK([ovs-appctl ofproto/trace "$odp_flow"], [0], [stdout])
4498# Check for no MAC learning entry
4499AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4500 port VLAN MAC Age
4501])
4502
4503# Test command: ofproto/trace br_name br_flow
4504AT_CHECK([ovs-appctl ofproto/trace br0 "$br_flow"], [0], [stdout])
4505# Check for no MAC learning entry
4506AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4507 port VLAN MAC Age
4508])
4509
4510# Test command: ofproto/trace odp_flow -generate
4511AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" -generate], [0], [stdout])
4512# Check for the MAC learning entry
4513AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4514 port VLAN MAC Age
4515 3 0 50:54:00:00:00:05 ?
4516])
4517
4518# Test command: ofproto/trace dp_name odp_flow -generate
4519AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4520 "in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05)" \
4521 -generate], [0], [stdout])
4522# Check for both MAC learning entries
4523AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4524 port VLAN MAC Age
4525 3 0 50:54:00:00:00:05 ?
4526 1 0 50:54:00:00:00:06 ?
4527])
4528
4529# Test command: ofproto/trace br_name br_flow -generate
4530AT_CHECK([ovs-appctl ofproto/trace br0 \
4531 "in_port=2,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:06" \
4532 -generate], [0], [stdout])
4533# Check for both MAC learning entries.
4534AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
4535 port VLAN MAC Age
4536 3 0 50:54:00:00:00:05 ?
4537 1 0 50:54:00:00:00:06 ?
4538 2 0 50:54:00:00:00:07 ?
4539])
4540
4541# This section beflow tests the [packet] option
4542# The ovs-tcpundump of packets between port1 and port2
4543pkt1to2="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4544pkt2to1="50540000000150540000000208064500001C000100004001F98CC0A80002C0A800010800F7FF00000000"
4545
4546# Construct the MAC learning table
4547AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4548 "in_port(1),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff)" \
4549 -generate], [0], [stdout])
4550
4551# Construct the MAC learning table
4552AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4553 "in_port(2),eth(src=50:54:00:00:00:02,dst=ff:ff:ff:ff:ff:ff)" \
4554 -generate], [0], [stdout])
4555
4556# Test command: ofproto/trace odp_flow packet
4557AT_CHECK([ovs-appctl ofproto/trace \
4558 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4559AT_CHECK([tail -1 stdout], [0], [dnl
4560Datapath actions: 2
4561])
b6f00895 4562AT_CHECK([head -n 2 stdout], [0], [dnl
22bb3cbc 4563Bridge: br0
78c9486d 4564Flow: 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
4565])
4566
4567# Test command: ofproto/trace dp_name odp_flow packet
4568AT_CHECK([ovs-appctl ofproto/trace ovs-dummy \
4569 "in_port(1),skb_priority(1),skb_mark(2)" "$pkt1to2"], [0], [stdout])
4570AT_CHECK([tail -1 stdout], [0], [dnl
4571Datapath actions: 2
4572])
b6f00895 4573AT_CHECK([head -n 2 stdout], [0], [dnl
22bb3cbc 4574Bridge: br0
78c9486d 4575Flow: 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
4576])
4577
4578# Test command: ofproto/trace br_name br_flow packet
4579AT_CHECK([ovs-appctl ofproto/trace br0 \
1362e248 4580 "in_port=2,skb_priority=2,pkt_mark=1" "$pkt2to1"], [0], [stdout],[stderr])
22bb3cbc 4581AT_CHECK([tail -1 stdout], [0], [dnl
ed2e7245 4582Datapath actions: 1
22bb3cbc
AW
4583])
4584AT_CHECK([head -n 2 stdout], [0], [dnl
b6f00895 4585Bridge: br0
78c9486d 4586Flow: 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
4587])
4588
4589OVS_VSWITCHD_STOP
4590AT_CLEANUP
4591
4592# The second test tests the corner cases
4593AT_SETUP([ofproto-dpif - ofproto/trace command 2])
4594OVS_VSWITCHD_START
ca5792f0 4595add_of_ports br0 1 2
22bb3cbc
AW
4596
4597# Define flows
4598odp_flow="in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:00:02)"
4599br_flow="in_port=1,dl_src=50:54:00:00:00:01,dl_dst=50:54:00:00:00:02"
4600# Define options
4601generate="-generate"
4602pkt="50540000000250540000000108064500001C000100004001F98CC0A80001C0A800020800F7FF00000000"
4603
4604# Test incorrect command: ofproto/trace wrong_name odp_flow [-generate|packet]
4605m4_foreach(
4606[option],
4607[[],
4608["$generate"],
4609["$pkt"]],
4610[AT_CHECK([ovs-appctl ofproto/trace wrong_name "$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 empty_string odp_flow [-generate|packet]
4618m4_foreach(
4619[option],
4620[[],
4621["$generate"],
4622["$pkt"]],
4623[AT_CHECK([ovs-appctl ofproto/trace "" "$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 nonexist_dp_name odp_flow [-generate|packet]
4631m4_foreach(
4632[option],
4633[[],
4634["$generate"],
4635["$pkt"]],
4636[AT_CHECK([ovs-appctl ofproto/trace ovs-system "$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 br_name odp_flow [-generate|packet]
4644m4_foreach(
4645[option],
4646[[],
4647["$generate"],
4648["$pkt"]],
4649[AT_CHECK([ovs-appctl ofproto/trace br0 "$odp_flow" option],
4650 [2], [], [stderr])
4651AT_CHECK([tail -2 stderr], [0], [dnl
0a37839c 4652Cannot find the datapath
22bb3cbc
AW
4653ovs-appctl: ovs-vswitchd: server returned an error
4654])])
4655
4656# Test incorrect command: ofproto/trace dp_name br_flow [-generate|packet]
4657m4_foreach(
4658[option],
4659[[],
4660["$generate"],
4661["$pkt"]],
4662[AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$br_flow" option],
4663 [2], [], [stderr])
4664AT_CHECK([tail -2 stderr], [0], [dnl
4665Unknown bridge name
4666ovs-appctl: ovs-vswitchd: server returned an error
4667])])
4668
4669# Test incorrect command: ofproto/trace br_flow [-generate|packet]
4670m4_foreach(
4671[option],
4672[[],
4673["$generate"],
4674["$pkt"]],
4675[AT_CHECK([ovs-appctl ofproto/trace "$br_flow" option],
4676 [2], [], [stderr])
4677AT_CHECK([tail -2 stderr], [0], [dnl
4678Must specify bridge name
4679ovs-appctl: ovs-vswitchd: server returned an error
4680])])
4681
4682# Test incorrect command: ofproto/trace dp_name odp_flow garbage_option
4683AT_CHECK([ovs-appctl ofproto/trace \
4684 ovs-dummy "$odp_flow" garbage_option],
4685 [2], [stdout],[stderr])
4686AT_CHECK([tail -2 stderr], [0], [dnl
4687Trailing garbage in packet data
4688ovs-appctl: ovs-vswitchd: server returned an error
4689])
4690
4691# Test incorrect command: ofproto/trace with 4 arguments
4692AT_CHECK([ovs-appctl ofproto/trace \
4693 arg1, arg2, arg3, arg4], [2], [stdout],[stderr])
4694AT_CHECK([tail -2 stderr], [0], [dnl
4695"ofproto/trace" command takes at most 3 arguments
4696ovs-appctl: ovs-vswitchd: server returned an error
4697])
4698
4699# Test incorrect command: ofproto/trace with 0 argument
4700AT_CHECK([ovs-appctl ofproto/trace ], [2], [stdout],[stderr])
4701AT_CHECK([tail -2 stderr], [0], [dnl
4702"ofproto/trace" command requires at least 1 arguments
4703ovs-appctl: ovs-vswitchd: server returned an error
4704])
4705
4706OVS_VSWITCHD_STOP
4707AT_CLEANUP
4708
b6ec827f
JS
4709# The third test checks that the output of "ovs-dpctl -m" is valid to trace.
4710AT_SETUP([ofproto-dpif - ofproto/trace from dpctl output])
4711OVS_VSWITCHD_START([dnl
4712 set Open_vSwitch . other_config:max-idle=10000 \
4713 -- add-port br0 p1 -- set Interface p1 type=dummy])
4714
4715AT_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)'])
4716ovs-appctl revalidator/wait
4717AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows1.txt])
4718
4719odp_flow=`cat dp_flows1.txt`
4720AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4721Bridge: br0
4722Flow: <cleared>
4723No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4724
4725Rule: table=254 cookie=0 priority=0,reg0=0x2
4726OpenFlow actions=drop
4727
4728Final flow: <cleared>
4729Megaflow: <cleared>
4730Datapath actions: drop
4731])
4732
4733dnl Now, try again without megaflows:
4734ovs-appctl upcall/disable-megaflows
4735
4736AT_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)'])
4737ovs-appctl revalidator/wait
4738AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | sed 's/, packets.*$//' > dp_flows2.txt])
4739
4740odp_flow=`cat dp_flows2.txt`
4741AT_CHECK([ovs-appctl ofproto/trace "$odp_flow" | sed 's/\([[Ff]]low:\).*/\1 <cleared>/'], [0], [dnl
4742Bridge: br0
4743Flow: <cleared>
4744No match, packets dropped because OFPPC_NO_PACKET_IN is set on in_port.
4745
4746Rule: table=254 cookie=0 priority=0,reg0=0x2
4747OpenFlow actions=drop
4748
4749Final flow: <cleared>
4750Megaflow: <cleared>
4751Datapath actions: drop
4752])
4753
4754OVS_VSWITCHD_STOP
4755AT_CLEANUP
4756
aee0979b
BP
4757AT_SETUP([ofproto-dpif - ofproto/trace-packet-out])
4758OVS_VSWITCHD_START
ca5792f0 4759add_of_ports br0 1 2 3
aee0979b
BP
4760
4761AT_DATA([flows.txt], [dnl
4762in_port=1 actions=output:2
4763in_port=2 actions=output:1
4764])
4765AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
4766
4767AT_CHECK([ovs-appctl ofproto/trace-packet-out br0 in_port=1 'mod_vlan_vid:123,resubmit(,0)'], [0], [stdout])
4768AT_CHECK([tail -1 stdout], [0], [dnl
4769Datapath actions: push_vlan(vid=123,pcp=0),2
4770])
4771
4772OVS_VSWITCHD_STOP
4773AT_CLEANUP
4774
4775
b44a10b7
BP
4776m4_define([OFPROTO_TRACE],
4777 [flow="$2"
4778 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
4779 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
4780 expected="$4"
4781 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
4782 [0], [stdout])
4783 mv stdout expout
4784 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
4785 [0], [expout])])
4786
4787AT_SETUP([ofproto-dpif - MAC learning])
432fca23 4788OVS_VSWITCHD_START([set bridge br0 fail-mode=standalone])
ca5792f0 4789add_of_ports br0 1 2 3
b44a10b7 4790
b44a10b7
BP
4791arp='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)'
4792
4793# Trace an ARP packet arriving on p3, to create a MAC learning entry.
4794OFPROTO_TRACE(
50aa28fd 4795 [ovs-dummy],
247527db 4796 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4797 [-generate],
e44768b7 4798 [1,2,100])
b44a10b7
BP
4799
4800# Check for the MAC learning entry.
83664f72 4801AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4802 port VLAN MAC Age
247527db 4803 3 0 50:54:00:00:00:05 ?
b44a10b7
BP
4804])
4805
4806# Trace a packet arrival destined for the learned MAC.
4807# (This will also learn a MAC.)
4808OFPROTO_TRACE(
50aa28fd 4809 [ovs-dummy],
247527db 4810 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
b44a10b7 4811 [-generate],
247527db 4812 [3])
b44a10b7
BP
4813
4814# Check for both MAC learning entries.
83664f72 4815AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4816 port VLAN MAC Age
247527db
BP
4817 3 0 50:54:00:00:00:05 ?
4818 1 0 50:54:00:00:00:06 ?
b44a10b7
BP
4819])
4820
4821# Trace a packet arrival that updates the first learned MAC entry.
4822OFPROTO_TRACE(
50aa28fd 4823 [ovs-dummy],
247527db 4824 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4825 [-generate],
e44768b7 4826 [1,3,100])
b44a10b7
BP
4827
4828# Check that the MAC learning entry was updated.
83664f72 4829AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4830 port VLAN MAC Age
247527db
BP
4831 1 0 50:54:00:00:00:06 ?
4832 2 0 50:54:00:00:00:05 ?
b44a10b7
BP
4833])
4834
4835# Add another bridge.
4836AT_CHECK(
4837 [ovs-vsctl \
4838 -- add-br br1 \
ad28062f 4839 -- set bridge br1 datapath-type=dummy])
ca5792f0 4840add_of_ports br1 4 5
b44a10b7
BP
4841
4842# Trace some packet arrivals in br1 to create MAC learning entries there too.
4843OFPROTO_TRACE(
50aa28fd 4844 [ovs-dummy],
247527db 4845 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4846 [-generate],
e44768b7 4847 [5,101])
b44a10b7 4848OFPROTO_TRACE(
50aa28fd 4849 [ovs-dummy],
247527db 4850 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
b44a10b7 4851 [-generate],
e44768b7 4852 [4,101])
b44a10b7
BP
4853
4854# Check that the MAC learning entries were added.
83664f72 4855AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4856 port VLAN MAC Age
247527db
BP
4857 4 0 50:54:00:00:00:06 ?
4858 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
4859])
4860
4861# Delete port p1 and see that its MAC learning entry disappeared, and
4862# that the MAC learning entry for the same MAC was also deleted from br1.
4863AT_CHECK([ovs-vsctl del-port p1])
83664f72 4864AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4865 port VLAN MAC Age
247527db 4866 2 0 50:54:00:00:00:05 ?
b44a10b7 4867])
83664f72 4868AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]\{1,\}$/?/'], [0], [dnl
b44a10b7 4869 port VLAN MAC Age
247527db 4870 5 0 50:54:00:00:00:07 ?
b44a10b7
BP
4871])
4872
4873OVS_VSWITCHD_STOP
4874AT_CLEANUP
17f7f7e0 4875
c4069512
BP
4876AT_SETUP([ofproto-dpif - MAC table overflow])
4877OVS_VSWITCHD_START(
ad28062f 4878 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 4879add_of_ports br0 1 2 3
c4069512
BP
4880
4881arp='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)'
4882
4883AT_CHECK([ovs-appctl time/stop])
4884
4885# Trace 10 ARP packets arriving on p3, to create MAC learning entries.
4886for i in 0 1 2 3 4 5 6 7 8 9; do
4887 OFPROTO_TRACE(
50aa28fd 4888 [ovs-dummy],
c4069512
BP
4889 [in_port(3),eth(src=50:54:00:00:00:0$i,dst=ff:ff:ff:ff:ff:ff),$arp],
4890 [-generate],
4891 [1,2,100])
4892 ovs-appctl time/warp 1000
4893done
4894
4895# Check for the MAC learning entries.
4896AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4897 [0], [dnl
4898 3 0 50:54:00:00:00:00
4899 3 0 50:54:00:00:00:01
4900 3 0 50:54:00:00:00:02
4901 3 0 50:54:00:00:00:03
4902 3 0 50:54:00:00:00:04
4903 3 0 50:54:00:00:00:05
4904 3 0 50:54:00:00:00:06
4905 3 0 50:54:00:00:00:07
4906 3 0 50:54:00:00:00:08
4907 3 0 50:54:00:00:00:09
4908 port VLAN MAC Age
4909])
4910
4911# Trace another ARP packet on another MAC.
4912OFPROTO_TRACE(
50aa28fd 4913 [ovs-dummy],
c4069512
BP
4914 [in_port(3),eth(src=50:54:00:00:00:10,dst=ff:ff:ff:ff:ff:ff),$arp],
4915 [-generate],
4916 [1,2,100])
4917
4918# Check that the new one chased the oldest one out of the table.
4919AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]\{1,\}$/?/' | sort],
4920 [0], [dnl
4921 3 0 50:54:00:00:00:01 ?
4922 3 0 50:54:00:00:00:02 ?
4923 3 0 50:54:00:00:00:03 ?
4924 3 0 50:54:00:00:00:04 ?
4925 3 0 50:54:00:00:00:05 ?
4926 3 0 50:54:00:00:00:06 ?
4927 3 0 50:54:00:00:00:07 ?
4928 3 0 50:54:00:00:00:08 ?
4929 3 0 50:54:00:00:00:09 ?
4930 3 0 50:54:00:00:00:10 ?
4931 port VLAN MAC Age
4932])
4933OVS_VSWITCHD_STOP
4934AT_CLEANUP
4935
9d078ec2
BP
4936AT_SETUP([ofproto-dpif - MAC table overflow fairness])
4937OVS_VSWITCHD_START(
4938 [set bridge br0 fail-mode=standalone other-config:mac-table-size=10])
ca5792f0 4939add_of_ports br0 1 2 3 4 5 6
9d078ec2
BP
4940
4941arp='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)'
4942
4943AT_CHECK([ovs-appctl time/stop])
4944
4945# Trace packets with 2 different source MACs arriving on each of the 5
4946# ports, filling up the 10-entry learning table.
4947for i in 0 1 2 3 4 5 6 7 8 9; do
4948 p=`expr $i / 2 + 1`
4949 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
4950 ovs-appctl time/warp 1000
4951done
4952
4953# Check for the MAC learning entries.
4954AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4955 [0], [dnl
4956 1 0 50:54:00:00:00:00
4957 1 0 50:54:00:00:00:01
4958 2 0 50:54:00:00:00:02
4959 2 0 50:54:00:00:00:03
4960 3 0 50:54:00:00:00:04
4961 3 0 50:54:00:00:00:05
4962 4 0 50:54:00:00:00:06
4963 4 0 50:54:00:00:00:07
4964 5 0 50:54:00:00:00:08
4965 5 0 50:54:00:00:00:09
4966 port VLAN MAC Age
4967])
4968
4969# Now trace 16 new MACs on another port.
4970for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
4971 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
4972 ovs-appctl time/warp 1000
4973done
4974
4975# Check the results.
4976#
4977# Our eviction algorithm on overflow is that an arbitrary (but deterministic)
4978# one of the ports with the most learned MACs loses the least recently used
4979# one. Thus, the new port will end up with 3 MACs, 3 of the old ports with 1
4980# MAC each, and the other 2 of the old ports with 2 MACs each.
4981#
4982# (If someone changes lib/heap.c to do something different with equal-priority
4983# nodes, then the output below could change, but it would still follow the
4984# rules explained above.)
4985AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/ *[[0-9]]\{1,\}$//' | sort],
4986 [0], [dnl
4987 1 0 50:54:00:00:00:01
4988 2 0 50:54:00:00:00:03
4989 3 0 50:54:00:00:00:04
4990 3 0 50:54:00:00:00:05
4991 4 0 50:54:00:00:00:07
4992 5 0 50:54:00:00:00:08
4993 5 0 50:54:00:00:00:09
4994 6 0 50:54:00:00:0d:ff
4995 6 0 50:54:00:00:0e:ff
4996 6 0 50:54:00:00:0f:ff
4997 port VLAN MAC Age
4998])
4999OVS_VSWITCHD_STOP
5000AT_CLEANUP
5001
4819b3a5 5002# CHECK_SFLOW_SAMPLING_PACKET(LOOPBACK_ADDR)
e731d71b
AS
5003#
5004# Test that sFlow samples packets correctly using IPv4/IPv6 sFlow collector
e731d71b 5005m4_define([CHECK_SFLOW_SAMPLING_PACKET],
4819b3a5 5006 [AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
e731d71b
AS
5007 OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5008
53eb8cb8 5009 on_exit 'kill `cat test-sflow.pid`'
eadd1644 5010 AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:$1 > sflow.log], [0], [], [ignore])
e731d71b 5011 AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5012 PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
e731d71b
AS
5013 ovs-appctl time/stop
5014
ca5792f0 5015 add_of_ports br0 1 2
e731d71b
AS
5016 ovs-vsctl \
5017 set Interface br0 options:ifindex=1002 -- \
5018 set Interface p1 options:ifindex=1004 -- \
5019 set Interface p2 options:ifindex=1003 -- \
5020 set Bridge br0 sflow=@sf -- \
5021 --id=@sf create sflow targets=\"$1:$SFLOW_PORT\" \
9a9808d7 5022 header=128 sampling=1 polling=1 agent=$LOOPBACK_INTERFACE
e731d71b
AS
5023
5024 dnl open with ARP packets to seed the bridge-learning. The output
5025 dnl ifIndex numbers should be reported predictably after that.
5026 dnl Since we set sampling=1 we should see all of these packets
5027 dnl reported. Sorting the output by data-source and seqNo makes
5028 dnl it deterministic. Ensuring that we send at least two packets
5029 dnl into each port means we get to check the seq nos are
5030 dnl incrementing correctly.
5031 dnl because packets from different ports can be handled by separate
5032 dnl threads, put some sleeps
5033
5034 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)'
5035 sleep 1
5036 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)'
5037 sleep 1
5038 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)'
5039 sleep 1
5040 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)'
5041 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)'
5042
5043 dnl sleep long enough to get more than one counter sample
5044 dnl from each datasource so we can check sequence numbers
bdba1947 5045 ovs-appctl time/warp 3000 100
e731d71b 5046 OVS_VSWITCHD_STOP
d9c8c57c 5047 OVS_APP_EXIT_AND_WAIT([test-sflow])
8073dd31 5048
e731d71b 5049 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
8073dd31
NM
5050 /g']], [0], [dnl
5051HEADER
5052 dgramSeqNo=1
743cea45 5053 ds=127.0.0.1>2:1000
8073dd31
NM
5054 fsSeqNo=1
5055 in_vlan=0
5056 in_priority=0
5057 out_vlan=0
5058 out_priority=0
5059 meanSkip=1
5060 samplePool=1
5061 dropEvents=0
743cea45 5062 in_ifindex=1004
8073dd31
NM
5063 in_format=0
5064 out_ifindex=2
5065 out_format=2
5066 hdr_prot=1
5067 pkt_len=64
5068 stripped=4
5069 hdr_len=60
743cea45 5070 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
5071HEADER
5072 dgramSeqNo=1
743cea45 5073 ds=127.0.0.1>2:1000
8073dd31
NM
5074 fsSeqNo=2
5075 in_vlan=0
5076 in_priority=0
5077 out_vlan=0
5078 out_priority=0
5079 meanSkip=1
5080 samplePool=2
5081 dropEvents=0
5082 in_ifindex=1003
5083 in_format=0
743cea45
NM
5084 out_ifindex=2
5085 out_format=2
8073dd31
NM
5086 hdr_prot=1
5087 pkt_len=64
5088 stripped=4
5089 hdr_len=60
743cea45 5090 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
5091HEADER
5092 dgramSeqNo=1
743cea45 5093 ds=127.0.0.1>2:1000
8073dd31
NM
5094 fsSeqNo=3
5095 in_vlan=0
5096 in_priority=0
5097 out_vlan=0
5098 out_priority=0
5099 meanSkip=1
5100 samplePool=3
5101 dropEvents=0
743cea45 5102 in_ifindex=1004
8073dd31 5103 in_format=0
743cea45 5104 out_ifindex=1003
8073dd31
NM
5105 out_format=0
5106 hdr_prot=1
5107 pkt_len=64
5108 stripped=4
5109 hdr_len=60
743cea45 5110 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
5111HEADER
5112 dgramSeqNo=1
743cea45
NM
5113 ds=127.0.0.1>2:1000
5114 fsSeqNo=4
8073dd31
NM
5115 in_vlan=0
5116 in_priority=0
5117 out_vlan=0
5118 out_priority=0
5119 meanSkip=1
743cea45 5120 samplePool=4
8073dd31 5121 dropEvents=0
743cea45 5122 in_ifindex=1003
8073dd31 5123 in_format=0
743cea45
NM
5124 out_ifindex=1004
5125 out_format=0
8073dd31
NM
5126 hdr_prot=1
5127 pkt_len=64
5128 stripped=4
5129 hdr_len=60
743cea45 5130 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
5131HEADER
5132 dgramSeqNo=1
743cea45
NM
5133 ds=127.0.0.1>2:1000
5134 fsSeqNo=5
8073dd31
NM
5135 in_vlan=0
5136 in_priority=0
5137 out_vlan=0
5138 out_priority=0
5139 meanSkip=1
743cea45 5140 samplePool=5
8073dd31 5141 dropEvents=0
743cea45 5142 in_ifindex=1003
8073dd31 5143 in_format=0
743cea45 5144 out_ifindex=1004
8073dd31
NM
5145 out_format=0
5146 hdr_prot=1
5147 pkt_len=64
5148 stripped=4
5149 hdr_len=60
52105b67 5150 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
5151])
5152
50b9699f 5153 AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'IFCOUNTERS|ERROR|PORTNAME|OPENFLOWPORT' | head -18 | sed 's/ /\
8073dd31
NM
5154 /g']], [0], [dnl
5155IFCOUNTERS
5156 dgramSeqNo=2
5157 ds=127.0.0.1>0:1002
5158 csSeqNo=1
5159 ifindex=1002
5160 type=6
5161 ifspeed=100000000
5162 direction=0
1839c356 5163 status=0
8073dd31
NM
5164 in_octets=0
5165 in_unicasts=0
d6e3feb5 5166 in_multicasts=4294967295
8073dd31 5167 in_broadcasts=4294967295
d6e3feb5 5168 in_discards=4294967295
5169 in_errors=4294967295
8073dd31
NM
5170 in_unknownprotos=4294967295
5171 out_octets=120
5172 out_unicasts=2
5173 out_multicasts=4294967295
5174 out_broadcasts=4294967295
d6e3feb5 5175 out_discards=4294967295
5176 out_errors=4294967295
8073dd31
NM
5177 promiscuous=0
5178IFCOUNTERS
5179 dgramSeqNo=2
5180 ds=127.0.0.1>0:1003
5181 csSeqNo=1
5182 ifindex=1003
5183 type=6
5184 ifspeed=100000000
5185 direction=0
5186 status=0
52105b67 5187 in_octets=138
8073dd31 5188 in_unicasts=3
d6e3feb5 5189 in_multicasts=4294967295
8073dd31 5190 in_broadcasts=4294967295
d6e3feb5 5191 in_discards=4294967295
5192 in_errors=4294967295
8073dd31
NM
5193 in_unknownprotos=4294967295
5194 out_octets=120
5195 out_unicasts=2
5196 out_multicasts=4294967295
5197 out_broadcasts=4294967295
d6e3feb5 5198 out_discards=4294967295
5199 out_errors=4294967295
8073dd31
NM
5200 promiscuous=0
5201IFCOUNTERS
5202 dgramSeqNo=2
5203 ds=127.0.0.1>0:1004
5204 csSeqNo=1
5205 ifindex=1004
5206 type=6
5207 ifspeed=100000000
5208 direction=0
5209 status=0
5210 in_octets=84
5211 in_unicasts=2
d6e3feb5 5212 in_multicasts=4294967295
8073dd31 5213 in_broadcasts=4294967295
d6e3feb5 5214 in_discards=4294967295
5215 in_errors=4294967295
8073dd31
NM
5216 in_unknownprotos=4294967295
5217 out_octets=180
5218 out_unicasts=3
5219 out_multicasts=4294967295
5220 out_broadcasts=4294967295
d6e3feb5 5221 out_discards=4294967295
5222 out_errors=4294967295
8073dd31
NM
5223 promiscuous=0
5224IFCOUNTERS
5225 dgramSeqNo=3
5226 ds=127.0.0.1>0:1002
5227 csSeqNo=2
5228 ifindex=1002
5229 type=6
5230 ifspeed=100000000
5231 direction=0
1839c356 5232 status=0
8073dd31
NM
5233 in_octets=0
5234 in_unicasts=0
d6e3feb5 5235 in_multicasts=4294967295
8073dd31 5236 in_broadcasts=4294967295
d6e3feb5 5237 in_discards=4294967295
5238 in_errors=4294967295
8073dd31
NM
5239 in_unknownprotos=4294967295
5240 out_octets=120
5241 out_unicasts=2
5242 out_multicasts=4294967295
5243 out_broadcasts=4294967295
d6e3feb5 5244 out_discards=4294967295
5245 out_errors=4294967295
8073dd31
NM
5246 promiscuous=0
5247IFCOUNTERS
5248 dgramSeqNo=3
5249 ds=127.0.0.1>0:1003
5250 csSeqNo=2
5251 ifindex=1003
5252 type=6
5253 ifspeed=100000000
5254 direction=0
5255 status=0
52105b67 5256 in_octets=138
8073dd31 5257 in_unicasts=3
d6e3feb5 5258 in_multicasts=4294967295
8073dd31 5259 in_broadcasts=4294967295
d6e3feb5 5260 in_discards=4294967295
5261 in_errors=4294967295
8073dd31
NM
5262 in_unknownprotos=4294967295
5263 out_octets=120
5264 out_unicasts=2
5265 out_multicasts=4294967295
5266 out_broadcasts=4294967295
d6e3feb5 5267 out_discards=4294967295
5268 out_errors=4294967295
8073dd31
NM
5269 promiscuous=0
5270IFCOUNTERS
5271 dgramSeqNo=3
5272 ds=127.0.0.1>0:1004
5273 csSeqNo=2
5274 ifindex=1004
5275 type=6
5276 ifspeed=100000000
5277 direction=0
5278 status=0
5279 in_octets=84
5280 in_unicasts=2
d6e3feb5 5281 in_multicasts=4294967295
8073dd31 5282 in_broadcasts=4294967295
d6e3feb5 5283 in_discards=4294967295
5284 in_errors=4294967295
8073dd31
NM
5285 in_unknownprotos=4294967295
5286 out_octets=180
5287 out_unicasts=3
5288 out_multicasts=4294967295
5289 out_broadcasts=4294967295
d6e3feb5 5290 out_discards=4294967295
5291 out_errors=4294967295
8073dd31 5292 promiscuous=0
50b9699f
NM
5293OPENFLOWPORT
5294 datapath_id=18364758544493064720
5295 port_no=1
5296OPENFLOWPORT
5297 datapath_id=18364758544493064720
5298 port_no=1
5299OPENFLOWPORT
5300 datapath_id=18364758544493064720
5301 port_no=2
5302OPENFLOWPORT
5303 datapath_id=18364758544493064720
5304 port_no=2
5305OPENFLOWPORT
5306 datapath_id=18364758544493064720
5307 port_no=65534
5308OPENFLOWPORT
5309 datapath_id=18364758544493064720
5310 port_no=65534
5311PORTNAME
5312 portName=br0
5313PORTNAME
5314 portName=br0
5315PORTNAME
5316 portName=p1
5317PORTNAME
5318 portName=p1
5319PORTNAME
5320 portName=p2
5321PORTNAME
5322 portName=p2
4819b3a5 5323])])
17f7f7e0 5324
4819b3a5
BP
5325AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv4 collector])
5326CHECK_SFLOW_SAMPLING_PACKET([127.0.0.1])
5327AT_CLEANUP
5328
5329AT_SETUP([ofproto-dpif - sFlow packet sampling - IPv6 collector])
5330AT_SKIP_IF([test $HAVE_IPV6 = no])
5331CHECK_SFLOW_SAMPLING_PACKET([[[::1]]])
5332AT_CLEANUP
1e04fcc8 5333
50b9699f 5334dnl Test sFlow LAG structures
7321bda3 5335AT_SETUP([ofproto-dpif - sFlow packet sampling - LACP structures])
80ee73d3 5336AT_SKIP_IF([test "$IS_WIN32" = "yes"])
50b9699f
NM
5337OVS_VSWITCHD_START([dnl
5338 add-bond br0 bond p1 p2 -- \
5339 set Port bond lacp=active bond-mode=active-backup \
5340 other_config:lacp-time="fast" \
5341 other_config:lacp-system-id=11:22:33:44:55:66 \
5342 other_config:lacp-system-priority=54321 -- \
5343 set Interface p1 type=dummy \
5344 other_config:lacp-port-id=11 \
5345 other_config:lacp-port-priority=111 \
5346 other_config:lacp-aggregation-key=3333 -- \
5347 set Interface p2 type=dummy \
5348 other_config:lacp-port-id=22 \
5349 other_config:lacp-port-priority=222 \
5350 other_config:lacp-aggregation-key=3333 ])
5351
53eb8cb8 5352on_exit 'kill `cat test-sflow.pid`'
50b9699f
NM
5353AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5354AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5355PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
50b9699f
NM
5356
5357ovs-appctl time/stop
5358
5359ovs-vsctl \
5360 set Interface p1 options:ifindex=1003 -- \
5361 set Bridge br0 sflow=@sf -- \
5362 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5363 header=128 sampling=1 polling=1
5364
5365dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
cea4a6d7
JS
5366AT_CHECK([ovs-appctl time/warp 2000 100], [0], [ignore])
5367AT_CHECK([ovs-appctl revalidator/purge], [0])
50b9699f 5368OVS_VSWITCHD_STOP
d9c8c57c 5369OVS_APP_EXIT_AND_WAIT([test-sflow])
50b9699f
NM
5370AT_CHECK([[sort sflow.log | $EGREP 'LACPCOUNTERS|ERROR' | head -n 1 | sed 's/ /\
5371 /g']], [0], [dnl
5372LACPCOUNTERS
5373 sysID=11:22:33:44:55:66
5374 partnerID=00:00:00:00:00:00
5375 aggID=3333
5376 actorAdmin=0x7
5377 actorOper=0xbf
5378 partnerAdmin=0x0
5379 partnerOper=0x2
f7aa71fb 5380 LACPDUsRx=0
50b9699f
NM
5381 markerPDUsRx=4294967295
5382 markerRespPDUsRx=4294967295
5383 unknownRx=4294967295
5384 illegalRx=0
f7aa71fb 5385 LACPDUsTx=1
50b9699f
NM
5386 markerPDUsTx=4294967295
5387 markerRespPDUsTx=4294967295
5388])
5389
5390AT_CLEANUP
5391
7321bda3
NM
5392AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel set])
5393AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5394OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
5395
5396dnl set up sFlow logging
7321bda3
NM
5397AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5398AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5399PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5400ovs-appctl time/stop
5401
5402OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
5403AT_CHECK([ovs-vsctl add-port br0 gre0 -- set Interface gre0 type=gre \
5404 options:remote_ip=1.1.1.1 options:key=456 ofport_request=3])
5405AT_CHECK([ovs-vsctl add-port br0 p1 -- set Interface p1 type=dummy ofport_request=4])
5406
5407AT_CHECK([ovs-ofctl add-flow br0 action=3])
5408
5409dnl enable sflow
5410ovs-vsctl \
5411 set Bridge br0 sflow=@sf -- \
5412 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5413 header=128 sampling=1 polling=0
5414
5415dnl introduce a packet that will be flooded to the tunnel
5416AT_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)'])
5417
5418dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5419for i in `seq 1 30`; do
5420 ovs-appctl time/warp 100
5421done
5422
d9c8c57c 5423OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
5424
5425AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5426 /g']], [0], [dnl
5427HEADER
5428 dgramSeqNo=1
5429 ds=127.0.0.1>2:1000
5430 fsSeqNo=1
5431 tunnel4_out_length=0
5432 tunnel4_out_protocol=47
5433 tunnel4_out_src=0.0.0.0
5434 tunnel4_out_dst=1.1.1.1
5435 tunnel4_out_src_port=0
5436 tunnel4_out_dst_port=0
5437 tunnel4_out_tcp_flags=0
5438 tunnel4_out_tos=1
5439 tunnel_out_vni=456
5440 in_vlan=0
5441 in_priority=0
5442 out_vlan=0
5443 out_priority=0
5444 meanSkip=1
5445 samplePool=1
5446 dropEvents=0
5447 in_ifindex=0
5448 in_format=0
5449 out_ifindex=1
5450 out_format=2
5451 hdr_prot=1
5452 pkt_len=64
5453 stripped=4
5454 hdr_len=60
5455 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
5456])
5457
5458OVS_VSWITCHD_STOP
5459AT_CLEANUP
5460
5461AT_SETUP([ofproto-dpif - sFlow packet sampling - tunnel push])
5462AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
5463
5464OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 options:ifindex=1010])
5465
5466dnl set up sFlow logging
7321bda3
NM
5467AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5468AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5469PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5470ovs-appctl time/stop
5471
5472AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
5473AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
5474AT_CHECK([ovs-vsctl -- add-port int-br t1 -- set Interface t1 type=gre \
5475 options:remote_ip=1.1.2.92 options:key=456 ofport_request=4\
5476 -- add-port int-br vm1 -- set Interface vm1 type=dummy \
5477 options:ifindex=2011 ofport_request=5
5478 ], [0])
5479
5480AT_CHECK([ovs-appctl dpif/show], [0], [dnl
5481dummy@ovs-dummy: hit:0 missed:0
5482 br0:
5483 br0 65534/100: (dummy)
5484 p0 1/1: (dummy: ifindex=1010)
5485 int-br:
5486 int-br 65534/2: (dummy)
5487 t1 4/4: (gre: key=456, remote_ip=1.1.2.92)
5488 vm1 5/3: (dummy: ifindex=2011)
5489])
5490
5491dnl set up route to 1.1.2.92 via br0 and action=normal
7321bda3
NM
5492AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
5493])
a8704b50
PS
5494AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
5495])
7321bda3
NM
5496AT_CHECK([ovs-ofctl add-flow br0 action=normal])
5497
5498dnl Prime ARP Cache for 1.1.2.92
b23ddcc5 5499AT_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=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
7321bda3
NM
5500
5501dnl configure sflow on int-br only
5502ovs-vsctl \
5503 set Bridge int-br sflow=@sf -- \
5504 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5505 header=128 sampling=1 polling=0
5506
a8704b50
PS
5507dnl set up route to 192.168.1.2 via br0
5508AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 192.168.1.1/16], [0], [OK
5509])
5510AT_CHECK([ovs-appctl ovs/route/add 192.168.0.0/16 br0], [0], [OK
5511])
5512
7321bda3
NM
5513dnl add rule for int-br to force packet onto tunnel. There is no ifindex
5514dnl for this port so the sFlow output will just report that it went to
5515dnl 1 output (out_format=2, out_ifindex=1)
5516AT_CHECK([ovs-ofctl add-flow int-br "actions=4"])
5517
5518AT_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)'])
5519
5520dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5521for i in `seq 1 30`; do
5522 ovs-appctl time/warp 100
5523done
5524
d9c8c57c 5525OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
5526
5527AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5528 /g']], [0], [dnl
5529HEADER
5530 dgramSeqNo=1
5531 ds=127.0.0.1>2:1000
5532 fsSeqNo=1
5533 tunnel4_out_length=0
5534 tunnel4_out_protocol=47
5535 tunnel4_out_src=1.1.2.88
5536 tunnel4_out_dst=1.1.2.92
5537 tunnel4_out_src_port=0
5538 tunnel4_out_dst_port=0
5539 tunnel4_out_tcp_flags=0
5540 tunnel4_out_tos=0
5541 tunnel_out_vni=456
5542 in_vlan=0
5543 in_priority=0
5544 out_vlan=0
5545 out_priority=0
5546 meanSkip=1
5547 samplePool=1
5548 dropEvents=0
5549 in_ifindex=2011
5550 in_format=0
5551 out_ifindex=1
5552 out_format=2
5553 hdr_prot=1
5554 pkt_len=64
5555 stripped=4
5556 hdr_len=60
5557 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
5558])
5559
5560OVS_VSWITCHD_STOP
5561AT_CLEANUP
5562
5563AT_SETUP([ofproto-dpif - sFlow packet sampling - MPLS])
7ad705c6 5564AT_XFAIL_IF([test "$IS_WIN32" = "yes"])
7321bda3
NM
5565OVS_VSWITCHD_START
5566AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 5567add_of_ports br0 1 2
7321bda3
NM
5568AT_DATA([flows.txt], [dnl
5569table=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
5570table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
5571])
5572AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
5573
5574dnl set up sFlow logging
7321bda3
NM
5575AT_CHECK([ovstest test-sflow --log-file --detach --no-chdir --pidfile 0:127.0.0.1 > sflow.log], [0], [], [ignore])
5576AT_CAPTURE_FILE([sflow.log])
fb28ef2d 5577PARSE_LISTENING_PORT([test-sflow.log], [SFLOW_PORT])
7321bda3
NM
5578ovs-appctl time/stop
5579
5580dnl configure sflow
5581ovs-vsctl \
5582 set Bridge br0 sflow=@sf -- \
5583 --id=@sf create sflow targets=\"127.0.0.1:$SFLOW_PORT\" \
5584 header=128 sampling=1 polling=0
5585
5586AT_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)'])
5587AT_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)'])
5588
5589dnl sleep long enough to get the sFlow datagram flushed out (may be delayed for up to 1 second)
5590for i in `seq 1 30`; do
5591 ovs-appctl time/warp 100
5592done
5593
d9c8c57c 5594OVS_APP_EXIT_AND_WAIT([test-sflow])
7321bda3
NM
5595
5596AT_CHECK_UNQUOTED([[sort sflow.log | $EGREP 'HEADER|ERROR' | sed 's/ /\
5597 /g']], [0], [dnl
5598HEADER
5599 dgramSeqNo=1
5600 ds=127.0.0.1>2:1000
5601 fsSeqNo=1
5602 mpls_label_0=789
5603 mpls_tc_0=4
5604 mpls_ttl_0=32
5605 mpls_bos_0=0
5606 mpls_label_1=11
5607 mpls_tc_1=3
5608 mpls_ttl_1=64
5609 mpls_bos_1=1
5610 in_vlan=0
5611 in_priority=0
5612 out_vlan=0
5613 out_priority=0
5614 meanSkip=1
5615 samplePool=1
5616 dropEvents=0
5617 in_ifindex=0
5618 in_format=0
5619 out_ifindex=1
5620 out_format=2
5621 hdr_prot=1
5622 pkt_len=64
5623 stripped=4
5624 hdr_len=60
5625 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
5626HEADER
5627 dgramSeqNo=1
5628 ds=127.0.0.1>2:1000
5629 fsSeqNo=2
5630 mpls_label_0=789
5631 mpls_tc_0=4
5632 mpls_ttl_0=32
5633 mpls_bos_0=1
5634 in_vlan=0
5635 in_priority=0
5636 out_vlan=0
5637 out_priority=0
5638 meanSkip=1
5639 samplePool=2
5640 dropEvents=0
5641 in_ifindex=0
5642 in_format=0
5643 out_ifindex=1
5644 out_format=2
5645 hdr_prot=1
5646 pkt_len=64
5647 stripped=4
5648 hdr_len=60
5649 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
5650])
5651
5652OVS_VSWITCHD_STOP
5653AT_CLEANUP
5654
5655
4819b3a5 5656# CHECK_NETFLOW_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
5657#
5658# Test that basic NetFlow reports flow statistics correctly:
5659# The initial packet of a flow are correctly accounted.
5660# Later packets within a flow are correctly accounted.
5661# Flow actions changing (in this case, due to MAC learning)
5662# cause a record to be sent.
e731d71b 5663m4_define([CHECK_NETFLOW_EXPIRATION],
4819b3a5 5664 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 5665 add_of_ports br0 1 2
e731d71b
AS
5666
5667 ovs-appctl time/stop
53eb8cb8 5668 on_exit 'kill `cat test-netflow.pid`'
eadd1644 5669 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 5670 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 5671 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
5672
5673 ovs-vsctl \
5674 set Bridge br0 netflow=@nf -- \
5675 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5676 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
5677
5678 for delay in 1000 30000; do
5679 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 5680 sleep 1 # ensure the order in which these two packets are processed
e731d71b
AS
5681 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)'
5682
5683 ovs-appctl time/warp $delay
5684 done
17f7f7e0 5685
e731d71b 5686 ovs-appctl time/warp 6000
27f57736 5687 ovs-appctl revalidator/wait
e731d71b 5688 OVS_VSWITCHD_STOP
d9c8c57c 5689 OVS_APP_EXIT_AND_WAIT([test-netflow])
e79a6c83 5690
e731d71b 5691 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 5692
e731d71b 5693 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 5694
e731d71b
AS
5695 combined=`grep "192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0" netflow.log | wc -l`
5696 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 5697 AT_CHECK([test $separate = 2 || test $combined = 1], [0])])
17f7f7e0 5698
4819b3a5
BP
5699AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv4 collector])
5700CHECK_NETFLOW_EXPIRATION([127.0.0.1])
5701AT_CLEANUP
17f7f7e0 5702
4819b3a5
BP
5703AT_SETUP([ofproto-dpif - NetFlow flow expiration - IPv6 collector])
5704AT_SKIP_IF([test $HAVE_IPV6 = no])
5705CHECK_NETFLOW_EXPIRATION([[[::1]]])
5706AT_CLEANUP
1e04fcc8 5707
4819b3a5 5708# CHECK_NETFLOW_ACTIVE_EXPIRATION(LOOPBACK_ADDR)
e731d71b
AS
5709#
5710# Test that basic NetFlow reports active expirations correctly.
e731d71b 5711m4_define([CHECK_NETFLOW_ACTIVE_EXPIRATION],
4819b3a5 5712 [OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 5713 add_of_ports br0 1 2
17f7f7e0 5714
53eb8cb8 5715 on_exit 'kill `cat test-netflow.pid`'
eadd1644 5716 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 5717 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 5718 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
17f7f7e0 5719
e731d71b
AS
5720 ovs-vsctl \
5721 set Bridge br0 netflow=@nf -- \
5722 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
5723 engine_id=1 engine_type=2 active_timeout=10 add-id-to-interface=false
17f7f7e0 5724
e731d71b
AS
5725 AT_CHECK([ovs-appctl time/stop])
5726 n=1
5727 while test $n -le 60; do
5728 n=`expr $n + 1`
17f7f7e0 5729
e731d71b
AS
5730 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)'
5731 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 5732
e731d71b
AS
5733 ovs-appctl time/warp 1000
5734 done
17f7f7e0 5735
e731d71b
AS
5736 ovs-appctl time/warp 10000
5737
27f57736 5738 ovs-appctl revalidator/wait
e731d71b 5739 OVS_VSWITCHD_STOP
d9c8c57c 5740 OVS_APP_EXIT_AND_WAIT([test-netflow])
e731d71b
AS
5741
5742 # Count the number of reported packets:
5743 # - From source to destination before MAC learning kicks in (just one).
5744 # - From source to destination after that.
5745 # - From destination to source.
5746 n_learn=0
5747 n_in=0
5748 n_out=0
5749 n_other=0
5750 n_recs=0
5751 none=0
5752 while read line; do
5753 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
5754 case $pkts in
5755 [[0-9]]*) ;;
5756 *) continue ;;
5757 esac
5758
5759 case $line in
5760 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5761 counter=n_learn
5762 ;;
5763 "seq "*": 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
5764 counter=n_in
5765 ;;
5766 "seq "*": 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
5767 counter=n_out
5768 ;;
5769 *)
5770 counter=n_other
5771 ;;
5772 esac
5773 eval $counter=\`expr \$$counter + \$pkts\`
5774 n_recs=`expr $n_recs + 1`
5775 done < netflow.log
5776
5777 # There should be exactly 1 MAC learning packet,
5778 # exactly 59 other packets in that direction,
5779 # and exactly 60 packets in the other direction.
5780 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
4819b3a5 5781])])
e731d71b 5782
4819b3a5
BP
5783AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv4 collector])
5784CHECK_NETFLOW_ACTIVE_EXPIRATION([127.0.0.1])
5785AT_CLEANUP
e731d71b 5786
4819b3a5
BP
5787AT_SETUP([ofproto-dpif - NetFlow active expiration - IPv6 collector])
5788AT_SKIP_IF([test $HAVE_IPV6 = no])
5789CHECK_NETFLOW_ACTIVE_EXPIRATION([[[::1]]])
5790AT_CLEANUP
f27f2134 5791
3d198ea5
JS
5792dnl In the absence of an IPFIX collector to verify protocol correctness, simply
5793dnl configure IPFIX and ensure that sample action generation works at the
5794dnl datapath level.
5795AT_SETUP([ofproto-dpif - Basic IPFIX sanity check])
5796OVS_VSWITCHD_START
ca5792f0 5797add_of_ports br0 1 2
3d198ea5
JS
5798
5799dnl Sample every packet using bridge-based sampling
5800AT_CHECK([ovs-vsctl -- set bridge br0 ipfix=@fix -- \
5801 --id=@fix create ipfix targets=\"127.0.0.1:4739\" \
5802 sampling=1], [0], [ignore])
5803
5804dnl Send some packets that should be sampled
5805for i in `seq 1 3`; do
5806 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)'])
5807done
5808AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5809flow-dump from non-dpdk interfaces:
5810packets:2, bytes:120, used:0.001s, actions:sample(sample=100.0%,actions(userspace(pid=0,ipfix(output_port=4294967295))))
5811])
5812
5813dnl Remove the IPFIX configuration
5814AT_CHECK([ovs-vsctl clear bridge br0 ipfix])
5815AT_CHECK([ovs-appctl revalidator/purge])
5816
5817dnl Send some more packets, to ensure that these are not sampled.
5818for i in `seq 1 3`; do
5819 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)'])
5820done
5821AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/.*\(packets:\)/\1/' | sed 's/used:[[0-9]].[[0-9]]*s/used:0.001s/'], [0], [dnl
5822flow-dump from non-dpdk interfaces:
5823packets:2, bytes:120, used:0.001s, actions:drop
5824])
5825
5826OVS_VSWITCHD_STOP(["/sending to collector failed/d"])
5827AT_CLEANUP
5828
23a7d252
JS
5829AT_SETUP([ofproto-dpif - flow stats])
5830OVS_VSWITCHD_START
5831AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5832AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5833
5834ovs-appctl time/stop
5835
5836for i in `seq 1 10`; do
5837 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)'
5838done
5839
cea4a6d7
JS
5840AT_CHECK([ovs-appctl time/warp 1000], [0], [ignore])
5841AT_CHECK([ovs-appctl revalidator/purge], [0])
e96a5c24 5842AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 5843AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
e96a5c24 5844 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
11f9de00 5845 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
e96a5c24
JS
5846])
5847OVS_VSWITCHD_STOP
5848AT_CLEANUP
5849
5850AT_SETUP([ofproto-dpif - flow stats, set-n-threads])
5851OVS_VSWITCHD_START
5852AT_CHECK([ovs-ofctl add-flow br0 "ip,actions=NORMAL"])
5853AT_CHECK([ovs-ofctl add-flow br0 "icmp,actions=NORMAL"])
5854
5855ovs-appctl time/stop
5856
5857for i in `seq 1 10`; do
5858 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)'
5859done
5860
5861ovs-appctl time/warp 100
5862AT_CHECK([ovs-vsctl set Open_vSwitch . other-config:n-revalidator-threads=2])
5863ovs-appctl time/warp 1000
5864
23a7d252 5865AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
8a32aaa5 5866AT_CHECK([strip_xids < stdout | sed -n 's/duration=[[0-9]]*\.[[0-9]]*s/duration=0.0s/p' | sort], [0], [dnl
23a7d252 5867 cookie=0x0, duration=0.0s, table=0, n_packets=0, n_bytes=0, idle_age=1, icmp actions=NORMAL
11f9de00 5868 cookie=0x0, duration=0.0s, table=0, n_packets=10, n_bytes=600, idle_age=1, ip actions=NORMAL
23a7d252
JS
5869])
5870OVS_VSWITCHD_STOP
5871AT_CLEANUP
5872
5f5ebd4c 5873AT_SETUP([ofproto-dpif - idle_age and hard_age increase over time])
f27f2134
BP
5874OVS_VSWITCHD_START
5875
5876# get_ages DURATION HARD IDLE
5877#
5878# Fetch the flow duration, hard age, and idle age into the variables
5879# whose names are given as arguments. Rounds DURATION down to the
5880# nearest integer. If hard_age doesn't appear in the output, sets
5881# HARD to "none". If idle_age doesn't appear in the output, sets IDLE
5882# to 0.
5883get_ages () {
5884 AT_CHECK([ovs-ofctl dump-flows br0], [0], [stdout])
5885
5886 duration=`sed -n 's/.*duration=\([[0-9]]*\)\(\.[[0-9]]*\)\{0,1\}s.*/\1/p' stdout`
5887 AT_CHECK([[expr X"$duration" : 'X[0-9][0-9]*$']], [0], [ignore])
5888 AS_VAR_COPY([$1], [duration])
5889
5890 hard=`sed -n 's/.*hard_age=\([[0-9]]*\),.*/\1/p' stdout`
5891 if test X"$hard" = X; then
5892 hard=none
5893 else
5894 AT_CHECK([[expr X"$hard" : 'X[0-9][0-9]*$']], [0], [ignore])
5895 fi
5896 AS_VAR_COPY([$2], [hard])
5897
5898 idle=`sed -n 's/.*idle_age=\([[0-9]]*\),.*/\1/p' stdout`
5899 if test X"$idle" = X; then
5900 idle=0
5901 else
5902 AT_CHECK([[expr X"$idle" : 'X[0-9][0-9]*$']], [0], [ignore])
5903 fi
5904 AS_VAR_COPY([$3], [idle])
5905}
5906
5907# Add a flow and get its initial hard and idle age.
5908AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=199,idle_timeout=188,actions=drop])
5909get_ages duration1 hard1 idle1
5910
31ef9f51 5911ovs-appctl time/stop
f27f2134
BP
5912# Warp time forward by 10 seconds, then modify the flow's actions.
5913ovs-appctl time/warp 10000
5914get_ages duration2 hard2 idle2
5915AT_CHECK([ovs-ofctl mod-flows br0 actions=flood])
5916
5917# Warp time forward by 10 seconds.
5918ovs-appctl time/warp 10000
5919get_ages duration3 hard3 idle3
5920
5921# Warp time forward 10 more seconds, then pass some packets through the flow,
5922# then warp forward a few more times because idle times are only updated
5923# occasionally.
5924ovs-appctl time/warp 10000
5925ovs-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 5926ovs-appctl time/warp 3000 1000
c0526804 5927sleep 1
f27f2134
BP
5928get_ages duration4 hard4 idle4
5929
5930printf "duration: %4s => %4s => %4s => %4s\n" $duration1 $duration2 $duration3 $duration4
5931printf "hard_age: %4s => %4s => %4s => %4s\n" $hard1 $hard2 $hard3 $hard4
5932printf "idle_age: %4s => %4s => %4s => %4s\n" $idle1 $idle2 $idle3 $idle4
5933
5934# Duration should increase steadily over time.
5935AT_CHECK([test $duration1 -lt $duration2])
5936AT_CHECK([test $duration2 -lt $duration3])
5937AT_CHECK([test $duration3 -lt $duration4])
5938
5939# Hard age should be "none" initially because it's the same as flow_duration,
5940# then it should increase.
5941AT_CHECK([test $hard1 = none])
5942AT_CHECK([test $hard2 = none])
5943AT_CHECK([test $hard3 != none])
5944AT_CHECK([test $hard4 != none])
5945AT_CHECK([test $hard3 -lt $hard4])
5946
5947# Idle age should increase from 1 to 2 to 3, then decrease.
5948AT_CHECK([test $idle1 -lt $idle2])
5949AT_CHECK([test $idle2 -lt $idle3])
5950AT_CHECK([test $idle3 -gt $idle4])
5951
5952# Check some invariant relationships.
5953AT_CHECK([test $duration1 = $idle1])
5954AT_CHECK([test $duration2 = $idle2])
5955AT_CHECK([test $duration3 = $idle3])
5956AT_CHECK([test $idle3 -gt $hard3])
5957AT_CHECK([test $idle4 -lt $hard4])
5958AT_CHECK([test $hard4 -lt $duration4])
5959
5960OVS_VSWITCHD_STOP
5961AT_CLEANUP
0e553d9c
BP
5962
5963AT_SETUP([ofproto-dpif - fin_timeout])
5964OVS_VSWITCHD_START
b5c1a5df 5965ovs-appctl time/stop
0e553d9c
BP
5966AT_CHECK([ovs-ofctl add-flow br0 'idle_timeout=60,actions=fin_timeout(idle_timeout=5)'])
5967AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5968[NXST_FLOW reply:
5969 idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5970])
31ef9f51 5971
0e553d9c
BP
5972# Check that a TCP SYN packet does not change the timeout. (Because
5973# flow stats updates are mainly what implements the fin_timeout
5974# feature, we warp forward a couple of times to ensure that flow stats
5975# run before re-checking the flow table.)
323cc924 5976AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f908004500003c2e2440004006465dac11370dac11370b828b0016751e267b00000000a00216d017360000020405b40402080a2d25085f0000000001030307])
0e553d9c
BP
5977AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5978warped
5979])
cea4a6d7 5980AT_CHECK([ovs-appctl revalidator/purge], [0])
0e553d9c
BP
5981AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5982[NXST_FLOW reply:
5983 n_packets=1, n_bytes=74, idle_timeout=60, actions=fin_timeout(idle_timeout=5)
5984])
5985# Check that a TCP FIN packet does change the timeout.
323cc924 5986AT_CHECK([ovs-appctl netdev-dummy/receive br0 0021853763af0026b98cb0f90800451000342e3e40004006463bac11370dac11370b828b0016751e319dfc96399b801100717ae800000101080a2d250a9408579588])
0e553d9c
BP
5987AT_CHECK([ovs-appctl time/warp 1000 && ovs-appctl time/warp 1000], [0], [warped
5988warped
5989])
5990AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0],
5991[NXST_FLOW reply:
5992 n_packets=2, n_bytes=140, idle_timeout=5, actions=fin_timeout(idle_timeout=5)
5993])
5994OVS_VSWITCHD_STOP
5995AT_CLEANUP
27022416
JP
5996
5997AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-dps])
5998OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
5999add_of_ports br0 1 2
6000add_of_ports br1 3
27022416
JP
6001
6002AT_CHECK([ovs-appctl dpif/dump-dps], [0], [dnl
6003dummy@br0
6004dummy@br1
6005])
6006OVS_VSWITCHD_STOP
6007AT_CLEANUP
6008
6009AT_SETUP([ofproto-dpif - ovs-appctl dpif/show])
6010OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy])
ca5792f0
BP
6011add_of_ports br0 1 2
6012add_of_ports br1 3
27022416
JP
6013
6014AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 6015dummy@ovs-dummy: hit:0 missed:0
e79a6c83 6016 br0:
dc54ef36
EJ
6017 br0 65534/100: (dummy)
6018 p1 1/1: (dummy)
6019 p2 2/2: (dummy)
e79a6c83 6020 br1:
dc54ef36
EJ
6021 br1 65534/101: (dummy)
6022 p3 3/3: (dummy)
27022416
JP
6023])
6024OVS_VSWITCHD_STOP
6025AT_CLEANUP
6026
6027AT_SETUP([ofproto-dpif - ovs-appctl dpif/dump-flows])
054e5aa6 6028# bump max-idle to avoid the flows being reclaimed behind us
27022416 6029OVS_VSWITCHD_START([add-br br1 -- \
054e5aa6
YT
6030 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6031 set Open_vSwitch . other_config:max-idle=10000])
ca5792f0
BP
6032add_of_ports br0 1 2
6033add_of_ports br1 3
27022416 6034
323cc924
BP
6035AT_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)'])
6036AT_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)'])
6037AT_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 6038ovs-appctl revalidator/wait
3a18d0c2 6039AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
16194afd
DDP
6040recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
6041recirc_id(0),in_port(2),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
6042])
6043
3a18d0c2 6044AT_CHECK([ovs-appctl dpif/dump-flows br1 | strip_ufid | strip_used | sort], [0], [dnl
16194afd 6045recirc_id(0),in_port(3),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
27022416
JP
6046])
6047
3a18d0c2 6048AT_CHECK([ovs-appctl dpif/dump-flows -m br0 | strip_ufid | strip_used | sort], [0], [dnl
16194afd
DDP
6049skb_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
6050skb_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
6051])
6052
3a18d0c2 6053AT_CHECK([ovs-appctl dpif/dump-flows -m br1 | strip_ufid | strip_used | sort], [0], [dnl
16194afd 6054skb_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
6055])
6056
6057OVS_VSWITCHD_STOP
6058AT_CLEANUP
6059
6060AT_SETUP([ofproto-dpif - ovs-appctl dpif/get-flow])
6061
6062OVS_VSWITCHD_START([add-br br1 -- \
6063 set bridge br1 datapath-type=dummy fail-mode=secure -- \
6064 set Open_vSwitch . other_config:max-idle=10000])
ca5792f0 6065add_of_ports br0 1 2
818650e6
JS
6066
6067AT_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)'])
6068ovs-appctl revalidator/wait
6069AT_CHECK([ovs-appctl dpif/dump-flows -m br0], [0], [stdout])
6070
10e92b4f 6071UFID=`sed -n 's/\(ufid:[[-0-9a-fA-F]]*\).*/\1/p' stdout`
818650e6
JS
6072AT_CHECK([ovs-appctl dpctl/get-flow $UFID], [0], [dnl
6073recirc_id(0),in_port(1),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:drop
04b541df
GS
6074])
6075
27022416
JP
6076OVS_VSWITCHD_STOP
6077AT_CLEANUP
6078
50c1efc9 6079AT_SETUP([ofproto-dpif - MPLS actions that result in a userspace action])
8bfd0fda
BP
6080OVS_VSWITCHD_START([dnl
6081 add-port br0 p1 -- set Interface p1 type=dummy
6082])
623540e4 6083AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 6084on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
6085
6086AT_CAPTURE_FILE([ofctl_monitor.log])
6087AT_DATA([flows.txt], [dnl
6088dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 6089dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
6090])
6091AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6092
6093dnl Packet is sent to userspace because a MPLS push or pop action is applied to
47fb7f71 6094dnl a packet with 2 MPLS LSEs but dpif-netdev can't handle any labels.
8bfd0fda 6095dnl
47fb7f71 6096dnl The input is a frame with two MPLS labels which tcpdump -vve shows as:
8bfd0fda 6097dnl 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
6098dnl (label 20, exp 0, [S], ttl 32)
6099dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6100dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
6101
6102for dl_src in 00 01; do
47fb7f71 6103 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
6104done
6105sleep 1 # wait for the datapath flow installed
2be3fe44 6106AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6107recirc_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))
6108recirc_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 6109])
8bfd0fda
BP
6110
6111OVS_VSWITCHD_STOP
6112AT_CLEANUP
6113
6114
50c1efc9 6115AT_SETUP([ofproto-dpif - MPLS actions that result in a drop])
8bfd0fda
BP
6116OVS_VSWITCHD_START([dnl
6117 add-port br0 p1 -- set Interface p1 type=dummy
6118])
623540e4 6119AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
53eb8cb8 6120on_exit 'kill `cat ovs-ofctl.pid`'
8bfd0fda
BP
6121
6122AT_CAPTURE_FILE([ofctl_monitor.log])
6123AT_DATA([flows.txt], [dnl
6124dl_src=60:66:66:66:66:00 actions=push_mpls:0x8847,controller
3fd12197 6125dl_src=60:66:66:66:66:01 actions=pop_mpls:0x8847,controller
8bfd0fda
BP
6126])
6127AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6128
6129dnl Packet is dropped because an MPLS PUSH action is applied to a packet with
6130dnl 4 MPLS LSEs but ovs-vswtichd can only handle up to 3 MPLS LSEs and thus
47fb7f71 6131dnl can't determine the resulting MPLS label after MPLS push/pop actions.
8bfd0fda
BP
6132dnl
6133dnl The input is a frame with two MPLS headers which tcpdump -vve shows as:
6134dnl 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)
6135dnl (label 20, exp 0, ttl 32)
6136dnl (label 20, exp 0, ttl 32)
6137dnl (label 20, exp 0, [S], ttl 32)
6138dnl (tos 0x0, ttl 64, id 0, offset 0, flags [none], proto TCP (6), length 44, bad cksum 3b78 (->f978)!)
6139dnl 192.168.0.1.80 > 192.168.0.2.0: Flags [none], cksum 0x7744 (correct), seq 42:46, win 10000, length 4
8bfd0fda 6140
47fb7f71
JS
6141for dl_src in 00 01; do
6142 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
6143done
6144sleep 1 # wait for the datapath flow installed
2be3fe44 6145AT_CHECK_UNQUOTED([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6146recirc_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))
6147recirc_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
6148])
6149
6150OVS_VSWITCHD_STOP
6151AT_CLEANUP
6152
0a740f48
EJ
6153AT_SETUP([ofproto-dpif - patch ports])
6154OVS_VSWITCHD_START([add-br br1 \
6155-- set bridge br1 datapath-type=dummy fail-mode=secure \
6156-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6157-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6158
ca5792f0
BP
6159add_of_ports br0 2
6160add_of_ports br1 3
0a740f48 6161
64bb477f
JS
6162AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6163], [])
aef0491b 6164AT_CHECK([ovs-appctl time/stop])
623540e4 6165AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
9fc0165a 6166
0a740f48
EJ
6167AT_CHECK([ovs-ofctl add-flow br0 actions=LOCAL,output:1,output:2])
6168AT_CHECK([ovs-ofctl add-flow br1 actions=LOCAL,output:1,output:3])
6169
6170for i in $(seq 1 10); do
6171 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
6172 if [[ $i -eq 1 ]]; then
6173 sleep 1
6174 fi
0a740f48
EJ
6175done
6176
6177for i in $(seq 1 5); do
6178 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
6179 if [[ $i -eq 1 ]]; then
6180 sleep 1
6181 fi
0a740f48
EJ
6182done
6183
0a8763fc
EJ
6184AT_CHECK([ovs-appctl time/warp 500], [0],
6185[warped
735d7efb 6186])
732207ad 6187sleep 1 # wait for log writer
735d7efb 6188
0a740f48 6189AT_CHECK([ovs-appctl dpif/show], [0], [dnl
dc54ef36 6190dummy@ovs-dummy: hit:13 missed:2
e79a6c83 6191 br0:
dc54ef36
EJ
6192 br0 65534/100: (dummy)
6193 p2 2/2: (dummy)
6194 pbr0 1/none: (patch: peer=pbr1)
e79a6c83 6195 br1:
dc54ef36
EJ
6196 br1 65534/101: (dummy)
6197 p3 3/3: (dummy)
6198 pbr1 1/none: (patch: peer=pbr0)
0a740f48
EJ
6199])
6200
2be3fe44 6201AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6202recirc_id=0,ip,in_port=100,vlan_tci=0x0000,nw_frag=no, actions:101,3,2
6203recirc_id=0,ip,in_port=101,vlan_tci=0x0000,nw_frag=no, actions:100,2,3
c2a77f33
JS
6204])
6205
2be3fe44 6206AT_CHECK([grep -e 'in_port(100).*packets:9' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
16194afd 6207skb_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 6208])
2be3fe44 6209AT_CHECK([grep -e 'in_port(101).*packets:4' ovs-vswitchd.log | strip_ufid | filter_flow_dump], [0], [dnl
16194afd 6210skb_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
6211])
6212
6213AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
6214OFPST_PORT reply (xid=0x4): 1 ports
d6e3feb5 6215 port 1: rx pkts=5, bytes=300, drop=?, errs=?, frame=?, over=?, crc=?
6216 tx pkts=10, bytes=600, drop=?, errs=?, coll=?
0a740f48
EJ
6217])
6218
6219AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
6220OFPST_PORT reply (xid=0x4): 1 ports
d6e3feb5 6221 port 1: rx pkts=10, bytes=600, drop=?, errs=?, frame=?, over=?, crc=?
6222 tx pkts=5, bytes=300, drop=?, errs=?, coll=?
0a740f48
EJ
6223])
6224
6225OVS_VSWITCHD_STOP
6226AT_CLEANUP
655ab909 6227
1774d762
JR
6228AT_SETUP([ofproto-dpif - patch ports - stack])
6229OVS_VSWITCHD_START([add-br br1 \
6230-- set bridge br1 datapath-type=dummy fail-mode=secure \
6231-- add-port br1 pbr1 -- set int pbr1 type=patch options:peer=pbr0 \
6232-- add-port br0 pbr0 -- set int pbr0 type=patch options:peer=pbr1])
6233
ca5792f0
BP
6234add_of_ports br0 2
6235add_of_ports br1 3
1774d762
JR
6236
6237AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6238], [])
6239AT_CHECK([ovs-appctl time/stop])
6240AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
6241
6242AT_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"])
6243# Try to pop from empty stack, and push and leave data to stack.
6244AT_CHECK([ovs-ofctl add-flow br1 "ip actions=pop:OXM_OF_IPV4_DST[[0..31]],push:NXM_NX_REG1[[0..31]],LOCAL"])
6245
6246ovs-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)'
6247
6248AT_CHECK([ovs-appctl time/warp 500], [0],
6249[warped
6250])
6251
6252OVS_WAIT_UNTIL([test `grep flow_add ovs-vswitchd.log | wc -l` -ge 1])
6253
6254AT_CHECK([ovs-appctl dpif/show], [0], [dnl
6255dummy@ovs-dummy: hit:0 missed:1
6256 br0:
6257 br0 65534/100: (dummy)
6258 p2 2/2: (dummy)
6259 pbr0 1/none: (patch: peer=pbr1)
6260 br1:
6261 br1 65534/101: (dummy)
6262 p3 3/3: (dummy)
6263 pbr1 1/none: (patch: peer=pbr0)
6264])
6265
2be3fe44 6266AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131 6267recirc_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
6268])
6269
2be3fe44 6270AT_CHECK([grep -e '|nx_match|WARN|' ovs-vswitchd.log | sed "s/^.*|WARN|//"], [0], [dnl
1774d762
JR
6271Failed to pop from an empty stack. On flow
6272])
6273
6274OVS_VSWITCHD_STOP(["/Failed to pop from an empty stack/d"])
6275AT_CLEANUP
6276
65e0be10
BP
6277AT_SETUP([ofproto-dpif - port duration])
6278OVS_VSWITCHD_START([set Bridge br0 protocols=OpenFlow13])
ca5792f0 6279add_of_ports br0 1 2
65e0be10 6280
31ef9f51 6281ovs-appctl time/stop
65e0be10
BP
6282ovs-appctl time/warp 10000
6283
6284AT_CHECK([ovs-ofctl -O openflow13 dump-ports br0], [0], [stdout])
125bf01d 6285AT_CHECK([sed -n 's/=[[0-9]][[0-9]]\(\.[[0-9]][[0-9]]*\)\{0,1\}s/=?s/p' stdout], [0],
65e0be10 6286[dnl
65e0be10 6287 duration=?s
65e0be10 6288 duration=?s
65e0be10
BP
6289 duration=?s
6290])
6291OVS_VSWITCHD_STOP
6292AT_CLEANUP
bcd2633a
JP
6293
6294dnl ----------------------------------------------------------------------
6295AT_BANNER([ofproto-dpif -- megaflows])
6296
bcd2633a
JP
6297AT_SETUP([ofproto-dpif megaflow - port classification])
6298OVS_VSWITCHD_START
623540e4 6299AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6300add_of_ports br0 1 2
bcd2633a
JP
6301AT_DATA([flows.txt], [dnl
6302table=0 in_port=1 actions=output(2)
6303])
6304AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6305AT_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 6306sleep 1
bcd2633a 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 6310recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions: <del>
bcd2633a
JP
6311])
6312OVS_VSWITCHD_STOP
6313AT_CLEANUP
6314
6315AT_SETUP([ofproto-dpif megaflow - L2 classification])
6316OVS_VSWITCHD_START
623540e4 6317AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6318add_of_ports br0 1 2
bcd2633a
JP
6319AT_DATA([flows.txt], [dnl
6320table=0 in_port=1,dl_src=50:54:00:00:00:09 actions=output(2)
6321])
6322AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6323AT_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)'])
6324AT_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 6325sleep 1
2be3fe44 6326AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6327recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
31ecf25f 6328recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6329])
6330OVS_VSWITCHD_STOP
6331AT_CLEANUP
6332
6333AT_SETUP([ofproto-dpif megaflow - L3 classification])
6334OVS_VSWITCHD_START
623540e4 6335AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6336add_of_ports br0 1 2
13751fd8 6337AT_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
6338AT_DATA([flows.txt], [dnl
6339table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=output(2)
6340])
6341AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6342AT_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)'])
6343AT_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 6344sleep 1
2be3fe44 6345AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6346recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
31ecf25f 6347recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/30,nw_frag=no, actions: <del>
bcd2633a
JP
6348])
6349OVS_VSWITCHD_STOP
6350AT_CLEANUP
6351
13751fd8
JR
6352AT_SETUP([ofproto-dpif megaflow - IPv6 classification])
6353OVS_VSWITCHD_START
623540e4 6354AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6355add_of_ports br0 1 2
13751fd8
JR
6356AT_CHECK([ovs-vsctl set Bridge br0 flow_tables:0=@N1 -- --id=@N1 create Flow_Table name=t0 prefixes=ipv6_dst,ipv6_src], [0], [ignore], [])
6357AT_DATA([flows.txt], [dnl
6358table=0 in_port=1,ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output(2)
6359])
6360AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6361AT_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)'])
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(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 6363sleep 1
2be3fe44 6364AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6365recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:1:2:3:4:5,nw_frag=no, actions: <del>
31ecf25f 6366recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:5:4:3:2:1/62,nw_frag=no, actions: <del>
13751fd8
JR
6367])
6368OVS_VSWITCHD_STOP
6369AT_CLEANUP
6370
bcd2633a
JP
6371AT_SETUP([ofproto-dpif megaflow - L4 classification])
6372OVS_VSWITCHD_START
623540e4 6373AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6374add_of_ports br0 1 2
bcd2633a
JP
6375AT_DATA([flows.txt], [dnl
6376table=0 in_port=1,icmp,icmp_type=8 actions=output(2)
6377])
6378AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6379AT_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 6380sleep 1
bcd2633a 6381AT_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 6382sleep 1
2be3fe44 6383AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6384recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x8/0xff, actions: <del>
bcd2633a
JP
6385])
6386OVS_VSWITCHD_STOP
6387AT_CLEANUP
6388
6389AT_SETUP([ofproto-dpif megaflow - normal])
6390OVS_VSWITCHD_START
623540e4 6391AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6392add_of_ports br0 1 2
bcd2633a
JP
6393AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6394AT_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)'])
6395AT_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 6396sleep 1
2be3fe44 6397AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6398recirc_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>
6399recirc_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
6400])
6401OVS_VSWITCHD_STOP
6402AT_CLEANUP
6403
6404AT_SETUP([ofproto-dpif megaflow - mpls])
6405OVS_VSWITCHD_START
623540e4 6406AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6407add_of_ports br0 1 2
bcd2633a
JP
6408AT_DATA([flows.txt], [dnl
6409table=0 dl_src=50:54:00:00:00:09 actions=push_mpls:0x8847,2
6410table=0 dl_src=50:54:00:00:00:0b actions=pop_mpls:0x0800,2
6411])
6412AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6413AT_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)'])
6414AT_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 6415sleep 1
3fd12197
JR
6416AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
6417recirc_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
e12ec36b 6418recirc_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),2
bcd2633a
JP
6419])
6420OVS_VSWITCHD_STOP
6421AT_CLEANUP
6422
4819b3a5 6423# CHECK_MEGAFLOW_NETFLOW(LOOPBACK_ADDR)
e731d71b 6424m4_define([CHECK_MEGAFLOW_NETFLOW],
4819b3a5 6425 [OVS_VSWITCHD_START
623540e4 6426 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6427 add_of_ports br0 1 2
e731d71b
AS
6428
6429 dnl NetFlow configuration disables wildcarding relevant fields
53eb8cb8 6430 on_exit 'kill `cat test-netflow.pid`'
eadd1644 6431 AT_CHECK([ovstest test-netflow --log-file --detach --no-chdir --pidfile 0:$1 > netflow.log], [0], [], [ignore])
e731d71b 6432 AT_CAPTURE_FILE([netflow.log])
fb28ef2d 6433 PARSE_LISTENING_PORT([test-netflow.log], [NETFLOW_PORT])
e731d71b
AS
6434 ovs-vsctl \
6435 set Bridge br0 netflow=@nf -- \
6436 --id=@nf create NetFlow targets=\"$1:$NETFLOW_PORT\" \
6437 engine_id=1 engine_type=2 active_timeout=30 add-id-to-interface=false
6438
6439 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6440 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)'])
6441 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)'])
6442 sleep 1
2be3fe44 6443 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6444recirc_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>
6445recirc_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 6446])
d9c8c57c 6447 OVS_APP_EXIT_AND_WAIT([test-netflow])
4819b3a5 6448 OVS_VSWITCHD_STOP])
e731d71b 6449
4819b3a5 6450AT_SETUP([ofproto-dpif megaflow - netflow - IPv4 collector])
e731d71b 6451CHECK_MEGAFLOW_NETFLOW([127.0.0.1], [IPv4])
4819b3a5
BP
6452AT_CLEANUP
6453
6454AT_SETUP([ofproto-dpif megaflow - netflow - IPv6 collector])
6455AT_SKIP_IF([test $HAVE_IPV6 = no])
e731d71b 6456CHECK_MEGAFLOW_NETFLOW([[[::1]]], [IPv6])
4819b3a5 6457AT_CLEANUP
bcd2633a
JP
6458
6459AT_SETUP([ofproto-dpif megaflow - normal, active-backup bonding])
6460OVS_VSWITCHD_START(
6461 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
6462 add-bond br0 bond0 p2 p3 bond_mode=active-backup -- \
6463 set interface p2 type=dummy ofport_request=2 -- \
6464 set interface p3 type=dummy ofport_request=3])
6465AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6466])
623540e4 6467AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
6468
6469AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6470AT_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)'])
6471AT_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 6472sleep 1
2be3fe44 6473AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6474recirc_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>
6475recirc_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
6476])
6477OVS_VSWITCHD_STOP
6478AT_CLEANUP
6479
6480AT_SETUP([ofproto-dpif megaflow - normal, balance-slb bonding])
6481OVS_VSWITCHD_START(
6482 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
6483 add-bond br0 bond0 p2 p3 bond_mode=balance-slb -- \
6484 set interface p2 type=dummy ofport_request=2 -- \
6485 set interface p3 type=dummy ofport_request=3])
6486AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6487])
623540e4 6488AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
bcd2633a
JP
6489
6490AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6491AT_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)'])
6492AT_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 6493sleep 1
2be3fe44 6494AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6495recirc_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>
6496recirc_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
6497])
6498OVS_VSWITCHD_STOP
6499AT_CLEANUP
6500
6501AT_SETUP([ofproto-dpif megaflow - normal, balance-tcp bonding])
6502# Create bond0 on br0 with interfaces p0 and p1
6503# and bond1 on br1 with interfaces p2 and p3
6504# with p0 patched to p2 and p1 patched to p3.
6505OVS_VSWITCHD_START(
6506 [add-bond br0 bond0 p0 p1 bond_mode=balance-tcp lacp=active \
6507 other-config:lacp-time=fast \
6508 other-config:bond-rebalance-interval=0 -- \
6509 set interface p0 type=patch options:peer=p2 ofport_request=1 -- \
6510 set interface p1 type=patch options:peer=p3 ofport_request=2 -- \
6511 add-br br1 -- \
6512 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
6513 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
6514 fail-mode=secure -- \
6515 add-bond br1 bond1 p2 p3 bond_mode=balance-tcp lacp=active \
6516 other-config:lacp-time=fast \
6517 other-config:bond-rebalance-interval=0 -- \
6518 set interface p2 type=patch options:peer=p0 ofport_request=3 -- \
6519 set interface p3 type=patch options:peer=p1 ofport_request=4 --])
6520
6521AT_CHECK([ovs-appctl netdev-dummy/set-admin-state up], 0, [OK
6522])
623540e4 6523AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6524add_of_ports br0 7
bcd2633a
JP
6525AT_CHECK([ovs-ofctl add-flow br0 action=normal])
6526AT_CHECK([ovs-ofctl add-flow br1 action=normal])
31ef9f51 6527ovs-appctl time/stop
bcd2633a
JP
6528ovs-appctl time/warp 5000
6529AT_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)'])
6530AT_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 6531sleep 1
2be3fe44 6532AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6533recirc_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>
6534recirc_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
6535])
6536OVS_VSWITCHD_STOP
6537AT_CLEANUP
6538
6539AT_SETUP([ofproto-dpif megaflow - resubmit port action])
6540OVS_VSWITCHD_START
623540e4 6541AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6542add_of_ports br0 1 2
bcd2633a
JP
6543AT_DATA([flows.txt], [dnl
6544table=0 in_port=1,ip actions=resubmit(90)
6545table=0 in_port=90,dl_src=50:54:00:00:00:09 actions=output(2)
6546])
6547AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6548AT_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)'])
6549AT_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 6550sleep 1
2be3fe44 6551AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6552recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
31ecf25f 6553recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6554])
6555OVS_VSWITCHD_STOP
6556AT_CLEANUP
6557
6558AT_SETUP([ofproto-dpif megaflow - resubmit table action])
6559OVS_VSWITCHD_START
623540e4 6560AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6561add_of_ports br0 1 2
bcd2633a
JP
6562AT_DATA([flows.txt], [dnl
6563table=0 in_port=1,ip actions=resubmit(,1)
6564table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6565])
6566AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6567AT_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)'])
6568AT_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=
65691,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
ae692725 6570sleep 1
2be3fe44 6571AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6572recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6573recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6574])
6575OVS_VSWITCHD_STOP
6576AT_CLEANUP
6577
6578AT_SETUP([ofproto-dpif megaflow - goto_table action])
6579OVS_VSWITCHD_START
623540e4 6580AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6581add_of_ports br0 1 2
bcd2633a
JP
6582AT_DATA([flows.txt], [dnl
6583table=0 in_port=1,ip actions=goto_table(1)
6584table=1 dl_src=50:54:00:00:00:09 actions=output(2)
6585])
6586AT_CHECK([ovs-ofctl -O OpenFlow12 add-flows br0 flows.txt])
6587AT_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)'])
6588AT_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 6589sleep 1
2be3fe44 6590AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6591recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6592recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
bcd2633a
JP
6593])
6594OVS_VSWITCHD_STOP
6595AT_CLEANUP
6596
6597AT_SETUP([ofproto-dpif megaflow - mirroring, select_all])
2d5c1a20 6598AT_KEYWORDS([mirror mirrors mirroring])
bcd2633a 6599OVS_VSWITCHD_START
623540e4 6600AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6601add_of_ports br0 1 2 3
bcd2633a
JP
6602ovs-vsctl \
6603 set Bridge br0 mirrors=@m --\
6604 --id=@p3 get Port p3 --\
6605 --id=@m create Mirror name=mymirror select_all=true output_port=@p3
6606
6607AT_DATA([flows.txt], [dnl
6608in_port=1 actions=output:2
6609])
6610AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6611AT_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 6612sleep 1
bcd2633a 6613AT_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 6614sleep 1
2be3fe44 6615AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6616recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions: <del>
bcd2633a
JP
6617])
6618OVS_VSWITCHD_STOP
6619AT_CLEANUP
6620
6621AT_SETUP([ofproto-dpif megaflow - mirroring, select_vlan])
6622OVS_VSWITCHD_START
623540e4 6623AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6624add_of_ports br0 1 2 3
bcd2633a
JP
6625ovs-vsctl \
6626 set Bridge br0 mirrors=@m --\
6627 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
6628 --id=@m create Mirror name=mymirror select_all=true select_vlan=11 output_port=@p3
6629
6630AT_DATA([flows.txt], [dnl
6631in_port=1 actions=output:2
6632])
6633AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6634AT_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))'])
6635AT_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 6636sleep 1
2be3fe44 6637AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
16194afd
DDP
6638recirc_id=0,ip,in_port=1,dl_vlan=11,nw_frag=no, actions: <del>
6639recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,nw_frag=no, actions: <del>
bcd2633a
JP
6640])
6641OVS_VSWITCHD_STOP
6642AT_CLEANUP
6643
6644AT_SETUP([ofproto-dpif megaflow - move action])
6645OVS_VSWITCHD_START
623540e4 6646AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6647add_of_ports br0 1 2
bcd2633a
JP
6648AT_DATA([flows.txt], [dnl
6649table=0 in_port=1 ip,actions=move:NXM_OF_IP_SRC[[]]->NXM_NX_REG0[[]],resubmit(90)
6650table=0 in_port=90 ip,actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]],resubmit(91)
6651table=0 in_port=91 reg0=0x0a000002,actions=output(2)
6652])
6653AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6654AT_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)'])
6655AT_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 6656sleep 1
2be3fe44 6657AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6658recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2,nw_frag=no, actions: <del>
6659recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
bcd2633a
JP
6660])
6661OVS_VSWITCHD_STOP
6662AT_CLEANUP
6663
6664AT_SETUP([ofproto-dpif megaflow - push action])
6665OVS_VSWITCHD_START
623540e4 6666AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6667add_of_ports br0 1 2
bcd2633a
JP
6668AT_DATA([flows.txt], [dnl
6669table=0 in_port=1 ip,actions=push:NXM_OF_IP_SRC[[]],output(2)
6670])
6671AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6672AT_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)'])
6673AT_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 6674sleep 1
2be3fe44 6675AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6676recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2,nw_frag=no, actions: <del>
6677recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
bcd2633a
JP
6678])
6679OVS_VSWITCHD_STOP
6680AT_CLEANUP
6681
6682AT_SETUP([ofproto-dpif megaflow - learning])
6683OVS_VSWITCHD_START
623540e4 6684AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6685add_of_ports br0 1 2
bcd2633a
JP
6686AT_DATA([flows.txt], [dnl
6687table=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
6688])
6689AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
31ef9f51 6690ovs-appctl time/stop
956f2bf0
BP
6691# We send each packet twice because the first packet in each flow causes the
6692# flow table to change and thus revalidations, which (depending on timing)
6693# can keep a megaflow from being installed. The revalidations are done by
6694# the second iteration, allowing the flows to be installed.
6695for i in 1 2; do
6696 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)'])
6697 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)'])
6698 ovs-appctl time/warp 100
6699done
ae692725 6700sleep 1
bcd2633a 6701dnl The original flow is missing due to a revalidation.
2be3fe44 6702AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
d8485a90
AW
6703recirc_id=0,ip,in_port=1,vlan_tci=0x0000/0x1fff,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
6704recirc_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
6705])
6706OVS_VSWITCHD_STOP
6707AT_CLEANUP
d4f4a9b2
JP
6708
6709AT_SETUP([ofproto-dpif megaflow - tunnels])
6710OVS_VSWITCHD_START(
2c0ea78f 6711 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
623540e4 6712AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
2c0ea78f
GS
6713AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=gre \
6714 options:remote_ip=1.1.1.1 ofport_request=2 options:key=flow])
6715AT_CHECK([ovs-vsctl add-port br0 p3 -- set Interface p3 type=dummy \
6716 ofport_request=3])
6717AT_CHECK([ovs-vsctl add-port br0 p4 -- set Interface p4 type=gre \
6718 options:remote_ip=1.1.1.2 options:tos=inherit options:ttl=inherit \
6719 ofport_request=4 options:key=flow])
d4f4a9b2
JP
6720AT_DATA([flows.txt], [dnl
6721in_port=1,actions=output(2)
6722in_port=3,actions=output(4)
6723])
6724AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6725dnl ECN bits are always copied out, but don't use 0x3 (CE), since that
6726dnl will cause the packet to be dropped.
6727AT_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 6728sleep 1
d4f4a9b2
JP
6729AT_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)'])
6730AT_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 6731sleep 1
d4f4a9b2 6732AT_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 6733sleep 1
2be3fe44 6734AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131
JR
6735recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_ecn=1,nw_frag=no, actions: <del>
6736recirc_id=0,ip,in_port=3,vlan_tci=0x0000,nw_tos=0,nw_ecn=1,nw_ttl=64,nw_frag=no, actions: <del>
6737recirc_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
6738])
6739OVS_VSWITCHD_STOP
6740AT_CLEANUP
6741
6742AT_SETUP([ofproto-dpif megaflow - dec_ttl])
6743OVS_VSWITCHD_START
623540e4 6744AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6745add_of_ports br0 1 2
13751fd8 6746AT_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
6747AT_DATA([flows.txt], [dnl
6748table=0 in_port=1,icmp,nw_src=10.0.0.4 actions=dec_ttl,output(2)
6749])
6750AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6751AT_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)'])
6752AT_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 6753sleep 1
2be3fe44 6754AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
449b8131 6755recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_ttl=64,nw_frag=no, actions: <del>
31ecf25f 6756recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/30,nw_frag=no, actions: <del>
d4f4a9b2
JP
6757])
6758OVS_VSWITCHD_STOP
6759AT_CLEANUP
74cc3969 6760
f74e7df7
JP
6761AT_SETUP([ofproto-dpif megaflow - set dl_dst])
6762OVS_VSWITCHD_START
623540e4 6763AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6764add_of_ports br0 1 2
f74e7df7
JP
6765AT_DATA([flows.txt], [dnl
6766table=0 in_port=1 actions=mod_dl_dst(50:54:00:00:00:0a),output(2)
6767])
6768AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6769AT_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)'])
6770AT_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 6771sleep 1
d23df9a8
JR
6772dnl The first packet is essentially a no-op, as the new destination MAC is the
6773dnl same as the original. The second entry actually updates the destination
6774dnl MAC.
2be3fe44 6775AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
449b8131
JR
6776recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_dst=50:54:00:00:00:0a,nw_frag=no, actions:2
6777recirc_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
6778])
6779OVS_VSWITCHD_STOP
6780AT_CLEANUP
6781
8c301900
JR
6782AT_SETUP([ofproto-dpif megaflow - disabled])
6783OVS_VSWITCHD_START
623540e4 6784AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
ca5792f0 6785add_of_ports br0 1 2
8c301900
JR
6786AT_DATA([flows.txt], [dnl
6787table=0 in_port=1,ip,nw_dst=10.0.0.1 actions=output(2)
6788table=0 in_port=1,ip,nw_dst=10.0.0.3 actions=drop
6789])
e79a6c83 6790AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
8c301900 6791], [])
64bb477f
JS
6792AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
6793], [])
8c301900
JR
6794AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg], [0], [], [])
6795AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
6796for i in 1 2 3 4; do
6797 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)'])
6798 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
6799 if [[ $i -eq 1 ]]; then
6800 sleep 1
6801 fi
8c301900 6802done
ae692725 6803sleep 1
2be3fe44 6804AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
9daf2348
JS
6805pkt_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
6806pkt_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 6807])
2be3fe44 6808AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_dump | grep 'packets:3'], [0], [dnl
7d170098 6809skb_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 6810skb_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
6811])
6812OVS_VSWITCHD_STOP
6813AT_CLEANUP
6814
74cc3969
BP
6815AT_SETUP([ofproto-dpif - datapath port number change])
6816OVS_VSWITCHD_START([set Bridge br0 fail-mode=standalone])
ca5792f0 6817add_of_ports br0 1
74cc3969
BP
6818
6819# Trace a flow that should output to p1.
6820AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6821 [0], [stdout])
6822AT_CHECK([tail -1 stdout], [0], [Datapath actions: 1
6823])
6824
6825# Change p1's port number to 5.
6826AT_CHECK([ovs-appctl dpif-dummy/change-port-number ovs-dummy p1 5])
6827
6828# Trace a flow that should output to p1 in its new location.
6829AT_CHECK([ovs-appctl ofproto/trace br0 in_port=LOCAL,dl_src=10:20:30:40:50:60],
6830 [0], [stdout])
6831AT_CHECK([tail -1 stdout], [0], [Datapath actions: 5
6832])
6833OVS_VSWITCHD_STOP
6834AT_CLEANUP
2d344ba5
AW
6835
6836# Tests the bundling with various bfd and cfm configurations.
6837AT_SETUP([ofproto - bundle with variable bfd/cfm config])
6838OVS_VSWITCHD_START([add-br br1 -- set bridge br1 datapath-type=dummy -- \
6839 add-bond br0 br0bond p0 p2 bond-mode=active-backup -- \
6840 add-bond br1 br1bond p1 p3 bond-mode=active-backup -- \
6841 set Interface p1 type=patch options:peer=p0 ofport_request=2 -- \
6842 set Interface p3 type=patch options:peer=p2 ofport_request=4 -- \
6843 set Interface p0 type=patch options:peer=p1 ofport_request=1 -- \
6844 set Interface p2 type=patch options:peer=p3 ofport_request=3 -- \
6845 set Interface p0 bfd:enable=true bfd:min_tx=300 bfd:min_rx=300 -- \
6846 set Interface p0 cfm_mpid=1 -- \
6847 set Interface p1 bfd:enable=true bfd:min_tx=500 bfd:min_rx=500])
6848
6849ovs-appctl time/stop
6850# advance the clock to stablize everything.
bdba1947 6851ovs-appctl time/warp 5000 100
2d344ba5
AW
6852# cfm/show should show 'recv' fault.
6853AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6854 fault: recv
6855])
6856# bfd/show should show 'up'.
6857AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6858 Local Session State: up
6859 Remote Session State: up
6860 Local Session State: up
6861 Remote Session State: up
6862])
6863# bond/show should show 'may-enable: true' for all slaves.
6864AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6865 may_enable: true
6866 may_enable: true
6867 may_enable: true
6868 may_enable: true
6869])
6870
6871# now disable the bfd on p1.
6872AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=false])
6873# advance the clock to stablize everything.
bdba1947 6874ovs-appctl time/warp 5000 100
2d344ba5
AW
6875# cfm/show should show 'recv' fault.
6876AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6877 fault: recv
6878])
6879# bfd/show should show 'down'.
6880AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6881 Local Session State: down
6882 Remote Session State: down
6883])
6884# bond/show should show 'may-enable: false' for p0.
125bf01d 6885AT_CHECK([ovs-appctl bond/show br0bond | sed -n '/^.*may_enable:.*/p'], [0], [dnl
2d344ba5
AW
6886 may_enable: false
6887 may_enable: true
2d344ba5
AW
6888])
6889
6890# now enable the bfd on p1 and disable bfd on p0.
6891AT_CHECK([ovs-vsctl set Interface p1 bfd:enable=true])
6892AT_CHECK([ovs-vsctl set Interface p0 bfd:enable=false])
6893# advance the clock to stablize everything.
bdba1947 6894ovs-appctl time/warp 5000 100
2d344ba5
AW
6895# cfm/show should show 'recv' fault.
6896AT_CHECK([ovs-appctl cfm/show | sed -n '/^.*fault:.*/p'], [0], [dnl
6897 fault: recv
6898])
6899# bfd/show should show 'down'.
6900AT_CHECK([ovs-appctl bfd/show | sed -n '/^.*Session State:.*/p'], [0], [dnl
6901 Local Session State: down
6902 Remote Session State: down
6903])
6904# bond/show should show 'may-enable: false' for p0 and p1.
6905AT_CHECK([ovs-appctl bond/show | sed -n '/^.*may_enable:.*/p'], [0], [dnl
6906 may_enable: false
6907 may_enable: true
6908 may_enable: false
6909 may_enable: true
6910])
6911
e441a806
AW
6912OVS_VSWITCHD_STOP
6913AT_CLEANUP
6914
6915AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 1])
6916OVS_VSWITCHD_START([add-port br0 p0 -- set interface p0 type=gre options:remote_ip=1.2.3.4])
6917
6918# enable bfd on p0.
6919AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6920# check log.
1335a8d5 6921OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6922# disable bfd on p0.
6923AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6924# check log.
1335a8d5 6925OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 6926AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
6927
6928# enable cfm on p0.
6929AT_CHECK([ovs-vsctl set interface p0 cfm_mpid=10])
6930# check log.
1335a8d5 6931OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6932# disable cfm on p0.
6933AT_CHECK([ovs-vsctl remove interface p0 cfm_mpid 10])
6934# check log.
1335a8d5 6935OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
454ff761 6936AT_CHECK([sed -e '/^.*ofproto_dpif_monitor.*$/d' < ovs-vswitchd.log > tmp && ovs-appctl vlog/close && mv tmp ovs-vswitchd.log && ovs-appctl vlog/reopen])
e441a806
AW
6937
6938# enable both bfd and cfm on p0.
6939AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true cfm_mpid=10])
6940# check log.
1335a8d5 6941OVS_WAIT_UNTIL([grep "monitor thread created" ovs-vswitchd.log])
e441a806
AW
6942# disable bfd on p0.
6943AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false])
6944# check log, there should not be the log of thread terminated.
738cd849 6945AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* terminated\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
6946])
6947# reenable bfd on p0.
6948AT_CHECK([ovs-vsctl set interface p0 bfd:enable=true])
6949# check log, should still be on log of thread created.
738cd849 6950AT_CHECK([sed -n "s/^.*|ofproto_dpif_monitor(monitor[[0-9]]*)|INFO|\(.* created\)$/\1/p" ovs-vswitchd.log], [0], [dnl
e441a806
AW
6951monitor thread created
6952])
6953# disable bfd and cfm together.
6954AT_CHECK([ovs-vsctl set interface p0 bfd:enable=false -- remove interface p0 cfm_mpid 10])
6955# check log.
1335a8d5 6956OVS_WAIT_UNTIL([grep "monitor thread terminated" ovs-vswitchd.log])
e441a806
AW
6957
6958OVS_VSWITCHD_STOP
6959AT_CLEANUP
6960
6961# this test helps avoid the deadlock between the main thread and monitor thread.
6962AT_SETUP([ofproto-dpif - ofproto-dpif-monitor 2])
6963OVS_VSWITCHD_START
6964
6965for i in `seq 1 199`
6966do
6967 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])
6968done
6969
98cf638b
AW
6970OVS_VSWITCHD_STOP
6971AT_CLEANUP
98b07853
BP
6972\f
6973AT_BANNER([ofproto-dpif - flow translation resource limits])
6974
790c5d26
BP
6975dnl Resubmits to later tables do not count against the depth limit, so we
6976dnl can do 99 of them even though the maximum depth is 64.
6977AT_SETUP([ofproto-dpif - forward resubmit])
6978OVS_VSWITCHD_START
6979(for i in `seq 0 99`; do
6980 j=`expr $i + 1`
6981 echo "table=$i, actions=resubmit(,$j)"
6982 done
6983 echo "table=100, actions=local") > flows
6984AT_CHECK([ovs-ofctl add-flows br0 flows])
6985AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
6986 [0], [stdout])
6987AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
6988])
6989OVS_VSWITCHD_STOP
6990AT_CLEANUP
6991
6992dnl Resubmits to the same or an earlier table count against the depth limit,
6993dnl so only 64 of them are allowed.
6994AT_SETUP([ofproto-dpif - backward resubmit])
6995OVS_VSWITCHD_START
6996(echo "table=0, actions=resubmit(,66)"
6997 for i in `seq 2 66`; do
6998 j=`expr $i - 1`
6999 echo "table=$i, actions=resubmit(,$j)"
7000 done
7001 echo "table=1, actions=local") > flows
7002AT_CHECK([ovs-ofctl add-flows br0 flows])
7003AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
7004 [0], [stdout])
7005AT_CHECK([tail -1 stdout], [0],
7006 [Translation failed (Recursion too deep), packet is dropped.
7007])
7008AT_CHECK([grep -c 'over max translation depth 64' stdout],
7009 [0], [1
7010])
7011OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7012AT_CLEANUP
7013
98b07853
BP
7014AT_SETUP([ofproto-dpif - infinite resubmit])
7015OVS_VSWITCHD_START
7016AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
222820c6 7017AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
98b07853 7018 [0], [stdout])
fff1b9c0
JR
7019AT_CHECK([tail -1 stdout], [0],
7020 [Translation failed (Recursion too deep), packet is dropped.
98b07853 7021])
790c5d26 7022AT_CHECK([grep -c 'over max translation depth 64' stdout],
98b07853
BP
7023 [0], [1
7024])
7025OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
7026AT_CLEANUP
7027
7028AT_SETUP([ofproto-dpif - exponential resubmit chain])
7029OVS_VSWITCHD_START
ca5792f0 7030add_of_ports br0 1
98b07853
BP
7031(for i in `seq 1 64`; do
7032 j=`expr $i + 1`
7033 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7034 done
7035 echo "in_port=65, actions=local") > flows
7036 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 7037AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
7038AT_CHECK([tail -1 stdout], [0],
7039 [Translation failed (Too many resubmits), packet is dropped.
7040])
7041AT_CHECK([grep -c 'over 4096 resubmit actions' stdout], [0], [1
98b07853
BP
7042])
7043OVS_VSWITCHD_STOP(["/over.*resubmit actions/d"])
7044AT_CLEANUP
7045
7046AT_SETUP([ofproto-dpif - too many output actions])
7047OVS_VSWITCHD_START
ca5792f0 7048add_of_ports br0 1
98b07853
BP
7049(for i in `seq 1 12`; do
7050 j=`expr $i + 1`
7051 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7052 done
7053 echo "in_port=13, actions=local,local,local,local,local,local,local,local") > flows
542024c4 7054AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 7055AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
0f032e95
BP
7056AT_CHECK([grep -c -e '- Uses action(s) not supported by datapath' stdout],
7057 [0], [1
98b07853 7058])
fff1b9c0 7059AT_CHECK([grep -c 'resubmits yielded over 64 kB of actions' stdout], [0], [1
542024c4 7060])
0f032e95 7061OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of actions/d"])
98b07853
BP
7062AT_CLEANUP
7063
7064AT_SETUP([ofproto-dpif - stack too deep])
7065OVS_VSWITCHD_START
ca5792f0 7066add_of_ports br0 1
98b07853
BP
7067(for i in `seq 1 12`; do
7068 j=`expr $i + 1`
7069 echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
7070 done
7071 push="push:NXM_NX_REG0[[]]"
7072 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows
7073 AT_CHECK([ovs-ofctl add-flows br0 flows])
222820c6 7074AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'in_port=1'], [0], [stdout])
fff1b9c0
JR
7075AT_CHECK([tail -1 stdout], [0],
7076 [Translation failed (Stack too deep), packet is dropped.
7077])
7078AT_CHECK([grep -c 'resubmits yielded over 64 kB of stack' stdout], [0], [1
98b07853
BP
7079])
7080OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
7081AT_CLEANUP
d611866c
SH
7082
7083
2608616d 7084AT_SETUP([ofproto-dpif packet-out controller])
d611866c 7085OVS_VSWITCHD_START
ca5792f0 7086add_of_ports br0 1 2
d611866c
SH
7087
7088AT_CHECK([ovs-ofctl add-flow br0 'dl_dst=50:54:00:00:00:0a actions=controller'])
7089
7090AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7091AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7092
7093for i in 1 2 3; do
7094 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER controller '50540000000a5054000000091234'])
7095done
7096
d9c8c57c 7097OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
7098AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7099NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7100vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7101dnl
7102NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7103vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7104dnl
7105NXT_PACKET_IN (xid=0x0): total_len=14 in_port=CONTROLLER (via action) data_len=14 (unbuffered)
e6d9ab56 7106vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7107])
7108
7109AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7110 dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7111NXST_FLOW reply:
7112])
7113
3c1bb396
BP
7114(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7115 table 0:
8811fc0a
BP
7116 active=1, lookup=0, matched=0
7117
7118 table 1:
7119 active=0, lookup=0, matched=0
7120"
7121 for i in `seq 2 253`; do
7122 printf ' table %d: ditto\n' $i
d611866c
SH
7123 done) > expout
7124AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7125
7126OVS_VSWITCHD_STOP
7127AT_CLEANUP
7128
2608616d 7129AT_SETUP([ofproto-dpif packet-out controller (patch port)])
d611866c
SH
7130OVS_VSWITCHD_START(
7131 [-- \
7132 add-port br0 p1 -- \
7133 set interface p1 type=patch options:peer=p2 -- \
7134 add-br br1 -- \
7135 set bridge br1 datapath-type=dummy -- \
7136 set bridge br1 fail-mode=secure -- \
7137 set bridge br1 protocols='[OpenFlow10,OpenFlow11,OpenFlow12,OpenFlow13]' -- \
7138 add-port br1 p2 -- \
7139 set interface p2 type=patch options:peer=p1 --])
7140
7141AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7142AT_CHECK([ovs-ofctl monitor br1 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7143
7144for i in 1 2 3; do
7145 AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out br0 CONTROLLER output:1 '50540000000a5054000000091234'])
7146done
7147
d9c8c57c 7148OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
7149AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7150NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7151vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7152dnl
7153NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7154vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7155dnl
7156NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=14 in_port=1 (via no_match) data_len=14 (unbuffered)
e6d9ab56 7157vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7158])
7159
8811fc0a
BP
7160(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7161 table 0:
7162 active=0, lookup=0, matched=0
7163"
7164 for i in `seq 1 253`; do
7165 printf ' table %d: ditto\n' $i
d611866c
SH
7166 done) > expout
7167AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7168
3c1bb396
BP
7169(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7170 table 0:
8811fc0a
BP
7171 active=0, lookup=3, matched=0
7172
7173 table 1:
7174 active=0, lookup=0, matched=0
7175"
7176 for i in `seq 2 253`; do
7177 printf ' table %d: ditto\n' $i
d611866c
SH
7178 done) > expout
7179AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br1 ], [0], [expout])
7180
7181OVS_VSWITCHD_STOP
7182AT_CLEANUP
7183
7184
2608616d 7185AT_SETUP([ofproto-dpif packet-out goto_table])
d611866c 7186OVS_VSWITCHD_START
ca5792f0 7187add_of_ports br0 1 2
d611866c
SH
7188
7189AT_DATA([flows.txt], [dnl
7190table=0 dl_dst=50:54:00:00:00:0a actions=goto_table(1)
7191table=1 dl_dst=50:54:00:00:00:0a actions=controller
7192])
7193AT_CHECK([ovs-ofctl -O OpenFlow13 add-flows br0 flows.txt])
7194
7195AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7196AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7197
7198for i in 1 2 3; do
7199 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)'
7200done
7201
7202OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 7203OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
7204AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7205NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7206vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7207dnl
7208NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7209vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7210dnl
7211NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7212vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7213])
7214
cea4a6d7 7215AT_CHECK([ovs-appctl revalidator/purge], [0])
d611866c
SH
7216AT_CHECK([ovs-ofctl -O OpenFlow13 dump-flows br0 | ofctl_strip | sort], [0], [dnl
7217 n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=goto_table:1
7218 table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
7219OFPST_FLOW reply (OF1.3):
7220])
7221
3c1bb396
BP
7222(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7223 table 0:
7224 active=1, lookup=3, matched=3
7225
8811fc0a
BP
7226 table 1: ditto
7227 table 2:
7228 active=0, lookup=0, matched=0
7229"
7230 for i in `seq 3 253`; do
7231 printf ' table %d: ditto\n' $i
d611866c
SH
7232 done) > expout
7233AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7234
7235OVS_VSWITCHD_STOP
7236AT_CLEANUP
7237
7238
2608616d 7239AT_SETUP([ofproto-dpif packet-out table-miss (continue)])
d611866c 7240OVS_VSWITCHD_START
ca5792f0 7241add_of_ports br0 1 2
d611866c 7242
3c1bb396
BP
7243AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 'table=1 dl_dst=50:54:00:00:00:0a actions=controller'])
7244AT_CHECK([ovs-ofctl -O OpenFlow11 mod-table br0 all continue])
d611866c
SH
7245
7246AT_CAPTURE_FILE([ofctl_monitor.log])
6409e008 7247AT_CHECK([ovs-ofctl monitor br0 65534 invalid_ttl -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
d611866c
SH
7248
7249for i in 1 2 3; do
7250 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)'
7251done
7252
7253OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 6])
d9c8c57c 7254OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
d611866c
SH
7255AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7256NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7257vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7258dnl
7259NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7260vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7261dnl
7262NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x0 total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
e6d9ab56 7263vlan_tci=0x0000,dl_src=50:54:00:00:00:09,dl_dst=50:54:00:00:00:0a,dl_type=0x1234
d611866c
SH
7264])
7265
cea4a6d7 7266AT_CHECK([ovs-appctl revalidator/purge], [0])
3c1bb396 7267AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl
d611866c 7268 table=1, n_packets=3, n_bytes=180, dl_dst=50:54:00:00:00:0a actions=CONTROLLER:65535
3c1bb396 7269OFPST_FLOW reply (OF1.1):
d611866c
SH
7270])
7271
3c1bb396
BP
7272(echo "OFPST_TABLE reply (OF1.3) (xid=0x2):
7273 table 0:
7274 active=0, lookup=3, matched=0
7275
7276 table 1:
8811fc0a
BP
7277 active=1, lookup=3, matched=3
7278
7279 table 2:
7280 active=0, lookup=0, matched=0
7281"
7282 for i in `seq 3 253`; do
7283 printf ' table %d: ditto\n' $i
d611866c
SH
7284 done) > expout
7285AT_CHECK([ovs-ofctl -O OpenFlow13 dump-tables br0 ], [0], [expout])
7286
7287OVS_VSWITCHD_STOP
7288AT_CLEANUP
b0e2ec32
JR
7289
7290AT_SETUP([ofproto-dpif - ICMPv6])
7291OVS_VSWITCHD_START
ca5792f0 7292add_of_ports br0 1
b0e2ec32
JR
7293
7294AT_CAPTURE_FILE([ofctl_monitor.log])
7295
6409e008 7296AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
b0e2ec32
JR
7297
7298ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7299
d9c8c57c 7300OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
b0e2ec32
JR
7301
7302AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7303NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via no_match) data_len=86 (unbuffered)
e6d9ab56 7304icmp6,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
7305])
7306
7307OVS_VSWITCHD_STOP
7308AT_CLEANUP
e60e935b 7309
8ecb3068
DDP
7310AT_SETUP([ofproto-dpif - ICMPv6 type match])
7311OVS_VSWITCHD_START
7312add_of_ports br0 1 2 3
7313
7314AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=128,actions=2'])
7315AT_CHECK([ovs-ofctl add-flow br0 'icmp6,icmp_type=129,actions=3'])
7316
7317AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7318
7319AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
7320AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=128)'])
7321AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
7322AT_CHECK([ovs-appctl netdev-dummy/receive p1 'recirc_id(0),in_port(1),eth(src=f2:49:6e:52:49:0b,dst=02:b7:d7:17:ff:72),eth_type(0x86dd),ipv6(proto=58,frag=no),icmpv6(type=129)'])
7323
7324AT_CHECK([ovs-appctl revalidator/purge], [0])
7325
7326AT_CHECK([strip_ufid < ovs-vswitchd.log | filter_flow_install | strip_used], [0], [dnl
7327recirc_id=0,icmp6,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x80/0xff, actions:2
7328recirc_id=0,icmp6,in_port=1,vlan_tci=0x0000,nw_frag=no,icmp_type=0x81/0xff, actions:3
7329])
7330
7331AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl
7332 n_packets=2, n_bytes=124, icmp6,icmp_type=128 actions=output:2
7333 n_packets=2, n_bytes=124, icmp6,icmp_type=129 actions=output:3
7334NXST_FLOW reply:
7335])
7336
7337OVS_VSWITCHD_STOP
7338AT_CLEANUP
7339
e60e935b
SRCSA
7340AT_SETUP([ofproto-dpif - Neighbor Discovery set-field with checksum update])
7341OVS_VSWITCHD_START
ca5792f0 7342add_of_ports br0 1
e60e935b
SRCSA
7343AT_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])
7344
7345AT_CAPTURE_FILE([ofctl_monitor.log])
7346
6409e008 7347AT_CHECK([ovs-ofctl monitor br0 65534 -P nxt_packet_in --detach --no-chdir --pidfile 2> ofctl_monitor.log])
e60e935b
SRCSA
7348
7349ovs-appctl netdev-dummy/receive p1 '0060970769ea0000860580da86dd6000000000203afffe80000000000000020086fffe0580dafe80000000000000026097fffe0769ea870068bd00000000fe80000000000000026097fffe0769ea01010000860580da'
7350
d9c8c57c 7351OVS_APP_EXIT_AND_WAIT([ovs-ofctl])
e60e935b
SRCSA
7352
7353AT_CHECK([cat ofctl_monitor.log], [0], [dnl
7354NXT_PACKET_IN (xid=0x0): cookie=0x0 total_len=86 in_port=1 (via action) data_len=86 (unbuffered)
e6d9ab56 7355icmp6,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
7356])
7357
7358OVS_VSWITCHD_STOP
7359AT_CLEANUP
7360
f171fa88
AW
7361# Tests the exact match of CFI bit in installed datapath flows matching VLAN.
7362AT_SETUP([ofproto-dpif - vlan matching])
7363OVS_VSWITCHD_START(
7364 [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
7365AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7366
7367AT_CHECK([ovs-ofctl del-flows br0])
7368AT_CHECK([ovs-ofctl add-flow br0 "vlan_tci=0x000a/0x0fff,action=output:local"])
7369
7370AT_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))'])
7371
47567945 7372OVS_WAIT_UNTIL([grep flow_add: ovs-vswitchd.log])
2be3fe44 7373AT_CHECK([grep 'in_port=[[1]]' ovs-vswitchd.log | filter_flow_install | strip_xout], [0], [dnl
f171fa88
AW
7374recirc_id=0,ip,in_port=1,dl_vlan=10,nw_frag=no, actions: <del>
7375])
7376OVS_VSWITCHD_STOP
7377AT_CLEANUP
43b2f131
EJ
7378
7379# Tests in place modification of installed datapath flows.
7380AT_SETUP([ofproto-dpif - in place modification])
7381OVS_VSWITCHD_START(
7382 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7383AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7384
7385AT_CHECK([ovs-ofctl del-flows br0])
7386AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=mod_vlan_vid:3,output:local])
7387
7388ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7389
7390ovs-appctl time/stop
7391
ed8ac2a0
JR
7392AT_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(0x1234)'])
7393
7394# Wait for the flow setup to be done.
7395OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
7396
7397for i in 1 2; do
43b2f131
EJ
7398 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)'
7399done
7400
3a18d0c2 7401AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
43b2f131
EJ
7402recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:push_vlan(vid=3,pcp=0),100
7403])
7404
7405AT_CHECK([ovs-ofctl add-flow br0 priority=60000,in_port=1,actions=mod_vlan_vid:4,output:local])
7406
7407ovs-appctl time/warp 500
7408ovs-appctl time/warp 500
7409
7410for i in 1 2 3; do
7411 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)'
7412done
7413
3a18d0c2 7414AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
43b2f131
EJ
7415recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:push_vlan(vid=4,pcp=0),100
7416])
7417
38b0b29f 7418AT_CHECK([grep 'modify' ovs-vswitchd.log | strip_ufid ], [0], [dnl
43b2f131
EJ
7419dpif|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
7420])
7421OVS_VSWITCHD_STOP
7422AT_CLEANUP
449b8131
JR
7423
7424# Tests in place modification of installed datapath flows with vlans.
7425AT_SETUP([ofproto-dpif - in place modification (vlan)])
7426OVS_VSWITCHD_START(
7427 [add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])
7428AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
7429
7430AT_CHECK([ovs-ofctl del-flows br0])
7431AT_CHECK([ovs-ofctl add-flow br0 in_port=1,actions=output:local])
7432
7433ovs-appctl vlog/set PATTERN:ANY:'%c|%p|%m'
7434
7435ovs-appctl time/stop
7436
ed8ac2a0
JR
7437AT_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(0x1234)'])
7438
449b8131 7439# Check that a correct datapath flow is created.
ed8ac2a0
JR
7440OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
7441
7442for i in 1 2; do
449b8131
JR
7443 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)'
7444done
7445
3a18d0c2 7446AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7447recirc_id(0),in_port(1),eth_type(0x1234), packets:2, bytes:120, used:0.0s, actions:100
7448])
7449
7450# Delete the flow. Then check that the datapath flow is modified to
7451# drop the packets. A modified flow inherits the stats, a new
7452# datapath flow would start from sero.
7453AT_CHECK([ovs-ofctl del-flows br0])
7454
7455ovs-appctl time/warp 500
7456ovs-appctl time/warp 500
7457
7458for i in 1 2 3; do
7459 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)'
7460done
7461
3a18d0c2 7462AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7463recirc_id(0),in_port(1),eth_type(0x1234), packets:5, bytes:300, used:0.0s, actions:drop
7464])
7465
7466# Add a flow that matches the non-presence of a vlan tag, and check
7467# that the datapath flow is modified accordingly.
7468AT_CHECK([ovs-ofctl add-flow br0 in_port=1,vlan_tci=0x0000/0x1fff,actions=output:local])
7469
7470ovs-appctl time/warp 500
7471ovs-appctl time/warp 500
7472
7473for i in 1 2 3; do
7474 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)'
7475done
7476
3a18d0c2 7477AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131
JR
7478recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
7479])
7480
7481# Check that VLAN packets will not hit the same datapath megaflow.
ed8ac2a0
JR
7482
7483AT_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=99,pcp=7),encap(eth_type(0x1234))'])
7484OVS_WAIT_UNTIL([grep 'flow_add:.*dl_vlan=99' ovs-vswitchd.log])
7485
7486for i in 1 2; do
449b8131
JR
7487 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))'
7488done
7489
3a18d0c2 7490AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
449b8131 7491recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
31ecf25f 7492recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:120, used:0.0s, actions:drop
449b8131
JR
7493])
7494
7495# Check that the new flow matches the CFI bit, while both vid and pcp
7496# are wildcarded.
38b0b29f 7497AT_CHECK([grep '\(modify\)\|\(flow_add\)' ovs-vswitchd.log | strip_ufid ], [0], [dnl
449b8131
JR
7498dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0x0000,dl_type=0x1234, actions:100
7499dpif|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)
7500dpif|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
31ecf25f 7501dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,dl_vlan=99,dl_type=0x1234, actions:drop
449b8131
JR
7502])
7503OVS_VSWITCHD_STOP
7504AT_CLEANUP
56de2148
YT
7505
7506AT_SETUP([ofproto-dpif - trace (unchanged)])
7507OVS_VSWITCHD_START
7508AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1'], [0], [stdout])
7509AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
7510])
7511AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100)'], [0], [stdout])
7512AT_CHECK([grep "Final flow:" stdout], [0], [Final flow: unchanged
7513])
7514OVS_VSWITCHD_STOP
7515AT_CLEANUP