interface.api revision c12eae73
1/* Hey Emacs use -*- mode: C -*- */
2/*
3 * Copyright (c) 2018 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17option version = "3.2.1";
18
19import "vnet/interface_types.api";
20import "vnet/ethernet/ethernet_types.api";
21import "vnet/ip/ip_types.api";
22
23service {
24  rpc want_interface_events returns want_interface_events_reply
25    events sw_interface_event;
26};
27
28/** \brief Set flags on the interface
29    @param client_index - opaque cookie to identify the sender
30    @param context - sender context, to match reply w/ request
31    @param sw_if_index - index of the interface to set flags on
32    @param flags - interface_status flags
33        (only IF_STATUS_API_FLAG_ADMIN_UP used in config)
34*/
35autoreply define sw_interface_set_flags
36{
37  u32 client_index;
38  u32 context;
39  vl_api_interface_index_t sw_if_index;
40  vl_api_if_status_flags_t flags;
41};
42
43/** \brief Set interface physical MTU
44    @param client_index - opaque cookie to identify the sender
45    @param context - sender context, to match reply w/ request
46    @param sw_if_index - index of the interface to set MTU on
47    @param mtu - MTU
48*/
49autoreply define hw_interface_set_mtu
50{
51  u32 client_index;
52  u32 context;
53  vl_api_interface_index_t sw_if_index;
54  u16 mtu;
55};
56
57/** \brief Set interface L3 MTU */
58autoreply define sw_interface_set_mtu
59{
60  u32 client_index;
61  u32 context;
62  vl_api_interface_index_t sw_if_index;
63  u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
64};
65
66/** \brief Set IP4 directed broadcast
67    The directed broadcast enabled a packet sent to the interface's
68    subnet address will be broadcast on the interface
69    @param sw_if_index
70    @param enable
71*/
72autoreply define sw_interface_set_ip_directed_broadcast
73{
74  u32 client_index;
75  u32 context;
76  vl_api_interface_index_t sw_if_index;
77  bool  enable;
78};
79
80/** \brief Interface Event generated by want_interface_events
81    @param client_index - opaque cookie to identify the sender
82    @param pid - client pid registered to receive notification
83    @param sw_if_index - index of the interface of the event
84    @param flags - interface_status flags
85    @param deleted - interface was deleted
86*/
87define sw_interface_event
88{
89  u32 client_index;
90  u32 pid;
91  vl_api_interface_index_t sw_if_index;
92  vl_api_if_status_flags_t flags;
93  bool deleted;
94};
95
96/** \brief Register for interface events
97    @param client_index - opaque cookie to identify the sender
98    @param context - sender context, to match reply w/ request
99    @param enable_disable - 1 => register for events, 0 => cancel registration
100    @param pid - sender's pid
101*/
102autoreply define want_interface_events
103{
104  u32 client_index;
105  u32 context;
106  u32 enable_disable;
107  u32 pid;
108};
109
110/** \brief Interface details structure (fix this)
111    @param sw_if_index - index of the interface
112    @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
113    @param l2_address - the interface's l2 address
114    @param flags - interface_status flags
115    @param type - interface type
116    @param link_duplex - 1 if half duplex, 2 if full duplex
117    @param link_speed - value in kbps
118    @param link_MTU - max. transmission unit
119    @param sub_id - A number 0-N to uniquely identify this subif on super if
120    @param sub_number_of_tags - Number of tags (0 - 2)
121    @param sub_outer_vlan_id
122    @param sub_inner_vlan_id
123    @param sub_if_flags - sub interface flags
124    @param vtr_op - vlan tag rewrite operation
125    @param vtr_push_dot1q
126    @param vtr_tag1
127    @param vtr_tag2
128    @param pbb_outer_tag - translate pbb s-tag
129    @param pbb_b_dmac[6] - B-tag remote mac address
130    @param pbb_b_smac[6] - B-tag local mac address
131    @param pbb_b_vlanid - B-tag vlanid
132    @param pbb_i_sid - I-tag service id
133    @param interface_name - name of the interface
134    @param interface_dev_type - device type of the interface
135    @param tag - an ascii tag
136*/
137define sw_interface_details
138{
139  u32 context;
140  vl_api_interface_index_t sw_if_index;
141
142  /* index of sup interface (e.g. hw interface).
143     equal to sw_if_index for super hw interface. */
144  u32 sup_sw_if_index;
145
146  /* Layer 2 address, if applicable */
147  vl_api_mac_address_t l2_address;
148
149  vl_api_if_status_flags_t flags;
150
151  vl_api_if_type_t type;
152
153  /* 1 = half duplex, 2 = full duplex */
154  vl_api_link_duplex_t link_duplex;
155
156  /* link speed in kbps */
157  u32 link_speed;
158
159  /* MTU */
160  u16 link_mtu;
161
162  /* Per protocol MTUs */
163  u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
164
165  /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
166  u32 sub_id;
167
168  /* Number of tags 0-2 */
169  u8 sub_number_of_tags;
170  u16 sub_outer_vlan_id;
171  u16 sub_inner_vlan_id;
172
173  vl_api_sub_if_flags_t sub_if_flags;
174
175  /* vlan tag rewrite state */
176  u32 vtr_op;
177  u32 vtr_push_dot1q;		// ethertype of first pushed tag is dot1q/dot1ad
178  u32 vtr_tag1;			// first pushed tag
179  u32 vtr_tag2;			// second pushed tag
180
181  /* pbb tag rewrite info */
182  u16 outer_tag;
183  vl_api_mac_address_t  b_dmac;
184  vl_api_mac_address_t  b_smac;
185  u16 b_vlanid;
186  u32 i_sid;
187
188  /* Interface name */
189  string interface_name[64];
190  string interface_dev_type[64];
191  string tag[64];
192};
193
194/** \brief Request all or filtered subset of sw_interface_details
195    @param client_index - opaque cookie to identify the sender
196    @param context - sender context, to match reply w/ request
197    @param sw_if_index - index of the interface to dump info on, 0 or ~0 if on all
198      TODO: Support selecting only index==0 when CSIT is ready.
199    @param name_filter_valid - 1 if requesting a filtered subset of records else 0
200      if name filter is set as valid, sw_if_index value is ignored and all interfaces are examined
201    @param name_filter - interface name substring filter. Eg. loop1 returns [loop1, loop10]
202*/
203define sw_interface_dump
204{
205  u32 client_index;
206  u32 context;
207  vl_api_interface_index_t sw_if_index;
208  bool name_filter_valid;
209  string name_filter[];
210};
211
212/** \brief Set or delete one or all ip addresses on a specified interface
213    @param client_index - opaque cookie to identify the sender
214    @param context - sender context, to match reply w/ request
215    @param sw_if_index - index of the interface to add/del addresses
216    @param is_add - add address if non-zero, else delete
217    @param del_all - if non-zero delete all addresses on the interface
218    @param prefix - address + a prefix length for the implied connected route
219*/
220autoreply define sw_interface_add_del_address
221{
222  u32 client_index;
223  u32 context;
224  vl_api_interface_index_t sw_if_index;
225  bool is_add;
226
227  bool del_all;
228  vl_api_address_with_prefix_t prefix;
229};
230
231/** \brief Associate the specified interface with a fib table
232    @param client_index - opaque cookie to identify the sender
233    @param context - sender context, to match reply w/ request
234    @param sw_if_index - index of the interface
235    @param is_ipv6 - if non-zero ipv6, else ipv4
236    @param vrf_id - fib table/vrf id to associate the interface with
237*/
238autoreply define sw_interface_set_table
239{
240  u32 client_index;
241  u32 context;
242  vl_api_interface_index_t sw_if_index;
243  bool is_ipv6;
244  u32 vrf_id;
245};
246
247/** \brief Get VRF id assigned to interface
248    @param client_index - opaque cookie to identify the sender
249    @param context - sender context, to match reply w/ request
250    @param sw_if_index - index of the interface
251*/
252define sw_interface_get_table
253{
254  u32 client_index;
255  u32 context;
256  vl_api_interface_index_t sw_if_index;
257  bool is_ipv6;
258};
259
260/** \brief Reply to get_sw_interface_vrf
261    @param context - sender context which was passed in the request
262    @param vrf_id - VRF id assigned to the interface
263*/
264define sw_interface_get_table_reply
265{
266  u32 context;
267  i32 retval;
268  u32 vrf_id;
269};
270
271/** \brief Set unnumbered interface add / del request
272    @param client_index - opaque cookie to identify the sender
273    @param context - sender context, to match reply w/ request
274    @param sw_if_index - interface with an IP address
275    @param unnumbered_sw_if_index - interface which will use the address
276    @param is_add - if non-zero set the association, else unset it
277*/
278autoreply define sw_interface_set_unnumbered
279{
280  u32 client_index;
281  u32 context;
282  vl_api_interface_index_t sw_if_index;		/* use this intfc address */
283  vl_api_interface_index_t unnumbered_sw_if_index;	/* on this interface */
284  bool is_add;
285};
286
287/** \brief Clear interface statistics
288    @param client_index - opaque cookie to identify the sender
289    @param context - sender context, to match reply w/ request
290    @param sw_if_index - index of the interface to clear statistics
291*/
292autoreply define sw_interface_clear_stats
293{
294  u32 client_index;
295  u32 context;
296  vl_api_interface_index_t sw_if_index;
297};
298
299/** \brief Set / clear software interface tag
300    @param client_index - opaque cookie to identify the sender
301    @param context - sender context, to match reply w/ request
302    @param sw_if_index - the interface
303    @param add_del - 1 = add, 0 = delete
304    @param tag - an ascii tag
305*/
306autoreply define sw_interface_tag_add_del
307{
308  u32 client_index;
309  u32 context;
310  bool is_add;
311  vl_api_interface_index_t sw_if_index;
312  string tag[64];
313};
314
315/** \brief Add or delete a secondary MAC address on an interface
316    @param client_index - opaque cookie to identify the sender
317    @param context - sender context, to match reply w/ request
318    @param sw_if_index - the interface whose MAC will be set
319    @param mac_addr - the new MAC address
320    @param is_add - 0 to delete, != 0 to add
321*/
322autoreply define sw_interface_add_del_mac_address
323{
324    u32 client_index;
325    u32 context;
326    u32 sw_if_index;
327    vl_api_mac_address_t addr;
328    u8 is_add;
329};
330
331/** \brief Set an interface's MAC address
332    @param client_index - opaque cookie to identify the sender
333    @param context - sender context, to match reply w/ request
334    @param sw_if_index - the interface whose MAC will be set
335    @param mac_addr - the new MAC address
336*/
337autoreply define sw_interface_set_mac_address
338{
339  u32 client_index;
340  u32 context;
341  vl_api_interface_index_t sw_if_index;
342  vl_api_mac_address_t mac_address;
343};
344
345/** \brief Get interface's MAC address
346    @param client_index - opaque cookie to identify the sender
347    @param context - sender context, to match reply w/ request
348    @param sw_if_index - the interface whose MAC will be returned
349*/
350define sw_interface_get_mac_address
351{
352  u32 client_index;
353  u32 context;
354  vl_api_interface_index_t sw_if_index;
355};
356
357/** \brief Reply for get interface's MAC address request
358    @param context - returned sender context, to match reply w/ request
359    @param retval - return code
360    @param mac_addr - returned interface's MAC address
361*/
362define sw_interface_get_mac_address_reply
363{
364  u32 context;
365  i32 retval;
366  vl_api_mac_address_t mac_address;
367};
368
369/** \brief Set an interface's rx-mode
370    @param client_index - opaque cookie to identify the sender
371    @param context - sender context, to match reply w/ request
372    @param sw_if_index - the interface whose rx-mode will be set
373    @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
374      queue_id's
375    @param queue_id - the queue number whose rx-mode will be set. Only valid
376      if queue_id_valid is 1
377    @param mode - polling=1, interrupt=2, adaptive=3
378*/
379autoreply define sw_interface_set_rx_mode
380{
381  u32 client_index;
382  u32 context;
383  vl_api_interface_index_t sw_if_index;
384  bool queue_id_valid;
385  u32 queue_id;
386  vl_api_rx_mode_t mode;
387};
388
389/** \brief Set an interface's rx-placement
390    Rx-Queue placement on specific thread is operational for only hardware
391    interface. It will not set queue - thread placement for sub-interfaces,
392    p2p and pipe interfaces.
393    @param client_index - opaque cookie to identify the sender
394    @param context - sender context, to match reply w/ request
395    @param sw_if_index - the interface whose rx-placement will be set
396    @param queue_id - the queue number whose rx-placement will be set.
397    @param worker_id - the worker number whom rx-placement will be at.
398    @param is_main - flag to set rx-placement to main thread
399*/
400autoreply define sw_interface_set_rx_placement
401{
402    u32 client_index;
403    u32 context;
404    vl_api_interface_index_t sw_if_index;
405    u32 queue_id;
406    u32 worker_id;
407    bool is_main;
408};
409
410/** \brief dump the rx queue placement of interface(s)
411    @param sw_if_index - optional interface index for which queue placement to
412      be requested. sw_if_index = ~0 will dump placement information for all
413      interfaces. It will not dump information related to sub-interfaces, p2p
414      and pipe interfaces.
415*/
416define sw_interface_rx_placement_dump
417{
418  u32 client_index;
419  u32 context;
420  vl_api_interface_index_t sw_if_index;
421};
422
423/** \brief show the interface's queue - thread placement
424    This api is used to display the interface and queue worker
425    thread placement. One message per rx-queue per interface will
426    be sent to client.
427    Each message will contain information about rx-queue id of an
428    interface, interface index, thread on which this rx-queue is
429    placed and mode of rx-queue.
430    @param client_index - opaque cookie to identify the sender
431    @param context - sender context, to match reply w/ request
432    @param sw_if_index - the interface whose rx-placement will be dumped
433    @param queue_id - the queue id
434    @param worker_id - the worker id on which queue_id is placed,
435                       worker_id = 0 means main thread.
436    @param mode - polling=1, interrupt=2, adaptive=3
437*/
438define sw_interface_rx_placement_details
439{
440  u32 client_index;
441  u32 context;
442  vl_api_interface_index_t sw_if_index;
443  u32 queue_id;
444  u32 worker_id;
445  vl_api_rx_mode_t mode;
446};
447
448/* Gross kludge, DGMS */
449autoreply define interface_name_renumber
450{
451  u32 client_index;
452  u32 context;
453  vl_api_interface_index_t sw_if_index;
454  u32 new_show_dev_instance;
455};
456
457define create_subif
458{
459  u32 client_index;
460  u32 context;
461  vl_api_interface_index_t sw_if_index;
462  u32 sub_id;
463
464  vl_api_sub_if_flags_t sub_if_flags;
465  u16 outer_vlan_id;
466  u16 inner_vlan_id;
467};
468
469define create_subif_reply
470{
471  u32 context;
472  i32 retval;
473  vl_api_interface_index_t sw_if_index;
474};
475
476/** \brief Create a new subinterface with the given vlan id
477    @param client_index - opaque cookie to identify the sender
478    @param context - sender context, to match reply w/ request
479    @param sw_if_index - software index of the new vlan's parent interface
480    @param vlan_id - vlan tag of the new interface
481*/
482define create_vlan_subif
483{
484  u32 client_index;
485  u32 context;
486  vl_api_interface_index_t sw_if_index;
487  u32 vlan_id;
488};
489
490/** \brief Reply for the vlan subinterface create request
491    @param context - returned sender context, to match reply w/ request
492    @param retval - return code
493    @param sw_if_index - software index allocated for the new subinterface
494*/
495define create_vlan_subif_reply
496{
497  u32 context;
498  i32 retval;
499  vl_api_interface_index_t sw_if_index;
500};
501
502/** \brief Delete sub interface request
503    @param client_index - opaque cookie to identify the sender
504    @param context - sender context, to match reply w/ request
505    @param sw_if_index - sw index of the interface that was created by create_subif
506*/
507autoreply define delete_subif {
508  u32 client_index;
509  u32 context;
510  vl_api_interface_index_t sw_if_index;
511};
512
513/** \brief Create loopback interface request
514    @param client_index - opaque cookie to identify the sender
515    @param context - sender context, to match reply w/ request
516    @param mac_address - mac addr to assign to the interface if none-zero
517*/
518define create_loopback
519{
520  u32 client_index;
521  u32 context;
522  vl_api_mac_address_t mac_address;
523};
524
525/** \brief Create loopback interface response
526    @param context - sender context, to match reply w/ request
527    @param sw_if_index - sw index of the interface that was created
528    @param retval - return code for the request
529*/
530define create_loopback_reply
531{
532  u32 context;
533  i32 retval;
534  vl_api_interface_index_t sw_if_index;
535};
536
537/** \brief Create loopback interface instance request
538    @param client_index - opaque cookie to identify the sender
539    @param context - sender context, to match reply w/ request
540    @param mac_address - mac addr to assign to the interface if none-zero
541    @param is_specified - if non-0, a specific user_instance is being requested
542    @param user_instance - requested instance, ~0 => dynamically allocate
543*/
544define create_loopback_instance
545{
546  u32 client_index;
547  u32 context;
548  vl_api_mac_address_t mac_address;
549  bool is_specified;
550  u32 user_instance;
551};
552
553/** \brief Create loopback interface instance response
554    @param context - sender context, to match reply w/ request
555    @param sw_if_index - sw index of the interface that was created
556    @param retval - return code for the request
557*/
558define create_loopback_instance_reply
559{
560  u32 context;
561  i32 retval;
562  vl_api_interface_index_t sw_if_index;
563};
564
565/** \brief Delete loopback interface request
566    @param client_index - opaque cookie to identify the sender
567    @param context - sender context, to match reply w/ request
568    @param sw_if_index - sw index of the interface that was created
569*/
570autoreply define delete_loopback
571{
572  u32 client_index;
573  u32 context;
574  vl_api_interface_index_t sw_if_index;
575};
576
577/** \brief Enable or disable detailed interface stats
578    @param client_index - opaque cookie to identify the sender
579    @param context - sender context, to match reply w/ request
580    @param sw_if_index - The interface to collect detail stats on. ~0 implies
581                         all interfaces.
582    @param enable_disable - set to 1 to enable, 0 to disable detailed stats
583*/
584autoreply define collect_detailed_interface_stats
585{
586  u32 client_index;
587  u32 context;
588  vl_api_interface_index_t sw_if_index;
589  bool  enable_disable;
590};
591
592/*
593 * Local Variables:
594 * eval: (c-set-style "gnu")
595 * End:
596 */
597