40
44
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
41
45
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,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=80'], [0], [stdout])
42
46
AT_CHECK([tail -2 stdout], [0],
43
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
47
[Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
44
48
Datapath actions: 1
46
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
50
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=11.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
47
51
AT_CHECK([tail -2 stdout], [0],
48
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=192.168.0.2,nw_frag=no
52
[Megaflow: recirc_id=0,ip,in_port=1,nw_dst=1.0.0.0/1.0.0.0,nw_frag=no
49
53
Datapath actions: drop
51
55
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
52
56
AT_CHECK([tail -2 stdout], [0],
53
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
57
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
54
58
Datapath actions: drop
56
60
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
57
61
AT_CHECK([tail -2 stdout], [0],
58
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=0x40/0xfff0
62
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=0x1/0x1
59
63
Datapath actions: 2
73
98
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst,nw_dst], [1], [],
74
99
[ovs-vsctl: nw_dst,nw_dst: set contains duplicate value
76
102
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=nw_dst], [0])
77
AT_DATA([flows.txt], [dnl
78
table=0 in_port=1 priority=16,tcp,nw_dst=10.1.0.0/255.255.0.0,action=output(3)
79
table=0 in_port=1 priority=32,tcp,nw_dst=10.1.2.0/255.255.255.0,tp_src=79,action=output(2)
80
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=80,action=drop
81
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=8080,action=output(2)
82
table=0 in_port=1 priority=33,tcp,nw_dst=10.1.2.15,tp_dst=192,action=output(2)
83
table=0 in_port=1 priority=0,ip,action=drop
84
table=0 in_port=2 priority=16,tcp,nw_dst=192.168.0.0/255.255.0.0,action=output(1)
85
table=0 in_port=2 priority=0,ip,action=drop
86
table=0 in_port=3 priority=16,tcp,nw_src=10.1.0.0/255.255.0.0,action=output(1)
87
table=0 in_port=3 priority=0,ip,action=drop
89
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
90
103
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
91
104
AT_CHECK([tail -2 stdout], [0],
92
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
105
[Megaflow: recirc_id=0,ip,in_port=1,nw_dst=192.168.0.0/16,nw_frag=no
93
106
Datapath actions: drop
95
108
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=2,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=80'], [0], [stdout])
96
109
AT_CHECK([tail -2 stdout], [0],
97
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
110
[Megaflow: recirc_id=0,tcp,in_port=2,nw_dst=192.168.0.0/16,nw_frag=no
98
111
Datapath actions: 1
100
113
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=80'], [0], [stdout])
101
114
AT_CHECK([tail -2 stdout], [0],
102
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
115
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_dst=80
103
116
Datapath actions: drop
105
118
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.2.15,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
106
119
AT_CHECK([tail -2 stdout], [0],
107
[Megaflow: recirc_id=0,skb_priority=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_src=0x0/0xffc0,tp_dst=0x40/0xfff0
120
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.2.15,nw_frag=no,tp_src=0x0/0x1,tp_dst=0x40/0xfff0
123
AT_CHECK([ovs-vsctl set Flow_Table t0 prefixes=none], [0])
124
AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=10.1.3.16,nw_proto=6,nw_tos=0,nw_ttl=128,tp_src=8,tp_dst=79'], [0], [stdout])
125
AT_CHECK([tail -2 stdout], [0],
126
[Megaflow: recirc_id=0,tcp,in_port=1,nw_dst=10.1.3.16,nw_frag=no
108
127
Datapath actions: 3
110
129
OVS_VSWITCHD_STOP(["/'prefixes' with incompatible field: ipv6_label/d"])
132
AT_BANNER([conjunctive match])
134
AT_SETUP([single conjunctive match])
136
ADD_OF_PORTS([br0], 1, 2, 3, 4, 5)
137
AT_DATA([flows.txt], [dnl
139
priority=100,ip,ip_src=10.0.0.1,actions=conjunction(1,1/2)
140
priority=100,ip,ip_src=10.0.0.4,actions=conjunction(1,1/2)
141
priority=100,ip,ip_src=10.0.0.6,actions=conjunction(1,1/2)
142
priority=100,ip,ip_src=10.0.0.7,actions=conjunction(1,1/2)
143
priority=100,ip,ip_dst=10.0.0.2,actions=conjunction(1,2/2)
144
priority=100,ip,ip_dst=10.0.0.5,actions=conjunction(1,2/2)
145
priority=100,ip,ip_dst=10.0.0.7,actions=conjunction(1,2/2)
146
priority=100,ip,ip_dst=10.0.0.8,actions=conjunction(1,2/2)
147
priority=100,ip,ip_src=10.0.0.1,ip_dst=10.0.0.4,actions=4
148
priority=100,ip,ip_src=10.0.0.3,ip_dst=10.0.0.5,actions=5
152
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
153
for src in 0 1 2 3 4 5 6 7; do
154
for dst in 0 1 2 3 4 5 6 7; do
155
if test $src$dst = 14; then
157
elif test $src$dst = 35; then
161
case $src in [[1467]]) case $dst in [[2578]]) out=3 ;; esac ;; esac
163
AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_type=0x0800,nw_src=10.0.0.$src,nw_dst=10.0.0.$dst"], [0], [stdout])
164
AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $out
171
AT_SETUP([multiple conjunctive match])
173
ADD_OF_PORTS([br0], 1, 2, 3, 4, 5)
174
AT_DATA([flows.txt], [dnl
179
priority=5,ip,ip_src=20.0.0.0/8,actions=conjunction(1,1/2),conjunction(2,1/2)
180
priority=5,ip,ip_src=10.1.0.0/16,actions=conjunction(1,1/2),conjunction(3,2/3)
181
priority=5,ip,ip_src=10.2.0.0/16,actions=conjunction(1,1/2),conjunction(2,1/2)
182
priority=5,ip,ip_src=10.1.3.0/24,actions=conjunction(1,1/2),conjunction(3,2/3)
183
priority=5,ip,ip_src=10.1.4.5/32,actions=conjunction(1,1/2),conjunction(2,1/2)
185
priority=5,ip,ip_dst=20.0.0.0/8,actions=conjunction(1,2/2)
186
priority=5,ip,ip_dst=10.1.0.0/16,actions=conjunction(1,2/2)
187
priority=5,ip,ip_dst=10.2.0.0/16,actions=conjunction(1,2/2)
188
priority=5,ip,ip_dst=10.1.3.0/24,actions=conjunction(1,2/2)
189
priority=5,ip,ip_dst=10.1.4.5/32,actions=conjunction(1,2/2)
190
priority=5,ip,ip_dst=30.0.0.0/8,actions=conjunction(2,2/2),conjunction(3,1/3)
191
priority=5,ip,ip_dst=40.5.0.0/16,actions=conjunction(2,2/2),conjunction(3,1/3)
193
priority=5,tcp,tcp_dst=80,actions=conjunction(3,3/3)
194
priority=5,tcp,tcp_dst=443,actions=conjunction(3,3/3)
196
priority=5,tcp,tcp_src=80,actions=conjunction(3,3/3)
197
priority=5,tcp,tcp_src=443,actions=conjunction(3,3/3)
201
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
220
for c0 in '1 80' '2 443' '3 8080'; do
221
for d0 in '1 80' '2 443' '3 8080'; do
222
set $a0; a=$1 ip_src=$2
223
set $b0; b=$1 ip_dst=$2
224
set $c0; c=$1 tcp_src=$2
225
set $d0; d=$1 tcp_dst=$2
227
[[12345]][[12345]]??) out=1 ;;
228
[[135]][[67]]??) out=2 ;;
229
[[24]][[67]][[12]]? | [[24]][[67]]?[[12]]) out=3 ;;
232
AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=5,dl_type=0x0800,nw_proto=6,nw_src=$ip_src,nw_dst=$ip_dst,tcp_src=$tcp_src,tcp_dst=$tcp_dst"], [0], [stdout])
233
AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $out
242
# In conjunctive match, we can find some soft matches that turn out not to be a
243
# real match. Usually, that's the end of the road--there is no real match.
244
# But if there is a flow identical to one of the flows that was a soft match,
245
# except with a lower priority, then we have to try again with that lower
246
# priority flow. This test checks this special case.
247
AT_SETUP([conjunctive match priority fallback])
249
ADD_OF_PORTS([br0], 1, 2, 3, 4, 5, 6, 7)
250
AT_DATA([flows.txt], [dnl
254
priority=5,ip,ip_src=10.0.0.1,actions=conjunction(1,1/2)
255
priority=5,ip,ip_src=10.0.0.2,actions=conjunction(1,1/2)
256
priority=5,ip,ip_dst=10.0.0.1,actions=conjunction(1,2/2)
257
priority=5,ip,ip_dst=10.0.0.2,actions=conjunction(1,2/2)
258
priority=5,ip,ip_dst=10.0.0.3,actions=conjunction(1,2/2)
260
priority=4,ip,ip_src=10.0.0.3,ip_dst=10.0.0.2,actions=2
262
priority=3,ip,ip_src=10.0.0.1,actions=conjunction(3,1/2)
263
priority=3,ip,ip_src=10.0.0.3,actions=conjunction(3,1/2)
264
priority=3,ip,ip_dst=10.0.0.2,actions=conjunction(3,2/2)
265
priority=3,ip,ip_dst=10.0.0.3,actions=conjunction(3,2/2)
266
priority=3,ip,ip_dst=10.0.0.4,actions=conjunction(3,2/2)
268
priority=2,ip,ip_dst=10.0.0.1,actions=4
270
priority=1,ip,ip_src=10.0.0.1,ip_dst=10.0.0.5,actions=5
274
AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
275
for src in 0 1 2 3; do
276
for dst in 0 1 2 3 4 5; do
278
[[12]][[123]]) out=1 ;;
280
[[13]][[234]]) out=3 ;;
285
AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=7,dl_type=0x0800,nw_src=10.0.0.$src,nw_dst=10.0.0.$dst"], [0], [stdout])
286
AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $out
293
AT_SETUP([conjunctive match and other actions])
295
# It's OK to use "conjunction" actions with "note" actions.
296
AT_CHECK([ovs-ofctl add-flow br0 'actions=conjunction(3,1/2),note:41.42.43.44.45.46'])
297
AT_CHECK([ovs-ofctl add-flow br0 'actions=note:41.42.43.44.45.46,conjunction(3,1/2)'])
298
# It's not OK to use "conjunction" actions with other types of actions.
299
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' add-flow br0 'actions=output:1,conjunction(3,1/2)'], [1], [], [dnl
300
ofp_actions|WARN|"conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here)
301
ovs-ofctl: Incorrect instruction ordering
303
AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' add-flow br0 'actions=conjunction(3,1/2),output:1'], [1], [], [dnl
304
ofp_actions|WARN|"conjunction" actions may be used along with "note" but not any other kind of action (such as the "output" action used here)
305
ovs-ofctl: Incorrect instruction ordering