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