1 AT_BANNER([ofproto-dpif])
3 AT_SETUP([ofproto-dpif - resubmit])
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)
13 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
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])
15 AT_CHECK([tail -1 stdout], [0],
16 [Datapath actions: 10,11,12,13,14,15,16,17,18,19,20,21
21 AT_SETUP([ofproto-dpif - registers])
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
38 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
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])
40 AT_CHECK([tail -1 stdout], [0],
41 [Datapath actions: 20,21,22
46 AT_SETUP([ofproto-dpif - output])
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[[]]
57 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
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])
59 AT_CHECK([tail -1 stdout], [0],
60 [Datapath actions: 9,55,10,55,66,11,77,88
65 AT_SETUP([ofproto-dpif - output, OFPP_NONE ingress port])
67 [add-port br0 p1 -- set Interface p1 type=dummy --\
68 add-port br0 p2 -- set Interface p2 type=dummy])
70 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
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: //'`
78 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
80 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
85 AT_SETUP([ofproto-dpif - DSCP])
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
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
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
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
111 AT_SETUP([ofproto-dpif - output/flood flags])
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 ])
121 AT_DATA([flows.txt], [dnl
122 in_port=local actions=local,flood
123 in_port=1 actions=flood
124 in_port=2 actions=all
125 in_port=3 actions=output:65534,output:1,output:2,output:3,output:4,output:5,output:6,output:7
126 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
128 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
129 AT_CHECK([ovs-ofctl mod-port br0 5 noforward])
130 AT_CHECK([ovs-ofctl mod-port br0 6 noflood])
132 AT_CHECK([ovs-appctl ofproto/trace br0 'in_port(0),eth(src=00:00:00:00:00:01,dst=00:00:00:00:00:02),eth_type(0x0900)'], [0], [stdout])
133 AT_CHECK([tail -1 stdout \
134 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
142 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])
143 AT_CHECK([tail -1 stdout \
144 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
152 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])
153 AT_CHECK([tail -1 stdout \
154 | sed -e 's/Datapath actions: //' | tr ',' '\n' | sort], [0], [dnl
163 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])
164 AT_CHECK([tail -1 stdout], [0],
165 [Datapath actions: 0,1,2,4,6,7
168 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])
169 AT_CHECK([tail -1 stdout], [0],
170 [Datapath actions: set(priority(1)),0,1,2,set(priority(2)),3,set(priority(1)),6,7
175 AT_SETUP([ofproto-dpif - set_tunnel])
177 AT_DATA([flows.txt], [dnl
178 in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
179 in_port=1 actions=set_tunnel:1,output:1
180 in_port=2 actions=set_tunnel:1,output:2
181 in_port=3 actions=set_tunnel:2,set_tunnel:3,output:3
182 in_port=4 actions=set_tunnel:4,set_tunnel:3,output:4
183 in_port=5 actions=set_tunnel:5
185 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
186 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])
187 AT_CHECK([tail -1 stdout], [0],
188 [Datapath actions: set(tun_id(0x1)),1,2,set(tun_id(0x3)),3,4
193 AT_SETUP([ofproto-dpif - controller])
194 OVS_VSWITCHD_START([dnl
195 add-port br0 p1 -- set Interface p1 type=dummy
198 AT_CAPTURE_FILE([ofctl_monitor.log])
199 AT_DATA([flows.txt], [dnl
200 cookie=0x0 dl_src=10:11:11:11:11:11 actions=controller
201 cookie=0x1 dl_src=20:22:22:22:22:22 actions=controller,resubmit(80,1)
202 cookie=0x2 dl_src=30:33:33:33:33:33 actions=mod_vlan_vid:15,controller
204 cookie=0x3 table=1 in_port=80 actions=load:1->NXM_NX_REG0[[]],mod_vlan_vid:80,controller,resubmit(81,2)
205 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)
206 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)
207 cookie=0x6 table=4 in_port=83 actions=load:4->NXM_NX_REG3[[]],mod_nw_src:83.83.83.83,controller,resubmit(84,5)
208 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)
209 cookie=0x8 table=6 in_port=85 actions=mod_tp_src:85,controller,resubmit(86,7)
210 cookie=0x9 table=7 in_port=86 actions=mod_tp_dst:86,controller,controller
212 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
215 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log])
218 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)'
221 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
222 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
223 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered)
224 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
226 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered)
227 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
229 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 data_len=60 (unbuffered)
230 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
233 dnl Singleton controller action.
234 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log])
237 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)'
240 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
241 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
242 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
243 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
245 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
246 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
248 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=1 (via action) data_len=60 (unbuffered)
249 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
252 dnl Modified controller action.
253 AT_CHECK([ovs-ofctl monitor -P openflow10 br0 65534 --detach --pidfile 2> ofctl_monitor.log])
256 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)'
259 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
260 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
261 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
262 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
264 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
265 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
267 OFPT_PACKET_IN (xid=0x0): total_len=64 in_port=1 (via action) data_len=64 (unbuffered)
268 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
272 AT_CHECK([ovs-ofctl monitor br0 65534 -P nxm --detach --pidfile 2> ofctl_monitor.log])
275 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)'
278 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
279 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
280 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)
281 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
283 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)
284 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
286 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)
287 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
289 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)
290 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
292 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)
293 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
295 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)
296 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
298 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)
299 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
301 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)
302 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
304 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)
305 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
309 AT_CHECK([ovs-ofctl monitor br0 65534 --detach --pidfile 2> ofctl_monitor.log])
312 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'
315 OVS_WAIT_UNTIL([ovs-appctl -t ovs-ofctl exit])
316 AT_CHECK([cat ofctl_monitor.log], [0], [dnl
317 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)
318 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
320 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)
321 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
323 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)
324 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
326 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)
327 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
329 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)
330 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
332 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)
333 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
335 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)
336 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
338 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)
339 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
341 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)
342 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
345 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_DURATION | sort], [0], [dnl
346 cookie=0x0, duration=?s, table=0, n_packets=3, n_bytes=180, dl_src=10:11:11:11:11:11 actions=CONTROLLER:65535
347 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)
348 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
349 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)
350 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)
351 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)
352 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)
353 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)
354 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)
355 cookie=0x9, duration=?s, table=7, n_packets=2, n_bytes=120, in_port=86 actions=mod_tp_dst:86,CONTROLLER:65535,CONTROLLER:65535
356 NXST_FLOW reply (xid=0x4):
362 AT_SETUP([ofproto-dpif - VLAN handling])
364 [set Bridge br0 fail-mode=standalone -- \
365 add-port br0 p1 trunks=10,12 -- \
366 add-port br0 p2 tag=10 -- \
367 add-port br0 p3 tag=12 \
368 other-config:priority-tags=true -- \
369 add-port br0 p4 tag=12 -- \
370 add-port br0 p5 vlan_mode=native-tagged tag=10 -- \
371 add-port br0 p6 vlan_mode=native-tagged tag=10 trunks=10,12 -- \
372 add-port br0 p7 vlan_mode=native-untagged tag=12 -- \
373 add-port br0 p8 vlan_mode=native-untagged tag=12 trunks=10,12 \
374 other-config:priority-tags=true -- \
375 set Interface p1 type=dummy -- \
376 set Interface p2 type=dummy -- \
377 set Interface p3 type=dummy -- \
378 set Interface p4 type=dummy -- \
379 set Interface p5 type=dummy -- \
380 set Interface p6 type=dummy -- \
381 set Interface p7 type=dummy -- \
382 set Interface p8 type=dummy --])
384 dnl Each of these specifies an in_port by number, a VLAN VID (or "none"),
385 dnl a VLAN PCP (used if the VID isn't "none") and the expected set of datapath
391 "0 10 0 1,5,6,7,8,pop_vlan,2" \
392 "0 10 1 1,5,6,7,8,pop_vlan,2" \
395 "0 12 0 1,5,6,pop_vlan,3,4,7,8" \
396 "0 12 1 1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
400 "1 10 0 0,5,6,7,8,pop_vlan,2" \
401 "1 10 1 0,5,6,7,8,pop_vlan,2" \
404 "1 12 0 0,5,6,pop_vlan,3,4,7,8" \
405 "1 12 1 0,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
406 "2 none 0 push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \
407 "2 0 0 pop_vlan,push_vlan(vid=10,pcp=0),0,1,5,6,7,8" \
408 "2 0 1 pop_vlan,push_vlan(vid=10,pcp=1),0,1,5,6,7,8" \
415 "3 none 0 4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
416 "3 0 0 pop_vlan,4,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
417 "3 0 1 8,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
424 "4 none 0 3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
425 "4 0 0 pop_vlan,3,7,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
426 "4 0 1 3,8,pop_vlan,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
433 "5 none 0 2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \
434 "5 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,6,7,8" \
435 "5 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,6,7,8" \
436 "5 10 0 0,1,6,7,8,pop_vlan,2" \
437 "5 10 1 0,1,6,7,8,pop_vlan,2" \
440 "5 12 0 0,1,6,pop_vlan,3,4,7,8" \
441 "5 12 1 0,1,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
442 "6 none 0 2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \
443 "6 0 0 pop_vlan,2,push_vlan(vid=10,pcp=0),0,1,5,7,8" \
444 "6 0 1 pop_vlan,2,push_vlan(vid=10,pcp=1),0,1,5,7,8" \
445 "6 10 0 0,1,5,7,8,pop_vlan,2" \
446 "6 10 1 0,1,5,7,8,pop_vlan,2" \
449 "6 12 0 0,1,5,pop_vlan,3,4,7,8" \
450 "6 12 1 0,1,5,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3,8" \
451 "7 none 0 3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
452 "7 0 0 pop_vlan,3,4,8,push_vlan(vid=12,pcp=0),0,1,5,6" \
453 "7 0 1 3,8,pop_vlan,4,push_vlan(vid=12,pcp=1),0,1,5,6" \
454 "7 10 0 0,1,5,6,8,pop_vlan,2" \
455 "7 10 1 0,1,5,6,8,pop_vlan,2" \
458 "7 12 0 0,1,5,6,pop_vlan,3,4,8" \
459 "7 12 1 0,1,5,6,pop_vlan,4,push_vlan(vid=0,pcp=1),3,8" \
460 "8 none 0 3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \
461 "8 0 0 pop_vlan,3,4,7,push_vlan(vid=12,pcp=0),0,1,5,6" \
462 "8 0 1 3,pop_vlan,4,7,push_vlan(vid=12,pcp=1),0,1,5,6" \
463 "8 10 0 0,1,5,6,7,pop_vlan,2" \
464 "8 10 1 0,1,5,6,7,pop_vlan,2" \
467 "8 12 0 0,1,5,6,pop_vlan,3,4,7" \
468 "8 12 1 0,1,5,6,pop_vlan,4,7,push_vlan(vid=0,pcp=1),3"
476 if test $vlan = none; then
477 flow="in_port($in_port),eth(src=50:54:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0xabcd)"
479 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))"
482 echo "----------------------------------------------------------------------"
483 echo "in_port=$in_port vlan=$vlan pcp=$pcp"
485 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
486 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
488 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
490 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
496 AT_SETUP([ofproto-dpif - fragment handling])
498 AT_DATA([flows.txt], [dnl
499 priority=75 tcp ip_frag=no tp_dst=80 actions=output:1
500 priority=75 tcp ip_frag=first tp_dst=80 actions=output:2
501 priority=75 tcp ip_frag=later tp_dst=80 actions=output:3
502 priority=50 tcp ip_frag=no actions=output:4
503 priority=50 tcp ip_frag=first actions=output:5
504 priority=50 tcp ip_frag=later actions=output:6
506 AT_CHECK([ovs-ofctl replace-flows br0 flows.txt])
508 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"
509 no_flow="$base_flow,frag=no),tcp(src=12345,dst=80)"
510 first_flow="$base_flow,frag=first),tcp(src=12345,dst=80)"
511 later_flow="$base_flow,frag=later)"
513 # mode no first later
525 AT_CHECK([ovs-ofctl set-frags br0 $mode])
526 for type in no first later; do
527 eval flow=\$${type}_flow exp_output=\$$type
528 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
529 AT_CHECK_UNQUOTED([tail -1 stdout], [0], [Datapath actions: $exp_output
536 AT_SETUP([ofproto-dpif - exit])
538 AT_DATA([flows.txt], [dnl
539 in_port=1 actions=output:10,exit,output:11
540 in_port=2 actions=output:12,resubmit:1,output:12
541 in_port=3 actions=output:13,resubmit:2,output:14
543 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
544 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])
545 AT_CHECK([tail -1 stdout], [0],
546 [Datapath actions: 10
548 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])
549 AT_CHECK([tail -1 stdout], [0],
550 [Datapath actions: 12,10
552 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])
553 AT_CHECK([tail -1 stdout], [0],
554 [Datapath actions: 13,12,10
560 AT_SETUP([ofproto-dpif - mirroring, select_all])
562 [add-port br0 p1 -- set Interface p1 type=dummy --\
563 add-port br0 p2 -- set Interface p2 type=dummy --\
564 add-port br0 p3 -- set Interface p3 type=dummy --\
565 set Bridge br0 mirrors=@m --\
566 --id=@p3 get Port p3 --\
567 --id=@m create Mirror name=mymirror \
568 select_all=true output_port=@p3], [<0>
571 AT_DATA([flows.txt], [dnl
572 in_port=1 actions=output:2
573 in_port=2 actions=output:1
575 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
577 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)"
578 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
579 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
580 [Datapath actions: 2,3
583 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)"
584 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
585 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
586 [Datapath actions: 1,3
593 AT_SETUP([ofproto-dpif - mirroring, select_src])
595 [add-port br0 p1 -- set Interface p1 type=dummy --\
596 add-port br0 p2 -- set Interface p2 type=dummy --\
597 add-port br0 p3 -- set Interface p3 type=dummy --\
598 set Bridge br0 mirrors=@m --\
599 --id=@p1 get Port p1 -- --id=@p3 get Port p3 --\
600 --id=@m create Mirror name=mymirror \
601 select_src_port=@p1 output_port=@p3], [<0>
604 AT_DATA([flows.txt], [dnl
605 in_port=1 actions=output:2
606 in_port=2 actions=output:1
608 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
610 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)"
611 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
612 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
613 [Datapath actions: 2,3
616 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)"
617 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
618 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
624 AT_SETUP([ofproto-dpif - mirroring, OFPP_NONE ingress port])
626 [add-port br0 p1 -- set Interface p1 type=dummy --\
627 add-port br0 p2 -- set Interface p2 type=dummy --\
628 set Bridge br0 mirrors=@m --\
629 --id=@p2 get Port p2 --\
630 --id=@m create Mirror name=mymirror \
631 select_all=true output_port=@p2], [<0>
634 AT_CHECK([ovs-ofctl add-flow br0 action=output:1])
636 # "in_port" defaults to OFPP_NONE if it's not specified.
637 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)"
638 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
639 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
640 [Datapath actions: 1,2
647 AT_SETUP([ofproto-dpif - mirroring, select_dst])
649 [add-port br0 p1 -- set Interface p1 type=dummy --\
650 add-port br0 p2 -- set Interface p2 type=dummy --\
651 add-port br0 p3 -- set Interface p3 type=dummy --\
652 set Bridge br0 mirrors=@m --\
653 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
654 --id=@m create Mirror name=mymirror \
655 select_dst_port=@p2 output_port=@p3], [<0>
658 AT_DATA([flows.txt], [dnl
659 in_port=1 actions=output:2
660 in_port=2 actions=output:1
662 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
664 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)"
665 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
666 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
667 [Datapath actions: 2,3
670 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)"
671 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
672 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
680 AT_SETUP([ofproto-dpif - mirroring, select_vlan])
682 [add-port br0 p1 -- set Interface p1 type=dummy --\
683 add-port br0 p2 -- set Interface p2 type=dummy --\
684 add-port br0 p3 -- set Interface p3 type=dummy --\
685 set Bridge br0 mirrors=@m --\
686 --id=@p2 get Port p2 -- --id=@p3 get Port p3 --\
687 --id=@m create Mirror name=mymirror \
688 select_all=true select_vlan=11 output_port=@p3], [<0>
691 AT_DATA([flows.txt], [dnl
692 in_port=1, actions=output:2
694 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
696 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)"
697 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
698 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
702 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))"
703 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
704 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
708 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))"
709 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
710 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
711 [Datapath actions: 2,3
718 AT_SETUP([ofproto-dpif - mirroring, output_port])
720 [add-port br0 p1 -- set Interface p1 type=dummy --\
721 add-port br0 p2 -- set Interface p2 type=dummy --\
722 add-port br0 p3 -- set Interface p3 type=dummy --\
723 set Bridge br0 mirrors=@m --\
724 --id=@p3 get Port p3 --\
725 --id=@m create Mirror name=mymirror \
726 select_all=true output_port=@p3], [<0>
729 AT_DATA([flows.txt], [dnl
730 in_port=1 actions=mod_vlan_vid:17,output:2
731 in_port=2 actions=output:1
733 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
735 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)"
736 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
737 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
738 [Datapath actions: push_vlan(vid=17,pcp=0),2,pop_vlan,3
741 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)"
742 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
743 AT_CHECK_UNQUOTED([tail -1 stdout], [0],
744 [Datapath actions: 1,3
750 AT_SETUP([ofproto-dpif - mirroring, output_vlan])
752 [add-port br0 p1 -- set Interface p1 type=dummy --\
753 add-port br0 p2 -- set Interface p2 type=dummy --\
754 set Bridge br0 mirrors=@m --\
755 --id=@m create Mirror name=mymirror \
756 select_all=true output_vlan=12], [<0>
759 AT_DATA([flows.txt], [dnl
760 in_port=1 actions=output:2
761 in_port=2 actions=mod_vlan_vid:17,output:1
763 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
765 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)"
766 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
767 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
769 expected="2,push_vlan(vid=12,pcp=0),0,1,2"
770 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
772 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
774 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)"
775 AT_CHECK([ovs-appctl ofproto/trace br0 "$flow"], [0], [stdout])
776 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
778 expected="push_vlan(vid=17,pcp=0),1,pop_vlan,push_vlan(vid=12,pcp=0),0,1,2"
779 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected"], [0], [stdout])
781 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual"], [0], [expout])
786 m4_define([OFPROTO_TRACE],
788 AT_CHECK([ovs-appctl ofproto/trace $1 "$flow" $3], [0], [stdout])
789 actual=`tail -1 stdout | sed 's/Datapath actions: //'`
791 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$expected" $5],
794 AT_CHECK([ovs-dpctl normalize-actions "$flow" "$actual" $5],
797 AT_SETUP([ofproto-dpif - MAC learning])
799 [set bridge br0 fail-mode=standalone -- \
800 add-port br0 p1 -- set Interface p1 type=dummy -- \
801 add-port br0 p2 -- set Interface p2 type=dummy -- \
802 add-port br0 p3 -- set Interface p3 type=dummy])
804 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)'
806 # Trace an ARP packet arriving on p3, to create a MAC learning entry.
809 [in_port(3),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
813 # Check for the MAC learning entry.
814 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl
816 3 0 50:54:00:00:00:05 ?
819 # Trace a packet arrival destined for the learned MAC.
820 # (This will also learn a MAC.)
823 [in_port(1),eth(src=50:54:00:00:00:06,dst=50:54:00:00:00:05),$arp],
827 # Check for both MAC learning entries.
828 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl
830 3 0 50:54:00:00:00:05 ?
831 1 0 50:54:00:00:00:06 ?
834 # Trace a packet arrival that updates the first learned MAC entry.
837 [in_port(2),eth(src=50:54:00:00:00:05,dst=ff:ff:ff:ff:ff:ff),$arp],
841 # Check that the MAC learning entry was updated.
842 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl
844 1 0 50:54:00:00:00:06 ?
845 2 0 50:54:00:00:00:05 ?
848 # Add another bridge.
852 -- set bridge br1 datapath-type=dummy \
853 -- add-port br1 p4 -- set interface p4 type=dummy \
854 -- add-port br1 p5 -- set interface p5 type=dummy])
856 # Trace some packet arrivals in br1 to create MAC learning entries there too.
859 [in_port(4),eth(src=50:54:00:00:00:06,dst=ff:ff:ff:ff:ff:ff),$arp],
864 [in_port(5),eth(src=50:54:00:00:00:07,dst=ff:ff:ff:ff:ff:ff),$arp],
868 # Check that the MAC learning entries were added.
869 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]$/?/'], [0], [dnl
871 4 0 50:54:00:00:00:06 ?
872 5 0 50:54:00:00:00:07 ?
875 # Delete port p1 and see that its MAC learning entry disappeared, and
876 # that the MAC learning entry for the same MAC was also deleted from br1.
877 AT_CHECK([ovs-vsctl del-port p1])
878 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br0 | sed 's/[[0-9]]$/?/'], [0], [dnl
880 2 0 50:54:00:00:00:05 ?
882 AT_CHECK_UNQUOTED([ovs-appctl fdb/show br1 | sed 's/[[0-9]]$/?/'], [0], [dnl
884 5 0 50:54:00:00:00:07 ?
890 dnl Test that basic NetFlow reports flow statistics correctly:
891 dnl - The initial packet of a flow are correctly accounted.
892 dnl - Later packets within a flow are correctly accounted.
893 dnl - Flow actions changing (in this case, due to MAC learning)
894 dnl cause a record to be sent.
895 AT_SETUP([ofproto-dpif - NetFlow flow expiration])
897 AT_SKIP_IF([test "x$RANDOM" = x])
898 NETFLOW_PORT=`expr 32767 + \( $RANDOM % 32767 \)`
901 [set Bridge br0 fail-mode=standalone -- \
902 add-port br0 p1 -- set Interface p1 type=dummy -- \
903 add-port br0 p2 -- set Interface p2 type=dummy -- \
904 set Bridge br0 netflow=@nf -- \
905 --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
906 engine_id=1 engine_type=2 active_timeout=30 \
907 add-id-to-interface=false], [<0>
910 AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log])
912 for delay in 1000 30000; do
913 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)'
914 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)'
916 ovs-appctl time/warp $delay
920 ovs-appctl -t test-netflow exit
922 AT_CHECK([[sed -e 's/, uptime [0-9]*//
924 s/time \([0-9]*\)\.\.\.\1\b/time <moment>/
925 s/time [0-9]*\.\.\.[0-9]*/time <range>/
926 ' netflow.log]], [0],
927 [header: v5, seq 0, engine 2,1
928 rec: 192.168.0.1 > 192.168.0.2, if 1 > 65535, 1 pkts, 60 bytes, ICMP 8:0, time <moment>
930 header: v5, seq 1, engine 2,1
931 rec: 192.168.0.2 > 192.168.0.1, if 2 > 1, 2 pkts, 120 bytes, ICMP 0:0, time <range>
932 rec: 192.168.0.1 > 192.168.0.2, if 1 > 2, 1 pkts, 60 bytes, ICMP 8:0, time <moment>
936 dnl Test that basic NetFlow reports active expirations correctly.
937 AT_SETUP([ofproto-dpif - NetFlow active expiration])
939 AT_SKIP_IF([test "x$RANDOM" = x])
940 NETFLOW_PORT=`expr 32767 + \( $RANDOM % 32767 \)`
943 [set Bridge br0 fail-mode=standalone -- \
944 add-port br0 p1 -- set Interface p1 type=dummy -- \
945 add-port br0 p2 -- set Interface p2 type=dummy -- \
946 set Bridge br0 netflow=@nf -- \
947 --id=@nf create NetFlow targets=\"127.0.0.1:$NETFLOW_PORT\" \
948 engine_id=1 engine_type=2 active_timeout=10 \
949 add-id-to-interface=false], [<0>
952 AT_CHECK([test-netflow --detach --pidfile $NETFLOW_PORT:127.0.0.1 > netflow.log])AT_CAPTURE_FILE([netflow.log])
955 while test $n -le 60; do
958 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)'
959 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)'
961 ovs-appctl time/warp 1000
964 ovs-appctl time/warp 10000
967 ovs-appctl -t test-netflow exit
969 # Count the number of reported packets:
970 # - From source to destination before MAC learning kicks in (just one).
971 # - From source to destination after that.
972 # - From destination to source.
980 pkts=`echo "$line" | sed 's/.*, \([[0-9]]*\) pkts,.*/\1/'`
987 "rec: 192.168.0.1 > 192.168.0.2, if 1 > 65535, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
990 "rec: 192.168.0.1 > 192.168.0.2, if 1 > 2, "*" pkts, "*" bytes, TCP 1234 > 80, time "*)
993 "rec: 192.168.0.2 > 192.168.0.1, if 2 > 1, "*" pkts, "*" bytes, TCP 80 > 1234, time "*)
1000 eval $counter=\`expr \$$counter + \$pkts\`
1001 n_recs=`expr $n_recs + 1`
1004 # There should be exactly 1 MAC learning packet,
1005 # exactly 59 other packets in that direction,
1006 # and exactly 60 packets in the other direction.
1007 AT_CHECK([echo $n_learn $n_in $n_out $n_other], [0], [1 59 60 0
1010 # There should be 1 expiration for MAC learning,
1011 # at least 5 active and a final expiration in one direction,
1012 # and at least 5 active and a final expiration in the other direction.
1014 AT_CHECK([test $n_recs -ge 13])