flowprobe: add api messages to obtain current state
[vpp.git] / src / plugins / flowprobe / flowprobe.api
1 /* Define a simple enable-disable binary API to control the feature */
2
3 /** \file
4     This file defines the vpp control-plane API messages
5     used to control the flowprobe plugin
6 */
7
8 option version = "2.1.0";
9
10 import "vnet/interface_types.api";
11
12 enum flowprobe_which_flags : u8
13 {
14   FLOWPROBE_WHICH_FLAG_IP4 = 0x1,
15   FLOWPROBE_WHICH_FLAG_L2  = 0x2,
16   FLOWPROBE_WHICH_FLAG_IP6 = 0x4,
17 };
18
19 enum flowprobe_which : u8
20 {
21   FLOWPROBE_WHICH_IP4 = 0,
22   FLOWPROBE_WHICH_IP6,
23   FLOWPROBE_WHICH_L2,
24 };
25
26 enum flowprobe_record_flags : u8
27 {
28   FLOWPROBE_RECORD_FLAG_L2 = 0x1,
29   FLOWPROBE_RECORD_FLAG_L3 = 0x2,
30   FLOWPROBE_RECORD_FLAG_L4 = 0x4,
31 };
32
33 enum flowprobe_direction : u8
34 {
35   FLOWPROBE_DIRECTION_RX = 0,
36   FLOWPROBE_DIRECTION_TX,
37   FLOWPROBE_DIRECTION_BOTH,
38 };
39
40 /** \brief Enable / disable per-packet IPFIX recording on an interface
41     @param client_index - opaque cookie to identify the sender
42     @param context - sender context, to match reply w/ request
43     @param is_add - add address if non-zero, else delete
44     @param which - flags indicating forwarding path
45     @param sw_if_index - index of the interface
46 */
47 autoreply define flowprobe_tx_interface_add_del
48 {
49   option replaced_by="flowprobe_interface_add_del";
50
51   /* Client identifier, set from api_main.my_client_index */
52   u32 client_index;
53
54   /* Arbitrary context, so client can match reply to request */
55   u32 context;
56
57   /* Enable / disable the feature */
58   bool is_add;
59   vl_api_flowprobe_which_flags_t which;
60
61   /* Interface handle */
62   vl_api_interface_index_t sw_if_index;
63   option vat_help = "<intfc> [disable]";
64 };
65
66 /** \brief Enable or disable IPFIX flow record generation on an interface
67     @param client_index - opaque cookie to identify the sender
68     @param context - sender context, to match reply w/ request
69     @param is_add - add interface if non-zero, else delete
70     @param which - datapath on which to record flows
71     @param direction - direction of recorded flows
72     @param sw_if_index - index of the interface
73 */
74 autoreply define flowprobe_interface_add_del
75 {
76   option in_progress;
77   u32 client_index;
78   u32 context;
79   bool is_add;
80   vl_api_flowprobe_which_t which;
81   vl_api_flowprobe_direction_t direction;
82   vl_api_interface_index_t sw_if_index;
83   option vat_help = "(<intfc> | sw_if_index <if-idx>) [(ip4|ip6|l2)] [(rx|tx|both)] [disable]";
84 };
85
86 /** \brief Dump interfaces for which IPFIX flow record generation is enabled
87     @param client_index - opaque cookie to identify the sender
88     @param context - sender context, to match reply w/ request
89     @param sw_if_index - interface index to use as filter (0xffffffff is "all")
90 */
91 define flowprobe_interface_dump
92 {
93   option in_progress;
94   u32 client_index;
95   u32 context;
96   vl_api_interface_index_t sw_if_index [default=0xffffffff];
97   option vat_help = "[<if-idx>]";
98 };
99
100 /** \brief Details about IPFIX flow record generation enabled on interface
101     @param context - sender context which was passed in the request
102     @param which - datapath on which to record flows
103     @param direction - direction of recorded flows
104     @param sw_if_index - index of the interface
105 */
106 define flowprobe_interface_details
107 {
108   option in_progress;
109   u32 context;
110   vl_api_flowprobe_which_t which;
111   vl_api_flowprobe_direction_t direction;
112   vl_api_interface_index_t sw_if_index;
113 };
114
115 autoreply define flowprobe_params
116 {
117   option replaced_by="flowprobe_set_params";
118
119   u32 client_index;
120   u32 context;
121   vl_api_flowprobe_record_flags_t record_flags;
122   u32 active_timer;  /* ~0 is off, 0 is default */
123   u32 passive_timer; /* ~0 is off, 0 is default */
124   option vat_help = "record <[l2] [l3] [l4]> [active <timer> passive <timer>]";
125 };
126
127 /** \brief Set IPFIX flow record generation parameters
128     @param client_index - opaque cookie to identify the sender
129     @param context - sender context, to match reply w/ request
130     @param record_flags - flags indicating what data to record
131     @param active_timer - time in seconds after which active flow records are
132         to be exported (0 is "off", 0xffffffff is "use default value")
133     @param passive_timer - time in seconds after which passive flow records are
134         to be deleted (0 is "off", 0xffffffff is "use default value")
135 */
136 autoreply define flowprobe_set_params
137 {
138   option in_progress;
139   u32 client_index;
140   u32 context;
141   vl_api_flowprobe_record_flags_t record_flags;
142   u32 active_timer [default=0xffffffff];
143   u32 passive_timer [default=0xffffffff];
144   option vat_help = "record [l2] [l3] [l4] [active <timer>] [passive <timer>]";
145 };
146
147 /** \brief Get IPFIX flow record generation parameters
148     @param client_index - opaque cookie to identify the sender
149     @param context - sender context, to match reply w/ request
150 */
151 define flowprobe_get_params
152 {
153   option in_progress;
154   u32 client_index;
155   u32 context;
156 };
157
158 /** \brief Reply to get IPFIX flow record generation parameters
159     @param context - sender context, to match reply w/ request
160     @param retval - error (0 is "no error")
161     @param record_flags - flags indicating what data to record
162     @param active_timer - time in seconds after which active flow records are
163         to be exported (0 is "off")
164     @param passive_timer - time in seconds after which passive flow records are
165         to be deleted (0 is "off")
166 */
167 define flowprobe_get_params_reply
168 {
169   option in_progress;
170   u32 context;
171   i32 retval;
172   vl_api_flowprobe_record_flags_t record_flags;
173   u32 active_timer;
174   u32 passive_timer;
175 };