]> git.proxmox.com Git - ovs.git/blob - tests/dpif-netdev.at
system-kmod-macros: Load TFTP module.
[ovs.git] / tests / dpif-netdev.at
1 AT_BANNER([dpif-netdev])
2
3 m4_divert_push([PREPARE_TESTS])
4 [
5 # Strips out uninteresting parts of flow output, as well as parts
6 # that vary from one run to another (e.g., timing and bond actions).
7 strip_timers () {
8 sed '
9 s/duration:[0-9]*\.[0-9]*/duration:0.0/
10 s/used:[0-9]*\.[0-9]*/used:0.0/
11 '
12 }
13
14 strip_xout () {
15 sed '
16 s/ufid:[-0-9a-f]* //
17 s/used:[0-9]*\.[0-9]*/used:0.0/
18 s/actions:.*/actions: <del>/
19 s/packets:[0-9]*/packets:0/
20 s/bytes:[0-9]*/bytes:0/
21 ' | sort
22 }
23
24 strip_xout_keep_actions () {
25 sed '
26 s/ufid:[-0-9a-f]* //
27 s/used:[0-9]*\.[0-9]*/used:0.0/
28 s/packets:[0-9]*/packets:0/
29 s/bytes:[0-9]*/bytes:0/
30 ' | sort
31 }
32
33 filter_flow_install () {
34 grep 'flow_add' | sed 's/.*flow_add: //' | sort | uniq
35 }
36
37 filter_flow_dump () {
38 grep 'flow_dump ' | sed '
39 s/.*flow_dump //
40 s/used:[0-9]*\.[0-9]*/used:0.0/
41 ' | sort | uniq
42 }
43
44 strip_metadata () {
45 sed 's/metadata=0x[0-9a-f]*/metadata=0x0/'
46 }
47 ]
48 m4_divert_pop([PREPARE_TESTS])
49
50 AT_SETUP([dpif-netdev - netdev-dummy/receive])
51 # Create br0 with interfaces p0
52 OVS_VSWITCHD_START([add-port br0 p1 -- set interface p1 type=dummy ofport_request=1 -- ])
53 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
54
55 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
56 ovs-appctl time/stop
57 ovs-appctl time/warp 5000
58 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:01,dst=50:54:00:00:02:00),eth_type(0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)'])
59 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
60 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:01,dst=50:54:00:00:02:00),eth_type(0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)
61 ])
62
63 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:06:00),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.6,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)' --len 1024])
64 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
65 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:06:00),eth_type(0x0800),ipv4(src=10.0.0.5,dst=10.0.0.6,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9),tcp_flags(ack)
66 ])
67 OVS_VSWITCHD_STOP
68 AT_CLEANUP
69
70
71 m4_define([DPIF_NETDEV_DUMMY_IFACE],
72 [AT_SETUP([dpif-netdev - $1 interface])
73 # Create br0 with interfaces p1 and p7
74 # and br1 with interfaces p2 and p8
75 # with p1 and p2 connected via unix domain socket
76 OVS_VSWITCHD_START(
77 [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
78 add-port br0 p7 -- set interface p7 ofport_request=7 type=$1 -- \
79 add-br br1 -- \
80 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
81 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
82 fail-mode=secure -- \
83 add-port br1 p2 -- set interface p2 type=$1 options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \
84 add-port br1 p8 -- set interface p8 ofport_request=8 type=$1 --], [], [],
85 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
86 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
87
88 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
89 AT_CHECK([ovs-ofctl add-flow br1 action=normal])
90 ovs-appctl time/stop
91 ovs-appctl time/warp 5000
92 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
93 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
94 ovs-appctl time/warp 100
95 sleep 1 # wait for forwarders process packets
96
97 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
98 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
99 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
100 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
101 recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(frag=no), actions: <del>
102 ])
103
104 OVS_VSWITCHD_STOP
105 AT_CLEANUP])
106
107 DPIF_NETDEV_DUMMY_IFACE([dummy])
108 DPIF_NETDEV_DUMMY_IFACE([dummy-pmd])
109
110 m4_define([DPIF_NETDEV_MISS_FLOW_INSTALL],
111 [AT_SETUP([dpif-netdev - miss upcall key matches flow_install - $1])
112 OVS_VSWITCHD_START(
113 [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock
114 set bridge br0 datapath-type=dummy other-config:datapath-id=1234 fail-mode=secure], [], [],
115 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
116 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
117
118 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
119 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
120 ovs-appctl ofproto/trace 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
121 sleep 1
122
123 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
124 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
125 ])
126 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
127 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
128 ])
129
130 # Now, the same again without megaflows.
131 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
132 ])
133 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
134 sleep 1
135
136 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
137 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
138 ])
139 AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
140 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(frag=no), actions: <del>
141 skb_priority(0),skb_mark(0),ct_state(-new-est-rel-rpl-inv-trk-snat-dnat),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), actions: <del>
142 ])
143
144 OVS_VSWITCHD_STOP
145 AT_CLEANUP])
146
147 DPIF_NETDEV_MISS_FLOW_INSTALL([dummy])
148 DPIF_NETDEV_MISS_FLOW_INSTALL([dummy-pmd])
149
150 m4_define([DPIF_NETDEV_MISS_FLOW_DUMP],
151 [AT_SETUP([dpif-netdev - miss upcall key matches flow_dump - $1])
152 OVS_VSWITCHD_START(
153 [add-port br0 p1 -- set interface p1 type=$1 options:pstream=punix:$OVS_RUNDIR/p0.sock
154 set bridge br0 datapath-type=dummy other-config:datapath-id=1234 fail-mode=secure], [], [],
155 [m4_if([$1], [dummy-pmd], [--dummy-numa="0,0,0,0,1,1,1,1"], [])])
156 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
157 ], [])
158 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
159
160 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
161 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
162 sleep 1
163
164 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
165 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
166 ])
167 AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl
168 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del>
169 ])
170
171 # Now, the same again without megaflows.
172 AT_CHECK([ovs-appctl upcall/disable-megaflows], [0], [megaflows disabled
173 ])
174 AT_CHECK([ovs-appctl upcall/disable-ufid], [0], [Datapath dumping tersely using UFID disabled
175 ], [])
176 AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'])
177 sleep 1
178
179 AT_CHECK([grep -A 1 'miss upcall' ovs-vswitchd.log | tail -n 1], [0], [dnl
180 skb_priority(0),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)
181 ])
182 AT_CHECK([filter_flow_dump < ovs-vswitchd.log | strip_xout], [0], [dnl
183 skb_priority(0),skb_mark(0),ct_state(0/0xff),ct_zone(0),ct_mark(0),ct_label(0),recirc_id(0),dp_hash(0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0), packets:0, bytes:0, used:never, actions: <del>
184 skb_priority(0/0),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),ct_mark(0/0),ct_label(0/0),recirc_id(0),dp_hash(0/0),in_port(1),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2/0.0.0.0,dst=10.0.0.1/0.0.0.0,proto=1/0,tos=0/0,ttl=64/0,frag=no),icmp(type=8/0,code=0/0), packets:0, bytes:0, used:never, actions: <del>
185 ])
186
187 OVS_VSWITCHD_STOP
188 AT_CLEANUP])
189
190 DPIF_NETDEV_MISS_FLOW_DUMP([dummy])
191 DPIF_NETDEV_MISS_FLOW_DUMP([dummy-pmd])
192
193 AT_SETUP([dpif-netdev - meters])
194 # Create br0 with interfaces p1 and p7
195 # and br1 with interfaces p2 and p8
196 # with p1 and p2 connected via unix domain socket
197 OVS_VSWITCHD_START(
198 [add-port br0 p1 -- set interface p1 type=dummy options:pstream=punix:$OVS_RUNDIR/p0.sock ofport_request=1 -- \
199 add-port br0 p7 -- set interface p7 ofport_request=7 type=dummy -- \
200 add-br br1 -- \
201 set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \
202 set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \
203 fail-mode=secure -- \
204 add-port br1 p2 -- set interface p2 type=dummy options:stream=unix:$OVS_RUNDIR/p0.sock ofport_request=2 -- \
205 add-port br1 p8 -- set interface p8 ofport_request=8 type=dummy --])
206 AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg])
207
208 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=1 pktps burst stats bands=type=drop rate=1 burst_size=1'])
209 AT_CHECK([ovs-ofctl -O OpenFlow13 add-meter br0 'meter=2 kbps burst stats bands=type=drop rate=1 burst_size=2'])
210 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=1 action=meter:1,7'])
211 AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 'in_port=7 action=meter:2,1'])
212 AT_CHECK([ovs-ofctl add-flow br1 'in_port=2 action=8'])
213 AT_CHECK([ovs-ofctl add-flow br1 'in_port=8 action=2'])
214 ovs-appctl time/stop
215
216 AT_CHECK([ovs-ofctl -O OpenFlow13 dump-meters br0], [0], [dnl
217 OFPST_METER_CONFIG reply (OF1.3) (xid=0x2):
218 meter=1 pktps burst stats bands=
219 type=drop rate=1 burst_size=1
220
221 meter=2 kbps burst stats bands=
222 type=drop rate=1 burst_size=2
223 ])
224
225 ovs-appctl time/warp 5000
226 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
227 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
228 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
229 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
230 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
231 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
232 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
233 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
234 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
235 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
236 sleep 1 # wait for forwarders process packets
237
238 # Meter 1 is measuring packets, allowing one packet per second with
239 # bursts of one packet, so 4 out of 5 packets should hit the drop
240 # band.
241 # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). 4 packets
242 # (240 bytes == 1920 bits) pass, but the last packet should hit the drop band.
243 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
244 OFPST_METER reply (OF1.3) (xid=0x2):
245 meter:1 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands:
246 0: packet_count:4 byte_count:240
247
248 meter:2 flow_count:1 packet_in_count:5 byte_in_count:300 duration:0.0s bands:
249 0: packet_count:1 byte_count:60
250 ])
251
252 # Advance time by 1/2 second
253 ovs-appctl time/warp 500
254
255 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
256 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
257 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
258 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
259 AT_CHECK([ovs-appctl netdev-dummy/receive p7 'in_port(7),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x0800),ipv4(src=10.0.0.2,dst=10.0.0.1,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
260 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
261 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
262 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
263 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
264 AT_CHECK([ovs-appctl netdev-dummy/receive p8 'in_port(8),packet_type(ns=0,id=0),eth(src=50:54:00:00:00:0b,dst=50:54:00:00:00:0c),eth_type(0x0800),ipv4(src=10.0.0.3,dst=10.0.0.4,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)' --len 60])
265 sleep 1 # wait for forwarders process packets
266
267 # Meter 1 is measuring packets, allowing one packet per second with
268 # bursts of one packet, so all 5 of the new packets should hit the drop
269 # band.
270 # Meter 2 is measuring kbps, with burst size 2 (== 2000 bits). After 500ms
271 # there should be space for 80 + 500 bits, so one new 60 byte (480 bit) packet
272 # should pass, remaining 4 should hit the drop band.
273 AT_CHECK([ovs-ofctl -O OpenFlow13 meter-stats br0 | strip_timers], [0], [dnl
274 OFPST_METER reply (OF1.3) (xid=0x2):
275 meter:1 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands:
276 0: packet_count:9 byte_count:540
277
278 meter:2 flow_count:1 packet_in_count:10 byte_in_count:600 duration:0.0s bands:
279 0: packet_count:5 byte_count:300
280 ])
281
282 AT_CHECK([cat ovs-vswitchd.log | filter_flow_install | strip_xout_keep_actions], [0], [dnl
283 recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(0),7
284 recirc_id(0),in_port(2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:8
285 recirc_id(0),in_port(7),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:meter(1),1
286 recirc_id(0),in_port(8),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:2
287 ])
288
289 OVS_VSWITCHD_STOP
290 AT_CLEANUP