UDP Encap counters
[vpp.git] / src / vpp / stats / stats.api
1 /*
2  * Copyright (c) 2015-2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 /** \file
17
18     This file defines the stats API 
19 */
20
21 option version = "1.0.0";
22
23 import "vnet/interface.api";
24
25 service {
26   rpc want_stats
27     returns want_stats_reply;
28   rpc want_interface_simple_stats
29     returns want_interface_simple_stats_reply
30     events vnet_interface_simple_counters;
31   rpc want_per_interface_simple_stats
32     returns want_per_interface_simple_stats_reply
33     events vnet_per_interface_simple_counters;
34   rpc want_interface_combined_stats
35     returns want_interface_combined_stats_reply
36     events vnet_interface_combined_counters;
37   rpc want_per_interface_combined_stats
38     returns want_per_interface_combined_stats_reply
39     events vnet_per_interface_combined_counters;
40   rpc want_ip4_fib_stats
41     returns want_ip4_fib_stats_reply
42     events vnet_ip4_fib_counters;
43   rpc want_ip6_fib_stats
44     returns want_ip6_fib_stats_reply
45     events vnet_ip6_fib_counters;
46   rpc want_ip4_mfib_stats
47     returns want_ip4_mfib_stats_reply
48     events vnet_ip4_mfib_counters;
49   rpc want_ip6_mfib_stats
50     returns want_ip6_mfib_stats_reply
51     events vnet_ip6_mfib_counters;
52   rpc want_ip4_nbr_stats
53     returns want_ip4_nbr_stats_reply
54     events vnet_ip4_nbr_counters;
55   rpc want_ip6_nbr_stats
56     returns want_ip6_nbr_stats_reply
57     events vnet_ip6_nbr_counters;
58   rpc want_udp_encap_stats
59     returns want_udp_encap_stats_reply
60     events vnet_udp_encap_counters;
61 };
62
63 /** \brief Want Stats, enable/disable ALL stats updates
64     @param client_index - opaque cookie to identify the sender
65     @param context - sender context, to match reply w/ request
66     @param enable_disable - 1 = enable stats, 0 = disable
67     @param pid - pid of process requesting stats updates
68 */
69 autoreply define want_stats
70 {
71   u32 client_index;
72   u32 context;
73   u32 enable_disable;
74   u32 pid;
75 };
76
77 /** \brief Want Interface Simple Stats, register for detailed interface stats
78     @param client_index - opaque cookie to identify the sender
79     @param context - sender context, to match reply w/ request
80     @param enable_disable - 1 = enable stats, 0 = disable
81     @param pid - pid of process requesting stats updates
82
83     Please consider using want_per_interface_simple_stats with sw_if_index=~0
84 */
85 autoreply define want_interface_simple_stats
86 {
87   u32 client_index;
88   u32 context;
89   u32 enable_disable;
90   u32 pid;
91 };
92
93 /** \brief Want Per Interface simple Stats, register for continuous stats
94     @param client_index - opaque cookie to identify the sender
95     @param context - sender context, to match reply w/ request
96     @param enable_disable - 1 = enable stats, 0 = disable
97     @param pid - pid of process requesting stats updates
98     @param num - number of sw_if_indexes
99     @param sw_ifs - array of sw_if_index
100 */
101 autoreply define want_per_interface_simple_stats
102 {
103   u32 client_index;
104   u32 context;
105   u32 enable_disable;
106   u32 pid;
107   u32 num;
108   u32 sw_ifs[num];
109
110 };
111
112 /** \brief Want Interface Combined Stats, register for continuous stats
113     @param client_index - opaque cookie to identify the sender
114     @param context - sender context, to match reply w/ request
115     @param enable_disable - 1 = enable stats, 0 = disable
116     @param pid - pid of process requesting stats updates
117
118     Please consider using want_per_interface_combined_stats with sw_if_index=~0
119
120 */
121 autoreply define want_interface_combined_stats
122 {
123   u32 client_index;
124   u32 context;
125   u32 enable_disable;
126   u32 pid;
127 };
128
129 /** \brief Want Per Interface Combined Stats, register for continuous stats
130     @param client_index - opaque cookie to identify the sender
131     @param context - sender context, to match reply w/ request
132     @param enable_disable - 1 = enable stats, 0 = disable
133     @param pid - pid of process requesting stats updates
134     @param num - number of sw_if_indexes
135     @param sw_ifs - array of sw_if_index
136 */
137 autoreply define want_per_interface_combined_stats
138 {
139   u32 client_index;
140   u32 context;
141   u32 enable_disable;
142   u32 pid;
143   u32 num;
144   u32 sw_ifs[num];
145
146 };
147
148 /** \brief Want IP4 FIB Stats, register for continuous stats
149     @param client_index - opaque cookie to identify the sender
150     @param context - sender context, to match reply w/ request
151     @param enable_disable - 1 = enable stats, 0 = disable
152     @param pid - pid of process requesting stats updates
153 */
154 autoreply define want_ip4_fib_stats
155 {
156   u32 client_index;
157   u32 context;
158   u32 enable_disable;
159   u32 pid;
160 };
161
162 /** \brief Want IP6 FIB Stats, register for continuous stats
163     @param client_index - opaque cookie to identify the sender
164     @param context - sender context, to match reply w/ request
165     @param enable_disable - 1 = enable stats, 0 = disable
166     @param pid - pid of process requesting stats updates
167 */
168 autoreply define want_ip6_fib_stats
169 {
170   u32 client_index;
171   u32 context;
172   u32 enable_disable;
173   u32 pid;
174 };
175
176 /** \brief Want IP4 muilticast FIB Stats, register for continuous stats
177     @param client_index - opaque cookie to identify the sender
178     @param context - sender context, to match reply w/ request
179     @param enable_disable - 1 = enable stats, 0 = disable
180     @param pid - pid of process requesting stats updates
181 */
182 autoreply define want_ip4_mfib_stats
183 {
184   u32 client_index;
185   u32 context;
186   u32 enable_disable;
187   u32 pid;
188 };
189
190 /** \brief Want IP6 multicast FIB Stats, register for continuous stats
191     @param client_index - opaque cookie to identify the sender
192     @param context - sender context, to match reply w/ request
193     @param enable_disable - 1 = enable stats, 0 = disable
194     @param pid - pid of process requesting stats updates
195 */
196 autoreply define want_ip6_mfib_stats
197 {
198   u32 client_index;
199   u32 context;
200   u32 enable_disable;
201   u32 pid;
202 };
203
204 /** \brief Want IP4 NBR Stats, register for continuous stats
205     @param client_index - opaque cookie to identify the sender
206     @param context - sender context, to match reply w/ request
207     @param enable_disable - 1 = enable stats, 0 = disable
208     @param pid - pid of process requesting stats updates
209 */
210 autoreply define want_ip4_nbr_stats
211 {
212   u32 client_index;
213   u32 context;
214   u32 enable_disable;
215   u32 pid;
216 };
217
218 /** \brief Want IP6 NBR Stats, register for continuous stats
219     @param client_index - opaque cookie to identify the sender
220     @param context - sender context, to match reply w/ request
221     @param enable_disable - 1 = enable stats, 0 = disable
222     @param pid - pid of process requesting stats updates
223 */
224 autoreply define want_ip6_nbr_stats
225 {
226   u32 client_index;
227   u32 context;
228   u32 enable_disable;
229   u32 pid;
230 };
231
232 typeonly manual_print manual_endian define ip4_fib_counter
233 {
234   u32 address;
235   u8 address_length;
236   u64 packets;
237   u64 bytes;
238 };
239
240 manual_print manual_endian define vnet_ip4_fib_counters
241 {
242   u32 vrf_id;
243   u32 count;
244   vl_api_ip4_fib_counter_t c[count];
245 };
246
247 typeonly manual_print manual_endian define ip4_mfib_counter
248 {
249   u8 source[4];
250   u8 group[4];
251   u8 group_length;
252   u64 packets;
253   u64 bytes;
254 };
255
256 manual_print manual_endian define vnet_ip4_mfib_counters
257 {
258   u32 vrf_id;
259   u32 count;
260   vl_api_ip4_mfib_counter_t c[count];
261 };
262
263 typeonly manual_print manual_endian define ip4_nbr_counter
264 {
265   u32 address;
266   u8  link_type;
267   u64 packets;
268   u64 bytes;
269 };
270
271 /**
272  * @brief Per-neighbour (i.e. per-adjacency) coutners
273  * @param count The size of the array of counters
274  * @param sw_if_index The interface the adjacency is on
275  * @param begin Flag to indicate this is the first set of stats for this
276  *        interface. If this flag is not set the it is a continuation of
277  *        stats for this interface
278  * @param  c counters
279  */
280 manual_print manual_endian define vnet_ip4_nbr_counters
281 {
282   u32 count;
283   u32 sw_if_index;
284   u8 begin;
285   vl_api_ip4_nbr_counter_t c[count];
286 };
287
288 typeonly manual_print manual_endian define ip6_fib_counter
289 {
290   u64 address[2];
291   u8 address_length;
292   u64 packets;
293   u64 bytes;
294 };
295
296 manual_print manual_endian define vnet_ip6_fib_counters
297 {
298   u32 vrf_id;
299   u32 count;
300   vl_api_ip6_fib_counter_t c[count];
301 };
302
303 typeonly manual_print manual_endian define ip6_mfib_counter
304 {
305   u8 source[16];
306   u8 group[16];
307   u8 group_length;
308   u64 packets;
309   u64 bytes;
310 };
311
312 manual_print manual_endian define vnet_ip6_mfib_counters
313 {
314   u32 vrf_id;
315   u32 count;
316   vl_api_ip6_mfib_counter_t c[count];
317 };
318
319 typeonly manual_print manual_endian define ip6_nbr_counter
320 {
321   u64 address[2];
322   u8  link_type;
323   u64 packets;
324   u64 bytes;
325 };
326
327 manual_print manual_endian define vnet_ip6_nbr_counters
328 {
329   u32 count;
330   u32 sw_if_index;
331   u8 begin;
332   vl_api_ip6_nbr_counter_t c[count];
333 };
334
335 /** \brief Simple stats counters structure
336     @param vnet_counter_type- such as ip4, ip6, punts, etc
337     @param first_sw_if_index - first sw index in block of index, counts
338     @param count - number of counters, equal to the number of interfaces in
339       this stats block
340     @param data - contiguous block of u64 counters
341
342     vnet_counter_type defined in enums - plural - in vnet/interface.h
343 */
344 manual_print manual_endian define vnet_interface_simple_counters
345 {
346   u8 vnet_counter_type;
347   u32 first_sw_if_index;
348   u32 count;
349   u64 data[count];
350 };
351
352 /** \brief Combined stats counters structure
353     @param vnet_counter_type- such as ip4, ip6, punts, etc
354     @param first_sw_if_index - first sw index in block of index, counts
355     @param count - number of counters, equal to the number of interfaces in
356       this stats block
357     @param data - contiguous block of vlib_counter_t structures
358
359     vnet_counter_type defined in enums - plural - in vnet/interface.h
360 */
361 manual_print manual_endian define vnet_interface_combined_counters
362 {
363   u8 vnet_counter_type;
364   u32 first_sw_if_index;
365   u32 count;
366   vl_api_vlib_counter_t data[count];
367 };
368
369 /** \brief Simple per interface stats counters structure
370     @param count - number of elements in message
371     @param timestamp - u32 vlib timestamp for control plane
372     @param data[count] - vl_api_vnet_simple_counter_t 
373
374 */
375 manual_print manual_endian define vnet_per_interface_simple_counters
376 {
377   u32 count;
378   u32 timestamp;
379   vl_api_vnet_simple_counter_t data[count];
380 };
381
382 /** \brief Combined stats counters structure per interface
383     @param count - number of elements in message
384     @param timestamp - u32 vlib timestamp for control plane
385     @param data[count] - vl_api_vnet_combined_counter_t
386 */
387 manual_print manual_endian define vnet_per_interface_combined_counters
388 {
389   u32 count;
390   u32 timestamp;
391   vl_api_vnet_combined_counter_t data[count];
392 };
393
394 /** \brief Request for a single block of summary stats
395     @param client_index - opaque cookie to identify the sender
396     @param context - sender context, to match reply w/ request
397 */
398 define vnet_get_summary_stats
399 {
400   u32 client_index;
401   u32 context;
402 };
403
404 /** \brief Reply for vnet_get_summary_stats request
405     @param context - sender context, to match reply w/ request
406     @param retval - return code for request
407     @param total_pkts -  
408     @param total_bytes -
409     @param vector_rate - 
410 */
411 define vnet_get_summary_stats_reply
412 {
413   u32 context;
414   i32 retval;
415   u64 total_pkts[2];
416   u64 total_bytes[2];
417   f64 vector_rate;
418 };
419
420 /** \brief Get delay between polling statistics
421     @param client_index - opaque cookie to identify the sender
422     @param context - sender context, to match reply w/ request
423 */
424 define stats_get_poller_delay
425 {
426   u32 client_index;
427   u32 context;
428 };
429
430 /** \brief Get delay between polling statistics reply
431     @param context - sender context, to match reply w/ request
432     @param retval - return code for request
433     @param delay - poller delay
434 */
435 define stats_get_poller_delay_reply
436 {
437   u32 context;
438   i32 retval;
439   u32 delay;
440 };
441
442 /** \brief Want UDP encap Stats, register for continuous stats
443     @param client_index - opaque cookie to identify the sender
444     @param context - sender context, to match reply w/ request
445     @param enable - 1 = enable stats, 0 = disable
446     @param pid - pid of process requesting stats updates
447 */
448 autoreply define want_udp_encap_stats
449 {
450   u32 client_index;
451   u32 context;
452   u32 enable;
453   u32 pid;
454 };
455
456 /** \brief Stat for one UDP encap object
457     @param id - The ID of the object, same as passed for the create
458     @param packets - number of packets sent
459     @param bytes - number of bytes sent
460 */
461 typeonly manual_print manual_endian define udp_encap_counter
462 {
463   u32 id;
464   u64 packets;
465   u64 bytes;
466 };
467
468 manual_print manual_endian define vnet_udp_encap_counters
469 {
470   u32 timestamp;
471   u32 count;
472   vl_api_udp_encap_counter_t c[count];
473 };
474
475 /*
476  * Local Variables:
477  * eval: (c-set-style "gnu")
478  * End:
479  */