summaryrefslogtreecommitdiff
path: root/tests/drop-stats.at
blob: 1d3af98dabe850a8abce7582518afd23db2f5a03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
AT_BANNER([drop-stats])

AT_SETUP([drop-stats - cli tests])

OVS_VSWITCHD_START([dnl
    set bridge br0 datapath_type=dummy \
        protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
    add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1])

AT_DATA([flows.txt], [dnl
table=0,in_port=1,actions=drop
])

AT_CHECK([
    ovs-ofctl del-flows br0
    ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
    ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions ], [0], [dnl
 in_port=1 actions=drop
])

AT_CHECK([
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
], [0], [ignore])

AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/used:[[0-9]].[[0-9]]*s/used:0.0/' | sort], [0], [flow-dump from the main thread:
recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:2, bytes:212, used:0.0, actions:drop
])

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_of_pipeline
], [0], [dnl
3
])


OVS_VSWITCHD_STOP
AT_CLEANUP

AT_SETUP([drop-stats - pipeline and recursion drops])

OVS_VSWITCHD_START([dnl
    set bridge br0 datapath_type=dummy \
        protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
    add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
    add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])

AT_DATA([flows.txt], [dnl
table=0,in_port=1,actions=drop
])

AT_CHECK([
    ovs-ofctl del-flows br0
    ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
    ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions ], [0], [dnl
 in_port=1 actions=drop
])

AT_CHECK([
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
], [0], [ignore])

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_of_pipeline
], [0], [dnl
1
])


AT_DATA([flows.txt], [dnl
table=0, in_port=1, actions=goto_table:1
table=1, in_port=1, actions=goto_table:2
table=2, in_port=1, actions=resubmit(,1)
])

AT_CHECK([
    ovs-ofctl del-flows br0
    ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
    ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions ], [0], [ignore])

ovs-appctl time/warp 15000
AT_CHECK([ovs-appctl revalidator/wait])

AT_CHECK([
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
], [0], [ignore])

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_recursion_too_deep
], [0], [dnl
1
])


OVS_VSWITCHD_STOP(["/|WARN|/d"])
AT_CLEANUP

AT_SETUP([drop-stats - too many resubmit])
OVS_VSWITCHD_START
add_of_ports br0 1
(for i in `seq 1 64`; do
     j=`expr $i + 1`
     echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
 done
 echo "in_port=65, actions=local") > flows.txt

AT_CHECK([
    ovs-ofctl del-flows br0
    ovs-ofctl -Oopenflow13 add-flows br0 flows.txt ], [0], [ignore])

ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_too_many_resubmit
], [0], [dnl
1
])

OVS_VSWITCHD_STOP(["/|WARN|/d"])
AT_CLEANUP


AT_SETUP([drop-stats - stack too deep])
OVS_VSWITCHD_START
add_of_ports br0 1
(for i in `seq 1 12`; do
     j=`expr $i + 1`
     echo "in_port=$i, actions=resubmit:$j, resubmit:$j, local"
 done
 push="push:NXM_NX_REG0[[]]"
 echo "in_port=13, actions=$push,$push,$push,$push,$push,$push,$push,$push") > flows

AT_CHECK([ovs-ofctl add-flows br0 flows])

ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_stack_too_deep
], [0], [dnl
1
])


OVS_VSWITCHD_STOP(["/resubmits yielded over 64 kB of stack/d"])
AT_CLEANUP

AT_SETUP([drop-stats - too many mpls labels])

OVS_VSWITCHD_START([dnl
    set bridge br0 datapath_type=dummy \
        protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
    add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
    add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])

AT_DATA([flows.txt], [dnl
table=0, in_port=1, actions=push_mpls:0x8847, resubmit:3
table=0, in_port=3, actions=push_mpls:0x8847, set_field:10->mpls_label, set_field:15->mpls_label, resubmit:4
table=0, in_port=4, actions=push_mpls:0x8847, set_field:11->mpls_label, resubmit:5
table=0, in_port=5, actions=push_mpls:0x8847, set_field:12->mpls_label, resubmit:6
table=0, in_port=6, actions=push_mpls:0x8847, set_field:13->mpls_label, output:2
])

AT_CHECK([
    ovs-ofctl del-flows br0
    ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
])

AT_CHECK([
    ovs-appctl netdev-dummy/receive p1 'in_port(1),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),ipv4(src=192.168.10.10,dst=192.168.10.30,proto=1,tos=0,ttl=64,frag=no),icmp(type=8,code=0)'
], [0], [ignore])

ovs-appctl time/warp 5000

AT_CHECK([
ovs-appctl coverage/read-counter drop_action_too_many_mpls_labels
], [0], [dnl
1
])


OVS_VSWITCHD_STOP(["/|WARN|/d"])
AT_CLEANUP