tests: move defaults from defaultmapping to .api files
[vpp.git] / src / plugins / map / map.api
1 /*
2  * Copyright (c) 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 option version = "4.1.1";
17
18 import "vnet/ip/ip_types.api";
19 import "vnet/interface_types.api";
20
21 /** \brief Add MAP domains
22     @param client_index - opaque cookie to identify the sender
23     @param context - sender context, to match reply w/ request
24     @param ip6_prefix - Rule IPv6 prefix
25     @param ip4_prefix - Rule IPv4 prefix
26     @param ip6_src - MAP domain IPv6 BR address / Tunnel source
27     @param ea_bits_len - Embedded Address bits length
28     @param psid_offset - Port Set Identifier (PSID) offset
29     @param psid_length - PSID length
30     @param mtu - MTU. default 1280
31     @param tag - A user field stored with the MAP
32 */
33 define map_add_domain
34 {
35   u32 client_index;
36   u32 context;
37   vl_api_ip6_prefix_t ip6_prefix;
38   vl_api_ip4_prefix_t ip4_prefix;
39   vl_api_ip6_prefix_t ip6_src;
40   u8 ea_bits_len;
41   u8 psid_offset;
42   u8 psid_length;
43   u16 mtu [default=1280];
44   string tag[64];
45 };
46
47 /** \brief Reply for MAP domain add
48     @param context - returned sender context, to match reply w/ request
49     @param index - MAP domain index
50     @param retval - return code
51 */
52 define map_add_domain_reply
53 {
54   u32 context;
55   u32 index;
56   i32 retval;
57 };
58
59 /** \brief Delete MAP domain
60     @param client_index - opaque cookie to identify the sender
61     @param context - sender context, to match reply w/ request
62     @param index - MAP Domain index
63 */
64 autoreply define map_del_domain
65 {
66   u32 client_index;
67   u32 context;
68   u32 index;
69 };
70
71
72 /** \brief Add or Delete MAP rule from a domain (Only used for shared IPv4 per subscriber)
73     @param client_index - opaque cookie to identify the sender
74     @param context - sender context, to match reply w/ request
75     @param index - MAP Domain index
76     @param is_add - If 1 add rule, if 0 delete rule
77     @param ip6_dst - MAP CE IPv6 address
78     @param psid - Rule PSID
79 */
80 autoreply define map_add_del_rule
81 {
82   u32 client_index;
83   u32 context;
84   u32 index;
85   bool is_add;
86   vl_api_ip6_address_t ip6_dst;
87   u16 psid;
88 };
89
90
91 /** \brief Get list of map domains
92     @param client_index - opaque cookie to identify the sender
93 */
94 define map_domain_dump
95 {
96   u32 client_index;
97   u32 context;
98 };
99
100 /** \brief Details about a single MAP domain
101     @param context - returned sender context, to match reply w/ request
102     @param domain_index - MAP domain index
103     @param ip6_prefix - Rule IPv6 prefix
104     @param ip4_prefix - Rule IPv4 prefix
105     @param ip6_src - MAP domain IPv6 BR address / Tunnel source
106     @param ea_bits_len - Embedded Address bits length
107     @param psid_offset - Port Set Identifier (PSID) offset
108     @param psid_length - PSID length
109     @param flags -
110     @param mtu - MTU
111     @param tag - The user field stored with the MAP at creation time
112 */
113 define map_domain_details
114 {
115   u32 context;
116   u32 domain_index;
117   vl_api_ip6_prefix_t ip6_prefix;
118   vl_api_ip4_prefix_t ip4_prefix;
119   vl_api_ip6_prefix_t ip6_src;
120   u8 ea_bits_len;
121   u8 psid_offset;
122   u8 psid_length;
123   u8 flags;
124   u16 mtu;
125   string tag[64];
126 };
127
128 define map_rule_dump
129 {
130   u32 client_index;
131   u32 context;
132   u32 domain_index;
133 };
134
135 define map_rule_details
136 {
137   u32 context;
138   vl_api_ip6_address_t ip6_dst;
139   u16 psid;
140 };
141
142 /** \brief Enable or disable a MAP interface
143     @param client_index - opaque cookie to identify the sender
144     @param context - sender context, to match reply w/ request
145     @param sw_if_index - 
146     @param is_enable - 0=disable, 1=enable interface
147     @param is_translation -  0=encapsulation, 1=translation
148 */
149 autoreply define map_if_enable_disable
150 {
151   u32 client_index;
152   u32 context;
153   vl_api_interface_index_t sw_if_index;
154   bool is_enable;
155   bool is_translation; /* 0 - encapsulation, 1 - translation */
156 };
157
158 /** \brief Request for a single block of summary stats
159     @param client_index - opaque cookie to identify the sender
160     @param context - sender context, to match reply w/ request
161 */
162 define map_summary_stats
163 {
164   u32 client_index;
165   u32 context;
166 };
167
168 /** \brief Reply for map_summary_stats request
169     @param context - sender context, to match reply w/ request
170     @param retval - return code for request
171     @param total_bindings -
172     @param total_pkts -
173     @param total_ip4_fragments -
174     @param total_security_check -
175 */
176 define map_summary_stats_reply
177 {
178   u32 context;
179   i32 retval;
180   u64 total_bindings;
181   u64 total_pkts[2];
182   u64 total_bytes[2];
183   u64 total_ip4_fragments;
184   u64 total_security_check[2];
185 };
186
187
188 /** \brief Set MAP fragmentation parameters
189     @param client_index - opaque cookie to identify the sender
190     @param context - sender context, to match reply w/ request
191     @param inner - 1=frag inner packet, 0=frag tunnel packets
192     @param ignore_df - 1=IP4 fragment despite DF bit, 0=honor DF
193 */
194 autoreply define map_param_set_fragmentation
195 {
196   u32 client_index;
197   u32 context;
198   bool inner;
199   bool ignore_df;
200 };
201
202
203 /** \brief Set MAP ICMP parameters
204     @param client_index - opaque cookie to identify the sender
205     @param context - sender context, to match reply w/ request
206     @param icmp4_err_relay_src - IPv4 ICMP err relay src address
207 */
208 autoreply define map_param_set_icmp
209 {
210   u32 client_index;
211   u32 context;
212   vl_api_ip4_address_t ip4_err_relay_src;
213 };
214
215
216 /** \brief Set MAP ICMP6 parameters
217     @param client_index - opaque cookie to identify the sender
218     @param context - sender context, to match reply w/ request
219     @param enable_unreachable - 1 = send ICMP unreachable err msgs
220 */
221 autoreply define map_param_set_icmp6
222 {
223   u32 client_index;
224   u32 context;
225   bool enable_unreachable;
226 };
227
228
229 /** \brief Add/delete MAP pre-resolve IP addresses parameters
230     @param client_index - opaque cookie to identify the sender
231     @param context - sender context, to match reply w/ request
232     @param is_add - 1 = Add non-zero IP addresses, 0 = delete
233     @param ip4_nh_address - direct IP4 next-hop address
234     @param ip6_nh_address - direct IP6 next-hop address
235 */
236 autoreply define map_param_add_del_pre_resolve
237 {
238   u32 client_index;
239   u32 context;
240   bool is_add;
241   vl_api_ip4_address_t ip4_nh_address;
242   vl_api_ip6_address_t ip6_nh_address;
243 };
244
245 /** \brief Set MAP security-check parameters
246     @param client_index - opaque cookie to identify the sender
247     @param context - sender context, to match reply w/ request
248     @param enable - 1=enable security check on first inbound packet
249     @param fragments - 1=enable check on (subsequent) fragments too
250 */
251 autoreply define map_param_set_security_check
252 {
253   u32 client_index;
254   u32 context;
255   bool enable;
256   bool fragments;
257 };
258
259
260 /** \brief Set MAP traffic class parameters
261     @param client_index - opaque cookie to identify the sender
262     @param context - sender context, to match reply w/ request
263     @param copy - 1 = copy packet class/TOS field, 0 = use tc_class instead
264     @param tc_class - class field value when copy == 0
265 */
266 autoreply define map_param_set_traffic_class
267 {
268   u32 client_index;
269   u32 context;
270   bool copy;
271   u8 tc_class;
272 };
273
274
275 /** \brief Set MAP TCP parameters
276     @param client_index - opaque cookie to identify the sender
277     @param context - sender context, to match reply w/ request
278     @parma tcp_mss - TCP MSS clamping value
279 */
280 autoreply define map_param_set_tcp
281 {
282   u32 client_index;
283   u32 context;
284   u16 tcp_mss;
285 };
286
287
288 /** \brief Request for a single block of MAP parameters
289     @param client_index - opaque cookie to identify the sender
290     @param context - sender context, to match reply w/ request
291 */
292 define map_param_get
293 {
294   u32 client_index;
295   u32 context;
296 };
297
298
299 /** \brief Reply for map_param_get request
300     @param context - sender context, to match reply w/ request
301     @param retval - return code for request
302     @param inner - 1=frag inner packet, 0=frag tunnel packets, ~0=untouched
303     @param ignore_df - 1=IP4 fragm despite DF bit, 0=honor DF, ~0=untouched
304     @param icmp_ip4_err_relay_src - IPv4 ICMP err relay src address
305     @param icmp6_enable_unreachable - 1 = send ICMP unreachable err msgs
306     @param ip4_nh_address - direct IP4 next-hop address
307     @param ip6_nh_address - direct IP6 next-hop address
308     @param sec_check_enable - 1=enable security check on first inbound packet
309     @param sec_check_fragments - 1=enable check on (subsequent) fragments too
310     @param tc_copy - 1 = copy packet class/TOS field, 0 = use class instead
311     @param tc_class - class field value when copy == 0
312 */
313 define map_param_get_reply
314 {
315   u32 context;
316   i32 retval;
317   u8 frag_inner;
318   u8 frag_ignore_df;
319   vl_api_ip4_address_t icmp_ip4_err_relay_src;
320   bool icmp6_enable_unreachable;
321   vl_api_ip4_address_t ip4_nh_address;
322   vl_api_ip6_address_t ip6_nh_address;
323   u16 ip4_lifetime_ms;
324   u16 ip4_pool_size;
325   u32 ip4_buffers;
326   f64 ip4_ht_ratio;
327   bool sec_check_enable;
328   bool sec_check_fragments;
329   bool tc_copy;
330   u8 tc_class;
331 };