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