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