aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip-neighbor/ip_neighbor.api
blob: a04fcbc569e4ea749ef5e176ad85332bf27222e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
/* Hey Emacs use -*- mode: C -*- */
/*
 * Copyright (c) 2018 Cisco and/or its affiliates.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** \file

    This file defines vpp IP neighbor control-plane API messages which are generally
    called through a shared memory interface. 
*/

option version = "1.0.0";

import "vnet/ip/ip_types.api";
import "vnet/ethernet/ethernet_types.api";
import "vnet/interface_types.api";

/** \brief IP neighbor flags
    @param is_static - A static neighbor Entry - there are not flushed
                       If the interface goes down.
    @param is_no_fib_entry - Do not create a corresponding entry in the FIB
                           table for the neighbor.
*/
enum ip_neighbor_flags: u8
{
  IP_API_NEIGHBOR_FLAG_NONE = 0,
  IP_API_NEIGHBOR_FLAG_STATIC = 0x1,
  IP_API_NEIGHBOR_FLAG_NO_FIB_ENTRY = 0x2,
};

/** \brief IP neighbor
    @param sw_if_index - interface used to reach neighbor
    @param flags - flags for the neighbor
    @param mac_address - l2 address of the neighbor
    @param ip_address - ip4 or ip6 address of the neighbor
*/
typedef ip_neighbor {
  vl_api_interface_index_t sw_if_index;
  vl_api_ip_neighbor_flags_t flags;
  vl_api_mac_address_t mac_address;
  vl_api_address_t ip_address;
};

/** \brief IP neighbor add / del request
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param is_add - 1 to add neighbor, 0 to delete
    @param neighbor - the neighbor to add/remove
*/
define ip_neighbor_add_del
{
  u32 client_index;
  u32 context;
  /* 1 = add, 0 = delete */
  bool is_add;
  vl_api_ip_neighbor_t neighbor;
};
/** \brief IP neighbor add / del reply
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param retval - return value
    @param stats_index - the index to use for this neighbor in the stats segment
*/
define ip_neighbor_add_del_reply
{
  u32 context;
  i32 retval;
  u32 stats_index;
};

/** \brief Dump IP neighbors
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param sw_if_index - the interface to dump neighbors, ~0 == all
    @param af - address family is ipv[6|4]
*/
define ip_neighbor_dump
{
  u32 client_index;
  u32 context;
  vl_api_interface_index_t sw_if_index  [default=0xffffffff];
  vl_api_address_family_t af;
};

/** \brief IP neighbors dump response
    @param context - sender context which was passed in the request
    @param age - time between last update and sending this message, in seconds
    @param neighbour - the neighbor
*/
define ip_neighbor_details {
  u32 context;
  f64 age;
  vl_api_ip_neighbor_t neighbor;
};

/** \brief Enable/disable periodic IP neighbor scan
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param af - Address family v4/v6
    @param max_number - The maximum number of neighbours that will be created.
                         default 50k
    @param max_age - The maximum age (in seconds) before an inactive neighbour
                     is flushed
                         default 0 => never
    @param recycle - If max_number of neighbours is reached and new ones need
                      to be created should the oldest neighbour be 'recycled'.
*/
autoreply define ip_neighbor_config
{
  u32 client_index;
  u32 context;
  vl_api_address_family_t af;
  u32 max_number;
  u32 max_age;
  bool recycle;
};

/** \brief IP neighbour replace begin

    The use-case is that, for some unspecified reason, the control plane
    has a different set of neighbours it than VPP
    currently has. The CP would thus like to 'replace' VPP's set
    only by specifying what the new set shall be, i.e. it is not
    going to delete anything that already exists, rather, it wants any
    unspecified neighbors deleted implicitly.
    The CP declares the start of this procedure with this replace_begin
    API Call, and when it has populated all neighbours it wants, it calls
    the below replace_end API. From this point on it is of course free
    to add and delete neighbours as usual.
    The underlying mechanism by which VPP implements this replace is
    intentionally left unspecified.

    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
autoreply define ip_neighbor_replace_begin
{
  u32 client_index;
  u32 context;
};

/** \brief IP neighbour replace end

    see ip_neighbor_replace_begin description.

    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
*/
autoreply define ip_neighbor_replace_end
{
  u32 client_index;
  u32 context;
};

