hs-test: logging improvements
[vpp.git] / src / plugins / vrrp / vrrp.api
1 /*
2  * Copyright 2019-2020 Rubicon Communications, LLC (Netgate)
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  *
6  */
7
8 option version = "1.1.1";
9
10 import "vnet/interface_types.api";
11 import "vnet/ip/ip_types.api";
12 import "vnet/ethernet/ethernet_types.api";
13
14 typedef vrrp_vr_key
15 {
16   vl_api_interface_index_t sw_if_index;
17   u8 vr_id;
18   u8 is_ipv6;
19 };
20
21 enum vrrp_vr_flags
22 {
23   VRRP_API_VR_PREEMPT = 0x1,
24   VRRP_API_VR_ACCEPT = 0x2,
25   VRRP_API_VR_UNICAST = 0x4,
26   VRRP_API_VR_IPV6 = 0x8,
27 };
28
29 typedef vrrp_vr_conf
30 {
31   vl_api_interface_index_t sw_if_index;
32   u8 vr_id;
33   u8 priority;
34   u16 interval;
35   vl_api_vrrp_vr_flags_t flags;
36 };
37
38 /** \brief VRRP: Add or delete a VRRP virtual router
39     @param client_index - opaque cookie to identify the sender
40     @param context - sender context, to match reply w/ request
41     @param is_add - 0 if deleting, != 0 if adding
42     @param sw_if_index - interface backed up by this vr
43     @param vr_id - the VR ID advertised by this vr
44     @param priority - the priority advertised for this vr
45     @param interval - interval between advertisements in centiseconds
46     @param flags - bit flags for booleans - preempt, accept, unicast, ipv6
47     @param n_addrs - number of addresses being backed up by this vr
48     @param addrs - the addresses backed up by this vr
49 */
50 autoreply define vrrp_vr_add_del {
51   u32 client_index;
52   u32 context;
53   u8 is_add;
54   vl_api_interface_index_t sw_if_index;
55   u8 vr_id;
56   u8 priority;
57   u16 interval;
58   vl_api_vrrp_vr_flags_t flags;
59   u8 n_addrs;
60   vl_api_address_t addrs[n_addrs];
61 };
62
63 /** @brief Replace an existing VRRP virtual router in-place or create a new one
64     @param client_index - opaque cookie to identify the sender
65     @param context - sender context, to match reply w/ request
66     @param vrrp_index - an existing VRRP entry to replace, or 0xffffffff to crate a new one
67     @param sw_if_index - interface backed up by this vr
68     @param vr_id - the VR ID advertised by this vr
69     @param priority - the priority advertised for this vr
70     @param interval - interval between advertisements in centiseconds
71     @param flags - bit flags for booleans - preempt, accept, unicast, ipv6
72     @param n_addrs - number of addresses being backed up by this vr
73     @param addrs - the addresses backed up by this vr
74 */
75 define vrrp_vr_update {
76   u32 client_index;
77   u32 context;
78   u32 vrrp_index;
79   vl_api_interface_index_t sw_if_index;
80   u8 vr_id;
81   u8 priority;
82   u16 interval;
83   vl_api_vrrp_vr_flags_t flags;
84   u8 n_addrs;
85   vl_api_address_t addrs[n_addrs];
86 };
87
88 /**
89  * @brief Reply to a VRRP add/replace
90  * @param context - returned sender context, to match reply w/ request
91  * @param vrrp_index - index of the updated or newly created VRRP instance
92  * @param retval 0 - no error
93  */
94 define vrrp_vr_update_reply {
95   u32 context;
96   i32 retval;
97   u32 vrrp_index;
98 };
99
100 /**
101  * @brief Delete an existing VRRP instance
102  * @param client_index - opaque cookie to identify the sender
103  * @param context - returned sender context, to match reply w/ request
104  * @param vrrp_index - index of the VRRP instance to delete
105  */
106 autoreply define vrrp_vr_del {
107   u32 client_index;
108   u32 context;
109   u32 vrrp_index;
110 };
111
112 /** \brief VRRP: dump virtual router data
113     @param client_index - opaque cookie to identify the sender
114     @param context - sender context, to match reply w/ request
115     @param sw_if_index - interface to use as filter (0,~0 == "all")
116 */
117 define vrrp_vr_dump {
118   u32 client_index;
119   u32 context;
120   vl_api_interface_index_t sw_if_index;
121 };
122
123 enum vrrp_vr_state
124 {
125   VRRP_API_VR_STATE_INIT = 0,
126   VRRP_API_VR_STATE_BACKUP,
127   VRRP_API_VR_STATE_MASTER,
128   VRRP_API_VR_STATE_INTF_DOWN,
129 };
130
131 typedef vrrp_vr_tracking
132 {
133   u32 interfaces_dec;
134   u8 priority;
135 };
136
137 typedef vrrp_vr_runtime
138 {
139   vl_api_vrrp_vr_state_t state;
140   u16 master_adv_int;
141   u16 skew;
142   u16 master_down_int;
143   vl_api_mac_address_t mac;
144   vl_api_vrrp_vr_tracking_t tracking;
145 };
146
147 /** \brief VRRP: VR dump response
148     @param context - sender context which was passed in the request
149     @param conf - configuration parameters for the VR
150     @param runtime - runtime state for the VR
151 */
152 define vrrp_vr_details {
153   u32 context;
154   vl_api_vrrp_vr_conf_t config;
155   vl_api_vrrp_vr_runtime_t runtime;
156   u8 n_addrs;
157   vl_api_address_t addrs[n_addrs];
158 };
159
160 /** \brief VRRP: start or shutdown the VRRP protocol for a virtual router
161     @param client_index - opaque cookie to identify the sender
162     @param context - sender context, to match reply w/ request
163     @param sw_if_index - interface ID that VR is backing up
164     @param vr_id - VR ID
165     @param is_ipv6 - 1 for IPv6, 0 for IPv4
166     @param is_start - 1 to start VRRP proto on this VR, 0 to shutdown
167 */
168 autoreply define vrrp_vr_start_stop {
169   u32 client_index;
170   u32 context;
171   vl_api_interface_index_t sw_if_index;
172   u8 vr_id;
173   u8 is_ipv6;
174   u8 is_start;
175 };
176
177 /** \brief VRRP: set unicast peers for a VR
178     @param client_index - opaque cookie to identify the sender
179     @param context - sender context, to match reply w/ request
180     @param sw_if_index - interface ID that VR is backing up
181     @param vr_id - VR ID
182     @param is_ipv6 - 1 for IPv6, 0 for IPv4
183     @param n_addrs - number of peer addresses
184     @param addrs - peer addresses 
185 */
186 autoreply define vrrp_vr_set_peers {
187   u32 client_index;
188   u32 context;
189   vl_api_interface_index_t sw_if_index;
190   u8 vr_id;
191   u8 is_ipv6;
192   u8 n_addrs;
193   vl_api_address_t addrs[n_addrs];
194 };
195
196 /** \brief VRRP: dump virtual router peer address data
197     @param client_index - opaque cookie to identify the sender
198     @param context - sender context, to match reply w/ request
199     @param sw_if_index - interface (0,~0 == "all" -> ignore is_ipv6 & vr_id))
200     @param is_ipv6 - 0 -> IPv4, 1 -> IPv6
201     @param vr_id - ID of VR to dump
202 */
203 define vrrp_vr_peer_dump {
204   u32 client_index;
205   u32 context;
206   vl_api_interface_index_t sw_if_index;
207   u8 is_ipv6;
208   u8 vr_id;
209 };
210
211 /** \brief VRRP: VR peer dump response
212     @param context - sender context which was passed in the request
213     @param sw_if_index - interface index
214     @param is_ipv6 - 0 -> IPv4, 1 -> IPv6
215     @param vr_id - ID of VR
216     @param n_peer_addrs - number of peer addresses
217     @param peer_addrs - peer addresses 
218 */
219 define vrrp_vr_peer_details {
220   u32 client_index;
221   u32 context;
222   vl_api_interface_index_t sw_if_index;
223   u8 vr_id;
224   u8 is_ipv6;
225   u8 n_peer_addrs;
226   vl_api_address_t peer_addrs[n_peer_addrs];
227 };
228
229 /** \brief VR interface tracking
230     @param sw_if_index - the interface index to track (not the VR sw_if_index)
231     @param priority - the adjustment to VR priority if intf is down
232 */
233 typedef vrrp_vr_track_if
234 {
235   vl_api_interface_index_t sw_if_index;
236   u8 priority;
237 };
238
239 /** \brief VRRP: Add/delete VR priority tracking of interface status
240     @param context - sender context which was passed in the request
241     @param sw_if_index - interface index
242     @param is_ipv6 - 0 -> IPv4, 1 -> IPv6
243     @param vr_id - ID of VR
244     @param is_add - 0 -> delete, 1 -> add
245     @param n_ifs - number of interface tracking records
246     @param ifs - array of interface tracking records
247 */
248 autoreply define vrrp_vr_track_if_add_del
249 {
250   u32 client_index;
251   u32 context;
252   vl_api_interface_index_t sw_if_index;
253   u8 is_ipv6;
254   u8 vr_id;
255   u8 is_add;
256   u8 n_ifs;
257   vl_api_vrrp_vr_track_if_t ifs[n_ifs];
258 };
259
260 /** \brief VRRP: dump virtual router interface tracking data
261     @param client_index - opaque cookie to identify the sender
262     @param context - sender context, to match reply w/ request
263     @param sw_if_index - interface
264     @param is_ipv6 - 0 -> IPv4, 1 -> IPv6
265     @param vr_id - ID of VR to dump
266     @param dump_all - dump all VR interface tracking, ignore other fields
267 */
268 define vrrp_vr_track_if_dump {
269   u32 client_index;
270   u32 context;
271   vl_api_interface_index_t sw_if_index;
272   u8 is_ipv6;
273   u8 vr_id;
274   u8 dump_all;
275 };
276
277 /** \brief VRRP: VR interface tracking dump response
278     @param context - sender context which was passed in the request
279     @param sw_if_index - interface index
280     @param is_ipv6 - 0 -> IPv4, 1 -> IPv6
281     @param vr_id - ID of VR
282     @param n_ifs - number of tracked interfaces
283     @param ifs - array of tracked interface data
284 */
285 define vrrp_vr_track_if_details {
286   u32 client_index;
287   u32 context;
288   vl_api_interface_index_t sw_if_index;
289   u8 vr_id;
290   u8 is_ipv6;
291   u8 n_ifs;
292   vl_api_vrrp_vr_track_if_t ifs[n_ifs];
293 };
294
295 /** \brief Notification about VRRP VR state change event
296     @param client_index - opaque cookie to identify the sender
297     @param pid - client pid registered to receive notification
298     @param vr - configuration parameters identifying the VR
299     @param old_state - old state of VR
300     @param new_state - new state of VR
301 */
302 define vrrp_vr_event
303 {
304   u32 client_index;
305   u32 pid;
306   vl_api_vrrp_vr_key_t vr;
307   vl_api_vrrp_vr_state_t old_state;
308   vl_api_vrrp_vr_state_t new_state;
309 };
310
311 service {
312   rpc want_vrrp_vr_events returns want_vrrp_vr_events_reply
313     events vrrp_vr_event;
314 };
315
316 /** \brief Register for VRRP VR state change events
317     @param client_index - opaque cookie to identify the sender
318     @param context - sender context, to match reply w/ request
319     @param enable_disable - 1 to register, 0 to cancel registration
320     @param pid - sender's pid
321 */
322 autoreply define want_vrrp_vr_events
323 {
324   u32 client_index;
325   u32 context;
326   bool enable_disable;
327   u32 pid;
328 };