gtpu: support non-G-PDU packets and PDU Session
[vpp.git] / src / plugins / gtpu / gtpu.api
1 /*
2  * Copyright (c) 2017 Intel 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 = "2.1.0";
17 import "vnet/interface_types.api";
18 import "vnet/ip/ip_types.api";
19
20 enum gtpu_forwarding_type
21 {
22   GTPU_API_FORWARDING_NONE = 0,
23   GTPU_API_FORWARDING_BAD_HEADER = 1,
24   GTPU_API_FORWARDING_UNKNOWN_TEID = 2,
25   GTPU_API_FORWARDING_UNKNOWN_TYPE = 4,
26 };
27
28 enum gtpu_decap_next_type
29 {
30   GTPU_API_DECAP_NEXT_DROP = 0,
31   GTPU_API_DECAP_NEXT_L2 = 1,
32   GTPU_API_DECAP_NEXT_IP4 = 2,
33   GTPU_API_DECAP_NEXT_IP6 = 3,
34 };
35
36 typedef sw_if_counters
37 {
38   u64 packets_rx;
39   u64 packets_tx;
40   u64 bytes_rx;
41   u64 bytes_tx;
42 };
43
44 /** \brief Create or delete a GTPU tunnel
45     @param client_index - opaque cookie to identify the sender
46     @param context - sender context, to match reply w/ request
47     @param is_add - add address if non-zero, else delete
48     @param src_address - GTPU tunnel's source address.
49     @param dst_address - GTPU tunnel's destination address.
50     @param mcast_sw_if_index - version, O-bit and C-bit (see nsh_packet.h)
51     @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
52     @param decap_next_index - the index of the next node if success
53     @param teid - Local (rx) Tunnel Endpoint Identifier
54     @param tteid - Remote (tx) Tunnel Endpoint Identifier
55 */
56 define gtpu_add_del_tunnel
57 {
58   u32 client_index;
59   u32 context;
60   bool is_add;
61   vl_api_address_t src_address;
62   vl_api_address_t dst_address;
63   vl_api_interface_index_t mcast_sw_if_index;
64   u32 encap_vrf_id;
65   u32 decap_next_index;
66   u32 teid;
67   u32 tteid;
68   option vat_help = "src <ip-addr> {dst <ip-addr> | group <mcast-ip-addr> {<intfc> | mcast_sw_if_index <nn>}} teid <nn> [tteid <nn>] [encap-vrf-id <nn>] [decap-next <l2|nn>] [del]";
69 };
70
71 /** \brief reply for set or delete an GTPU tunnel
72     @param context - sender context, to match reply w/ request
73     @param retval - return code
74     @param sw_if_index - software index of the interface
75 */
76 define gtpu_add_del_tunnel_reply
77 {
78   u32 context;
79   i32 retval;
80   vl_api_interface_index_t sw_if_index;
81 };
82
83 /** \brief Create or delete a GTPU tunnel
84     @param client_index - opaque cookie to identify the sender
85     @param context - sender context, to match reply w/ request
86     @param is_add - add address if non-zero, else delete
87     @param src_address - GTPU tunnel's source address.
88     @param dst_address - GTPU tunnel's destination address.
89     @param mcast_sw_if_index - version, O-bit and C-bit (see nsh_packet.h)
90     @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
91     @param decap_next_index - the index of the next node if success
92     @param teid - Local (rx) Tunnel Endpoint Identifier
93     @param tteid - Remote (tx) Tunnel Endpoint Identifier
94     @param pdu_extension - add PDU session container extension to each packet
95     @param qfi - the QFI to set in the PDU session container, 6 bits only
96 */
97 define gtpu_add_del_tunnel_v2
98 {
99   u32 client_index;
100   u32 context;
101   bool is_add;
102   vl_api_address_t src_address;
103   vl_api_address_t dst_address;
104   vl_api_interface_index_t mcast_sw_if_index;
105   u32 encap_vrf_id;
106   vl_api_gtpu_decap_next_type_t decap_next_index;
107   u32 teid;
108   u32 tteid;
109   bool pdu_extension;
110   u8 qfi;
111   option vat_help = "src <ip-addr> {dst <ip-addr> | group <mcast-ip-addr> {<intfc> | mcast_sw_if_index <nn>}} teid <nn> [tteid <nn>] [encap-vrf-id <nn>] [decap-next <l2|nn>] [qfi <nn>] [del]";
112   option in_progress;
113 };
114
115 /** \brief reply for set or delete an GTPU tunnel
116     @param context - sender context, to match reply w/ request
117     @param retval - return code
118     @param sw_if_index - software index of the interface
119     @param counters - Number of packets/bytes that is sent/received via this tunnel. Inaccurate (with in flight packets), sum for the entire set of per-thread counters. Zero for new tunnels.
120 */
121 define gtpu_add_del_tunnel_v2_reply
122 {
123   u32 context;
124   i32 retval;
125   vl_api_interface_index_t sw_if_index;
126   vl_api_sw_if_counters_t counters;
127   option in_progress;
128 };
129
130 /** \brief Update GTPU tunnel TX TEID
131     @param client_index - opaque cookie to identify the sender
132     @param context - sender context, to match reply w/ request
133     @param dst_address - GTPU tunnel's destination address.
134     @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
135     @param teid - Local (rx) Tunnel Endpoint Identifier
136     @param tteid - remote (tx) Tunnel Endpoint Identifier
137 */
138 autoreply define gtpu_tunnel_update_tteid
139 {
140   u32 client_index;
141   u32 context;
142   vl_api_address_t dst_address;
143   u32 encap_vrf_id;
144   u32 teid;
145   u32 tteid;
146   option vat_help = "dst <ip-addr> teid <nn> tteid <nn> [encap-vrf-id <nn>]";
147 };
148
149 /** \brief Dump GTPU tunnel
150     @param client_index - opaque cookie to identify the sender
151     @param context - sender context, to match reply w/ request
152     @param sw_if_index - software index of the interface
153 */
154 define gtpu_tunnel_dump
155 {
156   u32 client_index;
157   u32 context;
158   vl_api_interface_index_t sw_if_index;
159   option vat_help = "[<intfc> | sw_if_index <nn>]";
160 };
161
162 /** \brief dump details of an GTPU tunnel
163     @param context - sender context, to match reply w/ request
164     @param sw_if_index - software index of the interface
165     @param src_address - GTPU tunnel's source address.
166     @param dst_address - GTPU tunnel's destination address.
167     @param mcast_sw_if_index - version, O-bit and C-bit (see nsh_packet.h)
168     @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
169     @param decap_next_index - the index of the next node if success
170     @param teid - Local (rx) Tunnel Endpoint Identifier
171     @param tteid - Remote (tx) Tunnel Endpoint Identifier
172 */
173 define gtpu_tunnel_details
174 {
175   u32 context;
176   vl_api_interface_index_t sw_if_index;
177   vl_api_address_t src_address;
178   vl_api_address_t dst_address;
179   vl_api_interface_index_t mcast_sw_if_index;
180   u32 encap_vrf_id;
181   u32 decap_next_index;
182   u32 teid;
183   u32 tteid;
184 };
185
186
187 /** \brief Dump GTPU tunnel
188     @param client_index - opaque cookie to identify the sender
189     @param context - sender context, to match reply w/ request
190     @param sw_if_index - software index of the interface
191 */
192 define gtpu_tunnel_v2_dump
193 {
194   u32 client_index;
195   u32 context;
196   vl_api_interface_index_t sw_if_index;
197   option vat_help = "[<intfc> | sw_if_index <nn>]";
198   option in_progress;
199 };
200
201 /** \brief dump details of an GTPU tunnel
202     @param context - sender context, to match reply w/ request
203     @param sw_if_index - software index of the interface
204     @param src_address - GTPU tunnel's source address.
205     @param dst_address - GTPU tunnel's destination address.
206     @param mcast_sw_if_index - version, O-bit and C-bit (see nsh_packet.h)
207     @param encap_vrf_id - fib identifier used for outgoing encapsulated packets
208     @param decap_next_index - the index of the next node if success
209     @param teid - Local (rx) Tunnel Endpoint Identifier
210     @param tteid - Remote (tx) Tunnel Endpoint Identifier
211     @param pdu_extension - add PDU session container extension to each packet
212     @param qfi - the QFI to set in the PDU session container, 6 bits only
213     @param is_forwarding - tunnel used for forwarding packets
214     @param forwarding_type - the type of packets forwarded
215     @param counters - Number of packets/bytes that is sent/received via this tunnel. Inaccurate (with in flight packets), sum for the entire set of per-thread counters.
216 */
217 define gtpu_tunnel_v2_details
218 {
219   u32 context;
220   vl_api_interface_index_t sw_if_index;
221   vl_api_address_t src_address;
222   vl_api_address_t dst_address;
223   vl_api_interface_index_t mcast_sw_if_index;
224   u32 encap_vrf_id;
225   vl_api_gtpu_decap_next_type_t decap_next_index;
226   u32 teid;
227   u32 tteid;
228   bool pdu_extension;
229   u8 qfi;
230   bool is_forwarding;
231   vl_api_gtpu_forwarding_type_t forwarding_type;
232   vl_api_sw_if_counters_t counters;
233   option in_progress;
234 };
235
236 /** \brief Interface set gtpu-bypass request
237     @param client_index - opaque cookie to identify the sender
238     @param context - sender context, to match reply w/ request
239     @param sw_if_index - interface used to reach neighbor
240     @param is_ipv6 - if non-zero, enable ipv6-gtpu-bypass, else ipv4-gtpu-bypass
241     @param enable - if non-zero enable, else disable
242 */
243 autoreply define sw_interface_set_gtpu_bypass
244 {
245   u32 client_index;
246   u32 context;
247   vl_api_interface_index_t sw_if_index;
248   bool is_ipv6;
249   bool enable;
250   option vat_help = "<intfc> | sw_if_index <id> [ip4 | ip6] [enable | disable]";
251 };
252
253 /** \brief Offload gtpu rx request
254     @param client_index - opaque cookie to identify the sender
255     @param context - sender context, to match reply w/ request
256     @param hw_if_index - rx hw interface
257     @param sw_if_index - gtpu interface to offload
258     @param enable - if non-zero enable, else disable
259 */
260 autoreply define gtpu_offload_rx
261 {
262   u32 client_index;
263   u32 context;
264   u32 hw_if_index;
265   u32 sw_if_index;
266   u8 enable;
267   option vat_help = "hw <intfc> rx <tunnel-name> [del]";
268 };
269
270 /** \brief Set gtpu-forward request
271     @param client_index - opaque cookie to identify the sender
272     @param context - sender context, to match reply w/ request
273     @param is_add - add address if non-zero, else delete
274     @param forwarding_type - forward filter (unknown teid, unknown message type or unknown header)
275     @param dst_address - forward destination address.
276     @param encap_vrf_id - fib identifier used for outgoing packets
277     @param decap_next_index - the index of the next node if success
278 */
279 define gtpu_add_del_forward
280 {
281   u32 client_index;
282   u32 context;
283   bool is_add;
284   vl_api_address_t dst_address;
285   vl_api_gtpu_forwarding_type_t forwarding_type;
286   u32 encap_vrf_id;
287   vl_api_gtpu_decap_next_type_t decap_next_index;
288   option vat_help = "dst <ip-addr> {bad-header|unknown-teid|unknown-type} [decap-next <l2|nn>] [del]";
289   option in_progress;
290 };
291
292 /** \brief reply for set or delete GTPU forwarding
293     @param context - sender context, to match reply w/ request
294     @param retval - return code
295     @param sw_if_index - software index of the interface
296 */
297 define gtpu_add_del_forward_reply
298 {
299   u32 context;
300   i32 retval;
301   vl_api_interface_index_t sw_if_index;
302   option in_progress;
303 };
304
305 /** \brief Get list of metrics, use for bulk transfer.
306     @param client_index - opaque cookie to identify the sender
307     @param context - sender context, to match reply w/ request
308     @param sw_if_index_start - software index of the first interface to return data on.
309     @param capacity - max number of interfaces returned.
310 */
311 define gtpu_get_transfer_counts
312 {
313   u32 client_index;
314   u32 context;
315   vl_api_interface_index_t sw_if_index_start;
316   u32 capacity;
317   //option vat_help = "start_index <sw_if_index> count <nn>";
318   option in_progress;
319 };
320
321 /** \brief reply for set or delete GTPU forwarding
322     @param context - sender context, to match reply w/ request
323     @param retval - return code
324     @param count - number of tunnel counters returned, sequential starting at sw_if_index_start.
325     @param tunnels - Number of packets/bytes that is sent/received via this tunnel. Inaccurate (with in flight packets), sum for the entire set of per-thread counters.
326 */
327 typedef tunnel_metrics
328 {
329    vl_api_interface_index_t sw_if_index;
330    u32 reserved;
331    vl_api_sw_if_counters_t counters;
332 };
333
334 define gtpu_get_transfer_counts_reply
335 {
336   u32 context;
337   i32 retval;
338   u32 count;
339   vl_api_tunnel_metrics_t tunnels[count];
340   option in_progress;
341 };
342
343 /*
344  * Local Variables:
345  * eval: (c-set-style "gnu")
346  * End:
347  */