]>
Commit | Line | Data |
---|---|---|
29901626 BP |
1 | AT_BANNER([ofproto-dpif]) |
2 | ||
3 | AT_SETUP([ofproto-dpif - resubmit]) | |
023e1e0a | 4 | OVS_VSWITCHD_START |
29901626 BP |
5 | AT_DATA([flows.txt], [dnl |
6 | table=0 in_port=1 priority=1000 icmp actions=output(10),resubmit(2),output(19),resubmit(3),output(21) | |
7 | table=0 in_port=2 priority=1500 icmp actions=output(11),resubmit(,1),output(16),resubmit(2,1),output(18) | |
8 | table=0 in_port=3 priority=2000 icmp actions=output(20) | |
9 | table=1 in_port=1 priority=1000 icmp actions=output(12),resubmit(4,1),output(13),resubmit(3),output(15) | |
10 | table=1 in_port=2 priority=1500 icmp actions=output(17),resubmit(,2) | |
11 | table=1 in_port=3 priority=1500 icmp actions=output(14),resubmit(,2) | |
12 | ]) | |
13 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a61680c6 | 14 | AT_CHECK([ovs-appctl ofproto/trace br0 '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]) |
29901626 BP |
15 | AT_CHECK([tail -1 stdout], [0], |
16 | [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21 | |
17 | ]) | |
023e1e0a | 18 | OVS_VSWITCHD_STOP |
29901626 | 19 | AT_CLEANUP |
58a89177 EJ |
20 | |
21 | AT_SETUP([ofproto-dpif - registers]) | |
023e1e0a | 22 | OVS_VSWITCHD_START |
58a89177 EJ |
23 | AT_DATA([flows.txt], [dnl |
24 | in_port=90 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:91 | |
25 | in_port=91 actions=resubmit:5,resubmit:6,resubmit:7,resubmit:92 | |
26 | in_port=92 actions=resubmit:8,resubmit:9,resubmit:10,resubmit:11 | |
27 | in_port=2 actions=load:0x000db000->NXM_NX_REG0[[]] | |
28 | in_port=3 actions=load:0xdea->NXM_NX_REG0[[20..31]] | |
29 | in_port=4 actions=load:0xeef->NXM_NX_REG0[[0..11]] | |
30 | in_port=5 actions=move:NXM_NX_REG0[[]]->NXM_NX_REG1[[]] | |
31 | in_port=6 actions=load:0x22222222->NXM_NX_REG2[[]] | |
32 | in_port=7 actions=move:NXM_NX_REG1[[20..31]]->NXM_NX_REG2[[0..11]] | |
33 | in_port=8 actions=move:NXM_NX_REG1[[0..11]]->NXM_NX_REG2[[20..31]] | |
34 | in_port=9,reg0=0xdeadbeef actions=output:20 | |
35 | in_port=10,reg1=0xdeadbeef actions=output:21 | |
36 | in_port=11,reg2=0xeef22dea actions=output:22 | |
37 | ]) | |
38 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a61680c6 | 39 | AT_CHECK([ovs-appctl ofproto/trace br0 '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 EJ |
40 | AT_CHECK([tail -1 stdout], [0], |
41 | [Datapath actions: 20,21,22 | |
42 | ]) | |
023e1e0a | 43 | OVS_VSWITCHD_STOP |
58a89177 | 44 | AT_CLEANUP |
f694937d EJ |
45 | |
46 | AT_SETUP([ofproto-dpif - output]) | |
023e1e0a | 47 | OVS_VSWITCHD_START |
f694937d EJ |
48 | AT_DATA([flows.txt], [dnl |
49 | in_port=1 actions=resubmit:2,resubmit:3,resubmit:4,resubmit:5,resubmit:6,resubmit:7 | |
50 | in_port=2 actions=output:9 | |
51 | in_port=3 actions=load:55->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]],load:66->NXM_NX_REG1[[]] | |
52 | in_port=4 actions=output:10,output:NXM_NX_REG0[[]],output:NXM_NX_REG1[[]],output:11 | |
53 | in_port=5 actions=load:77->NXM_NX_REG0[[0..15]],load:88->NXM_NX_REG0[[16..31]] | |
54 | in_port=6 actions=output:NXM_NX_REG0[[0..15]],output:NXM_NX_REG0[[16..31]] | |
55 | in_port=7 actions=load:0x110000ff->NXM_NX_REG0[[]],output:NXM_NX_REG0[[]] | |
56 | ]) | |
57 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a61680c6 | 58 | AT_CHECK([ovs-appctl ofproto/trace br0 '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 EJ |
59 | AT_CHECK([tail -1 stdout], [0], |
60 | [Datapath actions: 9,55,10,55,66,11,77,88 | |
61 | ]) | |
023e1e0a | 62 | OVS_VSWITCHD_STOP |
f694937d | 63 | AT_CLEANUP |
8e9ce036 | 64 | |
77750738 JP |
65 | AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port]) |
66 | OVS_VSWITCHD_START( | |
67 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
68 | add-port br0 p2 -- set Interface p2 type=dummy]) | |
69 | ||
77750738 JP |
70 | AT_CHECK([ovs-ofctl add-flow br0 action=normal]) |
71 | ||
72 | # "in_port" defaults to OFPP_NONE if it's not specified. | |
73 | flow="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)" | |
74 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) | |
75 | actual=`tail -1 stdout | sed 's/Datapath actions: //'` | |
76 | ||
247527db BP |
77 | expected="0,1,2" |
78 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout]) | |
77750738 | 79 | mv stdout expout |
247527db | 80 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout]) |
77750738 JP |
81 | |
82 | OVS_VSWITCHD_STOP | |
83 | AT_CLEANUP | |
84 | ||
8b36f51e | 85 | AT_SETUP([ofproto-dpif - DSCP]) |
8b36f51e EJ |
86 | OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy]) |
87 | AT_DATA([flows.txt], [dnl | |
88 | actions=output:65534,enqueue:1:1,enqueue:1:2,enqueue:1:2,enqueue:1:1,output:1,mod_nw_tos:0,output:1,output:65534 | |
89 | ]) | |
90 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
91 | AT_CHECK([ovs-vsctl -- \ | |
92 | set Port p1 qos=@newqos --\ | |
93 | --id=@newqos create QoS type=linux-htb queues=1=@q1,2=@q2 --\ | |
94 | --id=@q1 create Queue dscp=1 --\ | |
95 | --id=@q2 create Queue dscp=2], [0], [ignore]) | |
96 | AT_CHECK([ovs-appctl ofproto/trace br0 '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]) | |
97 | AT_CHECK([tail -1 stdout], [0], | |
98 | [Datapath actions: dnl | |
99 | 0,dnl | |
100 | set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(priority(1)),1,dnl | |
101 | set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xb,ttl=128,frag=no)),set(priority(2)),1,dnl | |
102 | 1,dnl | |
103 | set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x7,ttl=128,frag=no)),set(priority(1)),1,dnl | |
104 | set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0xff,ttl=128,frag=no)),set(priority(0)),1,dnl | |
105 | set(ipv4(src=1.1.1.1,dst=2.2.2.2,proto=1,tos=0x3,ttl=128,frag=no)),1,dnl | |
106 | 0 | |
107 | ]) | |
108 | OVS_VSWITCHD_STOP | |
109 | AT_CLEANUP | |
110 | ||
fd19297b | 111 | AT_SETUP([ofproto-dpif - output/flood flags]) |
fd19297b EJ |
112 | OVS_VSWITCHD_START([dnl |
113 | add-port br0 p1 -- set Interface p1 type=dummy --\ | |
114 | add-port br0 p2 -- set Interface p2 type=dummy --\ | |
115 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
116 | add-port br0 p4 -- set Interface p4 type=dummy --\ | |
117 | add-port br0 p5 -- set Interface p5 type=dummy --\ | |
118 | add-port br0 p6 -- set Interface p6 type=dummy --\ | |
119 | add-port br0 p7 -- set Interface p7 type=dummy ]) | |
120 | ||
121 | AT_DATA([flows.txt], [dnl | |
122 | in_port=1 actions=flood | |
123 | in_port=2 actions=all | |
124 | in_port=3 actions=output:65534,output:1,output:2,output:3,output:4,output:5,output:6,output:7 | |
5bf93d67 | 125 | in_port=4 actions=enqueue:65534:1,enqueue:1:1,enqueue:2:1,enqueue:3:2,enqueue:4:1,enqueue:5:1,enqueue:6:1,enqueue:7:1 |
fd19297b EJ |
126 | ]) |
127 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
128 | AT_CHECK([ovs-ofctl mod-port br0 5 noforward]) | |
129 | AT_CHECK([ovs-ofctl mod-port br0 6 noflood]) | |
130 | ||
131 | AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(1),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout]) | |
132 | AT_CHECK([tail -1 stdout \ | |
133 | | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl | |
134 | 0 | |
135 | 2 | |
136 | 3 | |
137 | 4 | |
138 | 7 | |
139 | ]) | |
140 | ||
141 | AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(2),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout]) | |
142 | AT_CHECK([tail -1 stdout \ | |
143 | | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl | |
144 | 0 | |
145 | 1 | |
146 | 3 | |
147 | 4 | |
148 | 6 | |
149 | 7 | |
150 | ]) | |
151 | ||
152 | AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(3),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout]) | |
153 | AT_CHECK([tail -1 stdout], [0], | |
154 | [Datapath actions: 0,1,2,4,6,7 | |
155 | ]) | |
156 | ||
157 | AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(4),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout]) | |
158 | AT_CHECK([tail -1 stdout], [0], | |
5bf93d67 | 159 | [Datapath actions: set(priority(1)),0,1,2,set(priority(2)),3,set(priority(1)),6,7 |
fd19297b EJ |
160 | ]) |
161 | OVS_VSWITCHD_STOP | |
162 | AT_CLEANUP | |
163 | ||
8e9ce036 | 164 | AT_SETUP([ofproto-dpif - set_tunnel]) |
023e1e0a | 165 | OVS_VSWITCHD_START |
8e9ce036 EJ |
166 | AT_DATA([flows.txt], [dnl |
167 | in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5 | |
168 | in_port=1 actions=set_tunnel:1,output:1 | |
169 | in_port=2 actions=set_tunnel:1,output:2 | |
170 | in_port=3 actions=set_tunnel:2,set_tunnel:3,output:3 | |
171 | in_port=4 actions=set_tunnel:4,set_tunnel:3,output:4 | |
172 | in_port=5 actions=set_tunnel:5 | |
173 | ]) | |
174 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a61680c6 | 175 | AT_CHECK([ovs-appctl ofproto/trace br0 'tun_id(0x1),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]) |
8e9ce036 | 176 | AT_CHECK([tail -1 stdout], [0], |
4edb9ae9 | 177 | [Datapath actions: set(tun_id(0x1)),1,2,set(tun_id(0x3)),3,4 |
8e9ce036 | 178 | ]) |
023e1e0a | 179 | OVS_VSWITCHD_STOP |
15056dc8 EJ |
180 | AT_CLEANUP |
181 | ||
182 | AT_SETUP([ofproto-dpif - controller]) | |
183 | OVS_VSWITCHD_START([dnl | |
184 | add-port br0 p1 -- set Interface p1 type=dummy | |
185 | ]) | |
186 | ||
187 | AT_CAPTURE_FILE([ofctl_monitor.log]) | |
188 | AT_DATA([flows.txt], [dnl | |
189 | cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller | |
54834960 | 190 | cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1) |
15056dc8 EJ |
191 | cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller |
192 | ||
54834960 EJ |
193 | cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2) |
194 | cookie=0x4 table=2 in_port=81 actions=load:2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,controller,resubmit(82,3) | |
195 | cookie=0x5 table=3 in_port=82 actions=load:3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,controller,resubmit(83,4) | |
196 | cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5) | |
197 | cookie=0x7 table=5 in_port=84 actions=load:5->NXM_NX_REG4[[]],load:6->NXM_NX_TUN_ID[[]],mod_nw_dst:84.84.84.84,controller,resubmit(85,6) | |
198 | cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7) | |
199 | cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller | |
15056dc8 EJ |
200 | ]) |
201 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
202 | ||
203 | dnl Flow miss. | |
54834960 | 204 | AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) |
15056dc8 EJ |
205 | |
206 | for i in 1 2 3 ; do | |
207 | 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)' | |
208 | done | |
209 | ||
210 | OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) | |
211 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
212 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered) | |
213 | priority:0,tunnel:0,in_port:0000,tci(0) mac(50:54:00:00:00:05->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->9) tcp_csum:0 | |
214 | dnl | |
215 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered) | |
216 | priority:0,tunnel:0,in_port:0000,tci(0) mac(50:54:00:00:00:05->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->9) tcp_csum:0 | |
217 | dnl | |
218 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered) | |
219 | priority:0,tunnel:0,in_port:0000,tci(0) mac(50:54:00:00:00:05->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->9) tcp_csum:0 | |
220 | ]) | |
221 | ||
222 | dnl Singleton controller action. | |
54834960 | 223 | AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) |
15056dc8 EJ |
224 | |
225 | for i in 1 2 3 ; do | |
226 | 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)' | |
227 | done | |
228 | ||
229 | OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) | |
230 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
231 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) | |
232 | priority:0,tunnel:0,in_port:0000,tci(0) mac(10:11:11:11:11:11->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
233 | dnl | |
234 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) | |
235 | priority:0,tunnel:0,in_port:0000,tci(0) mac(10:11:11:11:11:11->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
236 | dnl | |
237 | OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered) | |
238 | priority:0,tunnel:0,in_port:0000,tci(0) mac(10:11:11:11:11:11->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
239 | ]) | |
240 | ||
241 | dnl Modified controller action. | |
54834960 | 242 | AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log]) |
15056dc8 EJ |
243 | |
244 | for i in 1 2 3 ; do | |
245 | 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)' | |
246 | done | |
247 | ||
248 | OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) | |
249 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
250 | OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) | |
251 | priority:0,tunnel:0,in_port:0000,tci(vlan:15,pcp:0) mac(30:33:33:33:33:33->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
252 | dnl | |
253 | OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) | |
254 | priority:0,tunnel:0,in_port:0000,tci(vlan:15,pcp:0) mac(30:33:33:33:33:33->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
255 | dnl | |
256 | OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered) | |
257 | priority:0,tunnel:0,in_port:0000,tci(vlan:15,pcp:0) mac(30:33:33:33:33:33->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->10) tcp_csum:0 | |
258 | ]) | |
259 | ||
260 | dnl Checksum TCP. | |
54834960 | 261 | AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log]) |
15056dc8 EJ |
262 | |
263 | for i in 1 ; do | |
264 | 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)' | |
265 | done | |
266 | ||
267 | OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) | |
268 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
54834960 | 269 | NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 tun_id=0x0 reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=60 (unbuffered) |
15056dc8 EJ |
270 | priority:0,tunnel:0,in_port:0000,tci(0) mac(20:22:22:22:22:22->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) tcp_csum:0 |
271 | dnl | |
54834960 | 272 | NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
273 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(20:22:22:22:22:22->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) tcp_csum:0 |
274 | dnl | |
54834960 | 275 | NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
276 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->50:54:00:00:00:07) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) tcp_csum:0 |
277 | dnl | |
54834960 | 278 | NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
279 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) tcp_csum:0 |
280 | dnl | |
54834960 | 281 | NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
282 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(83.83.83.83->192.168.0.2) port(8->11) tcp_csum:1a03 |
283 | dnl | |
54834960 | 284 | NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
285 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(8->11) tcp_csum:3205 |
286 | dnl | |
54834960 | 287 | NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
288 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->11) tcp_csum:31b8 |
289 | dnl | |
54834960 | 290 | NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
291 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->86) tcp_csum:316d |
292 | dnl | |
54834960 | 293 | NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
294 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:6 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->86) tcp_csum:316d |
295 | ]) | |
296 | ||
297 | dnl Checksum UDP. | |
298 | AT_CHECK([ovs-ofctl monitor br0 65534 --detach --pidfile 2> ofctl_monitor.log]) | |
299 | ||
300 | for i in 1 ; do | |
301 | 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' | |
302 | done | |
303 | ||
304 | OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit]) | |
305 | AT_CHECK([cat ofctl_monitor.log], [0], [dnl | |
54834960 | 306 | NXT_PACKET_IN (xid=0x0): cookie=0x1 total_len=60 in_port=1 tun_id=0x0 reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=60 (unbuffered) |
15056dc8 EJ |
307 | priority:0,tunnel:0,in_port:0000,tci(0) mac(20:22:22:22:22:22->50:54:00:00:00:07) type:0800 proto:17 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) udp_csum:1234 |
308 | dnl | |
54834960 | 309 | NXT_PACKET_IN (xid=0x0): table_id=1 cookie=0x3 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
310 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(20:22:22:22:22:22->50:54:00:00:00:07) type:0800 proto:17 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) udp_csum:1234 |
311 | dnl | |
54834960 | 312 | NXT_PACKET_IN (xid=0x0): table_id=2 cookie=0x4 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x0 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
313 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->50:54:00:00:00:07) type:0800 proto:17 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) udp_csum:1234 |
314 | dnl | |
54834960 | 315 | NXT_PACKET_IN (xid=0x0): table_id=3 cookie=0x5 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x0 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
316 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(192.168.0.1->192.168.0.2) port(8->11) udp_csum:1234 |
317 | dnl | |
54834960 | 318 | NXT_PACKET_IN (xid=0x0): table_id=4 cookie=0x6 total_len=64 in_port=1 tun_id=0x0 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x0 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
319 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(83.83.83.83->192.168.0.2) port(8->11) udp_csum:2c37 |
320 | dnl | |
54834960 | 321 | NXT_PACKET_IN (xid=0x0): table_id=5 cookie=0x7 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
322 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(8->11) udp_csum:4439 |
323 | dnl | |
54834960 | 324 | NXT_PACKET_IN (xid=0x0): table_id=6 cookie=0x8 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
325 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->11) udp_csum:43ec |
326 | dnl | |
54834960 | 327 | NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
328 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->86) udp_csum:43a1 |
329 | dnl | |
54834960 | 330 | NXT_PACKET_IN (xid=0x0): table_id=7 cookie=0x9 total_len=64 in_port=1 tun_id=0x6 reg0=0x1 reg1=0x2 reg2=0x3 reg3=0x4 reg4=0x5 (via action) data_len=64 (unbuffered) |
15056dc8 EJ |
331 | priority:0,tunnel:0,in_port:0000,tci(vlan:80,pcp:0) mac(80:81:81:81:81:81->82:82:82:82:82:82) type:0800 proto:17 tos:0 ttl:0 ip(83.83.83.83->84.84.84.84) port(85->86) udp_csum:43a1 |
332 | ]) | |
333 | ||
334 | AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_DURATION | sort], [0], [dnl | |
999fba59 | 335 | cookie=0x0, duration=?s, table=0, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535 |
54834960 | 336 | cookie=0x1, duration=?s, table=0, n_packets=2, n_bytes=120, dl_src=20:22:22:22:22:22 actions=CONTROLLER:65535,resubmit(80,1) |
999fba59 | 337 | cookie=0x2, duration=?s, table=0, n_packets=3, n_bytes=180, dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,CONTROLLER:65535 |
54834960 EJ |
338 | cookie=0x3, duration=?s, table=1, n_packets=2, n_bytes=120, in_port=80 actions=load:0x1->NXM_NX_REG0[[]],mod_vlan_vid:80,CONTROLLER:65535,resubmit(81,2) |
339 | cookie=0x4, duration=?s, table=2, n_packets=2, n_bytes=120, in_port=81 actions=load:0x2->NXM_NX_REG1[[]],mod_dl_src:80:81:81:81:81:81,CONTROLLER:65535,resubmit(82,3) | |
340 | cookie=0x5, duration=?s, table=3, n_packets=2, n_bytes=120, in_port=82 actions=load:0x3->NXM_NX_REG2[[]],mod_dl_dst:82:82:82:82:82:82,CONTROLLER:65535,resubmit(83,4) | |
341 | cookie=0x6, duration=?s, table=4, n_packets=2, n_bytes=120, in_port=83 actions=load:0x4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,CONTROLLER:65535,resubmit(84,5) | |
342 | cookie=0x7, duration=?s, table=5, n_packets=2, n_bytes=120, 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) | |
343 | cookie=0x8, duration=?s, table=6, n_packets=2, n_bytes=120, in_port=85 actions=mod_tp_src:85,CONTROLLER:65535,resubmit(86,7) | |
344 | cookie=0x9, duration=?s, table=7, n_packets=2, n_bytes=120, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535 | |
15056dc8 EJ |
345 | NXST_FLOW reply (xid=0x4): |
346 | ]) | |
347 | ||
348 | OVS_VSWITCHD_STOP | |
8e9ce036 | 349 | AT_CLEANUP |
04c956fc | 350 | |
ecac4ebf | 351 | AT_SETUP([ofproto-dpif - VLAN handling]) |
04c956fc | 352 | OVS_VSWITCHD_START( |
023e1e0a BP |
353 | [set Bridge br0 fail-mode=standalone -- \ |
354 | add-port br0 p1 trunks=10,12 -- \ | |
ecac4ebf | 355 | add-port br0 p2 tag=10 -- \ |
5e9ceccd BP |
356 | add-port br0 p3 tag=12 \ |
357 | other-config:priority-tags=true -- \ | |
ecac4ebf BP |
358 | add-port br0 p4 tag=12 -- \ |
359 | add-port br0 p5 vlan_mode=native-tagged tag=10 -- \ | |
360 | add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \ | |
361 | add-port br0 p7 vlan_mode=native-untagged tag=12 -- \ | |
5e9ceccd BP |
362 | add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \ |
363 | other-config:priority-tags=true -- \ | |
ecac4ebf BP |
364 | set Interface p1 type=dummy -- \ |
365 | set Interface p2 type=dummy -- \ | |
366 | set Interface p3 type=dummy -- \ | |
367 | set Interface p4 type=dummy -- \ | |
368 | set Interface p5 type=dummy -- \ | |
369 | set Interface p6 type=dummy -- \ | |
370 | set Interface p7 type=dummy -- \ | |
371 | set Interface p8 type=dummy --]) | |
04c956fc | 372 | |
247527db BP |
373 | dnl Each of these specifies an in_port by number, a VLAN VID (or "none"), |
374 | dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath | |
ecac4ebf | 375 | dnl actions. |
04c956fc | 376 | for tuple in \ |
247527db BP |
377 | "0 none 0 drop" \ |
378 | "0 0 0 drop" \ | |
379 | "0 0 1 drop" \ | |
380 | "0 10 0 1,5,6,7,8,pop_vlan,2" \ | |
381 | "0 10 1 1,5,6,7,8,pop_vlan,2" \ | |
382 | "0 11 0 5,7" \ | |
383 | "0 11 1 5,7" \ | |
384 | "0 12 0 1,5,6,pop_vlan,3,4,7,8" \ | |
385 | "0 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \ | |
386 | "1 none 0 drop" \ | |
387 | "1 0 0 drop" \ | |
388 | "1 0 1 drop" \ | |
389 | "1 10 0 0,5,6,7,8,pop_vlan,2" \ | |
390 | "1 10 1 0,5,6,7,8,pop_vlan,2" \ | |
391 | "1 11 0 drop" \ | |
392 | "1 11 1 drop" \ | |
393 | "1 12 0 0,5,6,pop_vlan,3,4,7,8" \ | |
394 | "1 12 1 0,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \ | |
395 | "2 none 0 push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \ | |
396 | "2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \ | |
397 | "2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),0,1,5,6,7,8" \ | |
398 | "2 10 0 drop" \ | |
399 | "2 10 1 drop" \ | |
400 | "2 11 0 drop" \ | |
401 | "2 11 1 drop" \ | |
402 | "2 12 0 drop" \ | |
403 | "2 12 1 drop" \ | |
404 | "3 none 0 4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
405 | "3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
406 | "3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \ | |
407 | "3 10 0 drop" \ | |
408 | "3 10 1 drop" \ | |
409 | "3 11 0 drop" \ | |
410 | "3 11 1 drop" \ | |
411 | "3 12 0 drop" \ | |
412 | "3 12 1 drop" \ | |
413 | "4 none 0 3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
414 | "4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
415 | "4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),0,1,5,6" \ | |
416 | "4 10 0 drop" \ | |
417 | "4 10 1 drop" \ | |
418 | "4 11 0 drop" \ | |
419 | "4 11 1 drop" \ | |
420 | "4 12 0 drop" \ | |
421 | "4 12 1 drop" \ | |
422 | "5 none 0 2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \ | |
423 | "5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \ | |
424 | "5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,6,7,8" \ | |
425 | "5 10 0 0,1,6,7,8,pop_vlan,2" \ | |
426 | "5 10 1 0,1,6,7,8,pop_vlan,2" \ | |
427 | "5 11 0 0,7" \ | |
428 | "5 11 1 0,7" \ | |
429 | "5 12 0 0,1,6,pop_vlan,3,4,7,8" \ | |
430 | "5 12 1 0,1,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \ | |
431 | "6 none 0 2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \ | |
432 | "6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \ | |
433 | "6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,5,7,8" \ | |
434 | "6 10 0 0,1,5,7,8,pop_vlan,2" \ | |
435 | "6 10 1 0,1,5,7,8,pop_vlan,2" \ | |
436 | "6 11 0 drop" \ | |
437 | "6 11 1 drop" \ | |
438 | "6 12 0 0,1,5,pop_vlan,3,4,7,8" \ | |
439 | "6 12 1 0,1,5,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \ | |
440 | "7 none 0 3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
441 | "7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
442 | "7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),0,1,5,6" \ | |
443 | "7 10 0 0,1,5,6,8,pop_vlan,2" \ | |
444 | "7 10 1 0,1,5,6,8,pop_vlan,2" \ | |
445 | "7 11 0 0,5" \ | |
446 | "7 11 1 0,5" \ | |
447 | "7 12 0 0,1,5,6,pop_vlan,3,4,8" \ | |
448 | "7 12 1 0,1,5,6,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \ | |
449 | "8 none 0 3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
450 | "8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \ | |
451 | "8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \ | |
452 | "8 10 0 0,1,5,6,7,pop_vlan,2" \ | |
453 | "8 10 1 0,1,5,6,7,pop_vlan,2" \ | |
454 | "8 11 0 drop" \ | |
455 | "8 11 1 drop" \ | |
456 | "8 12 0 0,1,5,6,pop_vlan,3,4,7" \ | |
457 | "8 12 1 0,1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3" | |
04c956fc BP |
458 | do |
459 | set $tuple | |
460 | in_port=$1 | |
461 | vlan=$2 | |
ecac4ebf BP |
462 | pcp=$3 |
463 | expected=$4 | |
04c956fc BP |
464 | |
465 | if test $vlan = none; then | |
247527db | 466 | flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)" |
04c956fc | 467 | else |
247527db | 468 | 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 |
469 | fi |
470 | ||
395e68ce BP |
471 | echo "----------------------------------------------------------------------" |
472 | echo "in_port=$in_port vlan=$vlan pcp=$pcp" | |
473 | ||
ecac4ebf BP |
474 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
475 | actual=`tail -1 stdout | sed 's/Datapath actions: //'` | |
04c956fc | 476 | |
247527db | 477 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout]) |
becffb86 | 478 | mv stdout expout |
247527db | 479 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout]) |
04c956fc BP |
480 | done |
481 | ||
482 | OVS_VSWITCHD_STOP | |
483 | AT_CLEANUP | |
7257b535 BP |
484 | |
485 | AT_SETUP([ofproto-dpif - fragment handling]) | |
023e1e0a | 486 | OVS_VSWITCHD_START |
7257b535 BP |
487 | AT_DATA([flows.txt], [dnl |
488 | priority=75 tcp ip_frag=no tp_dst=80 actions=output:1 | |
489 | priority=75 tcp ip_frag=first tp_dst=80 actions=output:2 | |
490 | priority=75 tcp ip_frag=later tp_dst=80 actions=output:3 | |
491 | priority=50 tcp ip_frag=no actions=output:4 | |
492 | priority=50 tcp ip_frag=first actions=output:5 | |
493 | priority=50 tcp ip_frag=later actions=output:6 | |
494 | ]) | |
495 | AT_CHECK([ovs-ofctl replace-flows br0 flows.txt]) | |
496 | ||
a61680c6 | 497 | base_flow="in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=128" |
7257b535 BP |
498 | no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)" |
499 | first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)" | |
500 | later_flow="$base_flow,frag=later)" | |
501 | ||
502 | # mode no first later | |
503 | for tuple in \ | |
504 | 'normal 1 5 6' \ | |
505 | 'drop 1 drop drop' \ | |
506 | 'nx-match 1 2 6' | |
507 | do | |
508 | set $tuple | |
509 | mode=$1 | |
510 | no=$2 | |
511 | first=$3 | |
512 | later=$4 | |
513 | ||
514 | AT_CHECK([ovs-ofctl set-frags br0 $mode]) | |
515 | for type in no first later; do | |
516 | eval flow=\$${type}_flow exp_output=\$$type | |
023e1e0a | 517 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
7257b535 BP |
518 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $exp_output |
519 | ]) | |
520 | done | |
521 | done | |
023e1e0a | 522 | OVS_VSWITCHD_STOP |
7257b535 | 523 | AT_CLEANUP |
848e8809 EJ |
524 | |
525 | AT_SETUP([ofproto-dpif - exit]) | |
526 | OVS_VSWITCHD_START | |
527 | AT_DATA([flows.txt], [dnl | |
528 | in_port=1 actions=output:10,exit,output:11 | |
529 | in_port=2 actions=output:12,resubmit:1,output:12 | |
530 | in_port=3 actions=output:13,resubmit:2,output:14 | |
531 | ]) | |
532 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
a61680c6 | 533 | AT_CHECK([ovs-appctl ofproto/trace br0 '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 |
534 | AT_CHECK([tail -1 stdout], [0], |
535 | [Datapath actions: 10 | |
536 | ]) | |
a61680c6 | 537 | AT_CHECK([ovs-appctl ofproto/trace br0 '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 |
538 | AT_CHECK([tail -1 stdout], [0], |
539 | [Datapath actions: 12,10 | |
540 | ]) | |
a61680c6 | 541 | AT_CHECK([ovs-appctl ofproto/trace br0 '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 |
542 | AT_CHECK([tail -1 stdout], [0], |
543 | [Datapath actions: 13,12,10 | |
544 | ]) | |
545 | OVS_VSWITCHD_STOP | |
546 | AT_CLEANUP | |
c06bba01 JP |
547 | |
548 | ||
549 | AT_SETUP([ofproto-dpif - mirroring, select_all]) | |
9da5b93a BP |
550 | OVS_VSWITCHD_START( |
551 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
552 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
553 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
554 | set Bridge br0 mirrors=@m --\ | |
555 | --id=@p3 get Port p3 --\ | |
556 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 557 | select_all=true output_port=@p3], [<0> |
c06bba01 JP |
558 | ]) |
559 | ||
c06bba01 JP |
560 | AT_DATA([flows.txt], [dnl |
561 | in_port=1 actions=output:2 | |
562 | in_port=2 actions=output:1 | |
563 | ]) | |
564 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
565 | ||
247527db | 566 | 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)" |
c06bba01 JP |
567 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
568 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 569 | [Datapath actions: 2,3 |
c06bba01 JP |
570 | ]) |
571 | ||
247527db | 572 | flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" |
c06bba01 JP |
573 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
574 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 575 | [Datapath actions: 1,3 |
c06bba01 JP |
576 | ]) |
577 | ||
578 | OVS_VSWITCHD_STOP | |
579 | AT_CLEANUP | |
580 | ||
581 | ||
582 | AT_SETUP([ofproto-dpif - mirroring, select_src]) | |
9da5b93a BP |
583 | OVS_VSWITCHD_START( |
584 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
585 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
586 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
587 | set Bridge br0 mirrors=@m --\ | |
588 | --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\ | |
589 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 590 | select_src_port=@p1 output_port=@p3], [<0> |
c06bba01 JP |
591 | ]) |
592 | ||
c06bba01 JP |
593 | AT_DATA([flows.txt], [dnl |
594 | in_port=1 actions=output:2 | |
595 | in_port=2 actions=output:1 | |
596 | ]) | |
597 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
598 | ||
247527db | 599 | 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)" |
c06bba01 JP |
600 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
601 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 602 | [Datapath actions: 2,3 |
c06bba01 JP |
603 | ]) |
604 | ||
247527db | 605 | flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" |
c06bba01 JP |
606 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
607 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 608 | [Datapath actions: 1 |
c06bba01 JP |
609 | ]) |
610 | OVS_VSWITCHD_STOP | |
611 | AT_CLEANUP | |
612 | ||
33158a18 JP |
613 | AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port]) |
614 | OVS_VSWITCHD_START( | |
615 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
616 | add-port br0 p2 -- set Interface p2 type=dummy --\ | |
617 | set Bridge br0 mirrors=@m --\ | |
618 | --id=@p2 get Port p2 --\ | |
619 | --id=@m create Mirror name=mymirror \ | |
620 | select_all=true output_port=@p2], [<0> | |
621 | ]) | |
622 | ||
33158a18 JP |
623 | AT_CHECK([ovs-ofctl add-flow br0 action=output:1]) |
624 | ||
625 | # "in_port" defaults to OFPP_NONE if it's not specified. | |
626 | flow="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)" | |
627 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) | |
628 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 629 | [Datapath actions: 1,2 |
33158a18 JP |
630 | ]) |
631 | ||
632 | OVS_VSWITCHD_STOP | |
633 | AT_CLEANUP | |
634 | ||
c06bba01 JP |
635 | |
636 | AT_SETUP([ofproto-dpif - mirroring, select_dst]) | |
9da5b93a BP |
637 | OVS_VSWITCHD_START( |
638 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
639 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
640 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
641 | set Bridge br0 mirrors=@m --\ | |
642 | --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\ | |
643 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 644 | select_dst_port=@p2 output_port=@p3], [<0> |
c06bba01 JP |
645 | ]) |
646 | ||
c06bba01 JP |
647 | AT_DATA([flows.txt], [dnl |
648 | in_port=1 actions=output:2 | |
649 | in_port=2 actions=output:1 | |
650 | ]) | |
651 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
652 | ||
247527db | 653 | 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)" |
c06bba01 JP |
654 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
655 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 656 | [Datapath actions: 2,3 |
c06bba01 JP |
657 | ]) |
658 | ||
247527db | 659 | flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" |
c06bba01 JP |
660 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
661 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 662 | [Datapath actions: 1 |
c06bba01 JP |
663 | ]) |
664 | ||
665 | OVS_VSWITCHD_STOP | |
666 | AT_CLEANUP | |
667 | ||
668 | ||
669 | AT_SETUP([ofproto-dpif - mirroring, select_vlan]) | |
9da5b93a BP |
670 | OVS_VSWITCHD_START( |
671 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
672 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
673 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
674 | set Bridge br0 mirrors=@m --\ | |
675 | --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\ | |
676 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 677 | select_all=true select_vlan=11 output_port=@p3], [<0> |
c06bba01 JP |
678 | ]) |
679 | ||
c06bba01 JP |
680 | AT_DATA([flows.txt], [dnl |
681 | in_port=1, actions=output:2 | |
682 | ]) | |
683 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
684 | ||
247527db | 685 | 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)" |
c06bba01 JP |
686 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
687 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 688 | [Datapath actions: 2 |
c06bba01 JP |
689 | ]) |
690 | ||
247527db | 691 | flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=10,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))" |
c06bba01 JP |
692 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
693 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 694 | [Datapath actions: 2 |
c06bba01 JP |
695 | ]) |
696 | ||
247527db | 697 | flow="in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x8100),vlan(vid=11,pcp=0),encap(eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0))" |
c06bba01 JP |
698 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
699 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 700 | [Datapath actions: 2,3 |
c06bba01 JP |
701 | ]) |
702 | ||
703 | OVS_VSWITCHD_STOP | |
704 | AT_CLEANUP | |
705 | ||
706 | ||
707 | AT_SETUP([ofproto-dpif - mirroring, output_port]) | |
9da5b93a BP |
708 | OVS_VSWITCHD_START( |
709 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
710 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
711 | add-port br0 p3 -- set Interface p3 type=dummy --\ | |
712 | set Bridge br0 mirrors=@m --\ | |
713 | --id=@p3 get Port p3 --\ | |
714 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 715 | select_all=true output_port=@p3], [<0> |
c06bba01 JP |
716 | ]) |
717 | ||
c06bba01 JP |
718 | AT_DATA([flows.txt], [dnl |
719 | in_port=1 actions=mod_vlan_vid:17,output:2 | |
720 | in_port=2 actions=output:1 | |
721 | ]) | |
722 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
723 | ||
247527db | 724 | 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)" |
c06bba01 JP |
725 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
726 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 727 | [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3 |
c06bba01 JP |
728 | ]) |
729 | ||
247527db | 730 | flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" |
c06bba01 JP |
731 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
732 | AT_CHECK_UNQUOTED([tail -1 stdout], [0], | |
247527db | 733 | [Datapath actions: 1,3 |
c06bba01 JP |
734 | ]) |
735 | ||
736 | OVS_VSWITCHD_STOP | |
737 | AT_CLEANUP | |
738 | ||
c06bba01 | 739 | AT_SETUP([ofproto-dpif - mirroring, output_vlan]) |
9da5b93a BP |
740 | OVS_VSWITCHD_START( |
741 | [add-port br0 p1 -- set Interface p1 type=dummy --\ | |
c06bba01 JP |
742 | add-port br0 p2 -- set Interface p2 type=dummy --\ |
743 | set Bridge br0 mirrors=@m --\ | |
744 | --id=@m create Mirror name=mymirror \ | |
9da5b93a | 745 | select_all=true output_vlan=12], [<0> |
c06bba01 JP |
746 | ]) |
747 | ||
c06bba01 JP |
748 | AT_DATA([flows.txt], [dnl |
749 | in_port=1 actions=output:2 | |
750 | in_port=2 actions=mod_vlan_vid:17,output:1 | |
751 | ]) | |
752 | AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) | |
753 | ||
247527db | 754 | 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)" |
c06bba01 JP |
755 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
756 | actual=`tail -1 stdout | sed 's/Datapath actions: //'` | |
757 | ||
247527db BP |
758 | expected="2,push_vlan(vid=12,pcp=0),0,1,2" |
759 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout]) | |
c06bba01 | 760 | mv stdout expout |
247527db | 761 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout]) |
c06bba01 | 762 | |
247527db | 763 | flow="in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" |
c06bba01 JP |
764 | AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout]) |
765 | actual=`tail -1 stdout | sed 's/Datapath actions: //'` | |
766 | ||
247527db BP |
767 | expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),0,1,2" |
768 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout]) | |
c06bba01 | 769 | mv stdout expout |
247527db | 770 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout]) |
c06bba01 JP |
771 | |
772 | OVS_VSWITCHD_STOP | |
773 | AT_CLEANUP | |
b44a10b7 BP |
774 | |
775 | m4_define([OFPROTO_TRACE], | |
776 | [flow="$2" | |
777 | AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout]) | |
778 | actual=`tail -1 stdout | sed 's/Datapath actions: //'` | |
779 | expected="$4" | |
780 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5], | |
781 | [0], [stdout]) | |
782 | mv stdout expout | |
783 | AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5], | |
784 | [0], [expout])]) | |
785 | ||
786 | AT_SETUP([ofproto-dpif - MAC learning]) | |
787 | OVS_VSWITCHD_START( | |
788 | [set bridge br0 fail-mode=standalone -- \ | |
789 | add-port br0 p1 -- set Interface p1 type=dummy -- \ | |
790 | add-port br0 p2 -- set Interface p2 type=dummy -- \ | |
791 | add-port br0 p3 -- set Interface p3 type=dummy]) | |
792 | ||
b44a10b7 BP |
793 | arp='eth_type(0x0806),arp(sip=192.168.0.1,tip=192.168.0.2,op=1,sha=50:54:00:00:00:05,tha=00:00:00:00:00:00)' |
794 | ||
795 | # Trace an ARP packet arriving on p3, to create a MAC learning entry. | |
796 | OFPROTO_TRACE( | |
797 | [br0], | |
247527db | 798 | [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp], |
b44a10b7 | 799 | [-generate], |
247527db | 800 | [0,1,2]) |
b44a10b7 BP |
801 | |
802 | # Check for the MAC learning entry. | |
803 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
804 | port VLAN MAC Age | |
247527db | 805 | 3 0 50:54:00:00:00:05 ? |
b44a10b7 BP |
806 | ]) |
807 | ||
808 | # Trace a packet arrival destined for the learned MAC. | |
809 | # (This will also learn a MAC.) | |
810 | OFPROTO_TRACE( | |
811 | [br0], | |
247527db | 812 | [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp], |
b44a10b7 | 813 | [-generate], |
247527db | 814 | [3]) |
b44a10b7 BP |
815 | |
816 | # Check for both MAC learning entries. | |
817 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
818 | port VLAN MAC Age | |
247527db BP |
819 | 3 0 50:54:00:00:00:05 ? |
820 | 1 0 50:54:00:00:00:06 ? | |
b44a10b7 BP |
821 | ]) |
822 | ||
823 | # Trace a packet arrival that updates the first learned MAC entry. | |
824 | OFPROTO_TRACE( | |
825 | [br0], | |
247527db | 826 | [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp], |
b44a10b7 | 827 | [-generate], |
247527db | 828 | [0,1,3]) |
b44a10b7 BP |
829 | |
830 | # Check that the MAC learning entry was updated. | |
831 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
832 | port VLAN MAC Age | |
247527db BP |
833 | 1 0 50:54:00:00:00:06 ? |
834 | 2 0 50:54:00:00:00:05 ? | |
b44a10b7 BP |
835 | ]) |
836 | ||
837 | # Add another bridge. | |
838 | AT_CHECK( | |
839 | [ovs-vsctl \ | |
840 | -- add-br br1 \ | |
841 | -- set bridge br1 datapath-type=dummy \ | |
842 | -- add-port br1 p4 -- set interface p4 type=dummy \ | |
843 | -- add-port br1 p5 -- set interface p5 type=dummy]) | |
b44a10b7 BP |
844 | |
845 | # Trace some packet arrivals in br1 to create MAC learning entries there too. | |
846 | OFPROTO_TRACE( | |
847 | [br1], | |
247527db | 848 | [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp], |
b44a10b7 | 849 | [-generate], |
247527db | 850 | [0,5]) |
b44a10b7 BP |
851 | OFPROTO_TRACE( |
852 | [br1], | |
247527db | 853 | [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp], |
b44a10b7 | 854 | [-generate], |
247527db | 855 | [0,4]) |
b44a10b7 BP |
856 | |
857 | # Check that the MAC learning entries were added. | |
858 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
859 | port VLAN MAC Age | |
247527db BP |
860 | 4 0 50:54:00:00:00:06 ? |
861 | 5 0 50:54:00:00:00:07 ? | |
b44a10b7 BP |
862 | ]) |
863 | ||
864 | # Delete port p1 and see that its MAC learning entry disappeared, and | |
865 | # that the MAC learning entry for the same MAC was also deleted from br1. | |
866 | AT_CHECK([ovs-vsctl del-port p1]) | |
867 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
868 | port VLAN MAC Age | |
247527db | 869 | 2 0 50:54:00:00:00:05 ? |
b44a10b7 BP |
870 | ]) |
871 | AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]$/?/'], [0], [dnl | |
872 | port VLAN MAC Age | |
247527db | 873 | 5 0 50:54:00:00:00:07 ? |
b44a10b7 BP |
874 | ]) |
875 | ||
876 | OVS_VSWITCHD_STOP | |
877 | AT_CLEANUP | |
17f7f7e0 BP |
878 | |
879 | dnl Test that basic NetFlow reports flow statistics correctly: | |
880 | dnl - The initial packet of a flow are correctly accounted. | |
881 | dnl - Later packets within a flow are correctly accounted. | |
882 | dnl - Flow actions changing (in this case, due to MAC learning) | |
883 | dnl cause a record to be sent. | |
884 | AT_SETUP([ofproto-dpif - NetFlow flow expiration]) | |
885 | ||
886 | AT_SKIP_IF([test "x$RANDOM" = x]) | |
887 | NETFLOW_PORT=`expr 32767 + \( $RANDOM % 32767 \)` | |
888 | ||
889 | OVS_VSWITCHD_START( | |
890 | [set Bridge br0 fail-mode=standalone -- \ | |
891 | add-port br0 p1 -- set Interface p1 type=dummy -- \ | |
892 | add-port br0 p2 -- set Interface p2 type=dummy -- \ | |
893 | set Bridge br0 netflow=@nf -- \ | |
894 | --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \ | |
895 | engine_id=1 engine_type=2 active_timeout=30 \ | |
896 | add-id-to-interface=false], [<0> | |
897 | ]) | |
898 | ||
899 | AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) | |
900 | ||
901 | for delay in 1000 30000; do | |
902 | 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)' | |
903 | 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)' | |
904 | ||
905 | ovs-appctl time/warp $delay | |
906 | done | |
907 | ||
908 | OVS_VSWITCHD_STOP | |
909 | ovs-appctl -t test-netflow exit | |
910 | ||
911 | AT_CHECK([[sed -e 's/, uptime [0-9]*// | |
912 | s/, now [0-9.]*// | |
c4dba11a | 913 | s/time \([0-9]*\)\.\.\.\1\b/time <moment>/ |
17f7f7e0 BP |
914 | s/time [0-9]*\.\.\.[0-9]*/time <range>/ |
915 | ' netflow.log]], [0], | |
916 | [header: v5, seq 0, engine 2,1 | |
917 | rec: 192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes, ICMP 8:0, time <moment> | |
918 | ||
919 | header: v5, seq 1, engine 2,1 | |
920 | rec: 192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0, time <range> | |
921 | rec: 192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 60 bytes, ICMP 8:0, time <moment> | |
922 | ]) | |
923 | AT_CLEANUP | |
924 | ||
925 | dnl Test that basic NetFlow reports active expirations correctly. | |
926 | AT_SETUP([ofproto-dpif - NetFlow active expiration]) | |
927 | ||
928 | AT_SKIP_IF([test "x$RANDOM" = x]) | |
929 | NETFLOW_PORT=`expr 32767 + \( $RANDOM % 32767 \)` | |
930 | ||
931 | OVS_VSWITCHD_START( | |
932 | [set Bridge br0 fail-mode=standalone -- \ | |
933 | add-port br0 p1 -- set Interface p1 type=dummy -- \ | |
934 | add-port br0 p2 -- set Interface p2 type=dummy -- \ | |
935 | set Bridge br0 netflow=@nf -- \ | |
936 | --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \ | |
937 | engine_id=1 engine_type=2 active_timeout=10 \ | |
938 | add-id-to-interface=false], [<0> | |
939 | ]) | |
940 | ||
941 | AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log]) | |
942 | ||
943 | n=1 | |
944 | while test $n -le 60; do | |
945 | n=`expr $n + 1` | |
946 | ||
947 | 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)' | |
948 | 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)' | |
949 | ||
950 | ovs-appctl time/warp 1000 | |
951 | done | |
952 | ||
953 | ovs-appctl time/warp 10000 | |
954 | ||
955 | OVS_VSWITCHD_STOP | |
956 | ovs-appctl -t test-netflow exit | |
957 | ||
958 | # Count the number of reported packets: | |
959 | # - From source to destination before MAC learning kicks in (just one). | |
960 | # - From source to destination after that. | |
961 | # - From destination to source. | |
962 | n_learn=0 | |
963 | n_in=0 | |
964 | n_out=0 | |
965 | n_other=0 | |
966 | n_recs=0 | |
967 | none=0 | |
968 | while read line; do | |
969 | pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'` | |
970 | case $pkts in | |
971 | [[0-9]]*) ;; | |
972 | *) continue ;; | |
973 | esac | |
974 | ||
975 | case $line in | |
976 | "rec: 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*) | |
977 | counter=n_learn | |
978 | ;; | |
979 | "rec: 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*) | |
980 | counter=n_in | |
981 | ;; | |
982 | "rec: 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*) | |
983 | counter=n_out | |
984 | ;; | |
985 | *) | |
986 | counter=n_other | |
987 | ;; | |
988 | esac | |
989 | eval $counter=\`expr \$$counter + \$pkts\` | |
990 | n_recs=`expr $n_recs + 1` | |
991 | done < netflow.log | |
992 | ||
993 | # There should be exactly 1 MAC learning packet, | |
994 | # exactly 59 other packets in that direction, | |
995 | # and exactly 60 packets in the other direction. | |
996 | AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0 | |
997 | ]) | |
998 | ||
999 | # There should be 1 expiration for MAC learning, | |
1000 | # at least 5 active and a final expiration in one direction, | |
1001 | # and at least 5 active and a final expiration in the other direction. | |
1002 | echo $n_recs | |
1003 | AT_CHECK([test $n_recs -ge 13]) | |
1004 | ||
1005 | AT_CLEANUP |