/** \brief IP neighbor flush request - removes *all* neighbours.
     dynamic and static from API/CLI and dynamic from data-plane.

    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param af - Flush neighbours of this address family
    @param sw_if_index - Flush on this interface (~0 => all interfaces)
*/
autoreply define ip_neighbor_flush
{
  u32 client_index;
  u32 context;
  vl_api_address_family_t af;
  vl_api_interface_index_t sw_if_index [default=0xffffffff];
};

/** \brief Register for IP neighbour events creation
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
    @param ip - exact IP address of interested neighbor resolution event
    @param sw_if_index - interface on which the IP address is present.
*/
autoreply define want_ip_neighbor_events
{
  option deprecated;
  u32 client_index;
  u32 context;
  bool enable;
  u32 pid;
  vl_api_address_t ip;
  vl_api_interface_index_t sw_if_index [default=0xffffffff];
};

/** \brief Tell client about an IP4 ARP resolution event or
           MAC/IP info from ARP requests in L2 BDs
    @param client_index - opaque cookie to identify the sender
    @param pid - client pid registered to receive notification
    @param neighbor - new neighbor created
*/
define ip_neighbor_event
{
  option deprecated;
  u32 client_index;
  u32 pid;
  vl_api_ip_neighbor_t neighbor;
};

service {
  rpc want_ip_neighbor_events returns want_ip_neighbor_events_reply
    events ip_neighbor_event;
};


/** \brief Register for IP neighbour events (creation or deletion)
    @param client_index - opaque cookie to identify the sender
    @param context - sender context, to match reply w/ request
    @param enable - 1 => register for events, 0 => cancel registration
    @param pid - sender's pid
    @param ip - exact IP address of interested neighbor resolution event
    @param sw_if_index - interface on which the IP address is present.
*/
autoreply define want_ip_neighbor_events_v2
{
  u32 client_index;
  u32 context;
  bool enable;
  u32 pid;
  vl_api_address_t ip;
  vl_api_interface_index_t sw_if_index [default=0xffffffff];
};

enum ip_neighbor_event_flags
{
 /* The neighbor has been added/learned */
 IP_NEIGHBOR_API_EVENT_FLAG_ADDED = 0x1,
 /* The neighbor has been removed/expired */
 IP_NEIGHBOR_API_EVENT_FLAG_REMOVED = 0x2,
};

/** \brief Tell client about an IP4 ARP resolution event or
           MAC/IP info from ARP requests in L2 BDs
    @param client_index - opaque cookie to identify the sender
    @param pid - client pid registered to receive notification
    @param flags - Flags
    @param neighbor -  neighbor
*/
define ip_neighbor_event_v2
{
  u32 client_index;
  u32 pid;
  vl_api_ip_neighbor_event_flags_t flags;
  vl_api_ip_neighbor_t neighbor;
};

service {
  rpc want_ip_neighbor_events_v2 returns want_ip_neighbor_events_v2_reply
    events ip_neighbor_event_v2;
};

counters ip4_neighbor {
  throttled {
    severity info;
    type counter64;
    units "packets";
    description "ARP requests throttled";
  };
  resolved {
    severity info;
    type counter64;
    units "packets";
    description "ARP requests resolved";
  };
  no_buffers {
    severity error;
    type counter64;
    units "packets";
    description "ARP requests out of buffer";
  };
  request_sent {
    severity info;
    type counter64;
    units "packets";
    description "ARP requests sent";
  };
  non_arp_adj {
    severity error;
    type counter64;
    units "packets";
    description "ARPs to non-ARP adjacencies";
  };
  no_source_address {
    severity error;
    type counter64;
    units "packets";
    description "no source address for ARP request";
  };
};

counters ip6_neighbor {
  throttled {
    severity info;
    type counter64;
    units "packets";
    description "throttled";
  };
  drop {
    severity error;
    type counter64;
    units "packets";
    description "address overflow drops";
  };
  request_sent {
    severity info;
    type counter64;
    units "packets";
    description "neighbor solicitations sent";
  };
  no_source_address {
    severity error;
    type counter64;
    units "packets";
    description "no source address for ND solicitation";
  };
  no_buffers {
    severity error;
    type counter64;
    units "packets";
    description "no buffers";
  };
};

paths {
  "/err/ip4-arp" "ip4_neighbor";
  "/err/ip4-glean" "ip4_neighbor";
  "/err/ip6-arp" "ip6_neighbor";
  "/err/ip6-glean" "ip6_neighbor";
};

/*
 * Local Variables:
 * eval: (c-set-style "gnu")
 * End:
 */