linux-cp: A V2 variant of pair create API that returns the host
[vpp.git] / src / plugins / linux-cp / lcp.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Linux Control Plane API
4  *
5  * Copyright 2020 Rubicon Communications, LLC.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at:
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 option version = "1.0.0";
21
22 import "vnet/interface_types.api";
23
24 /** \brief Set the default Linux Control Plane namespace
25     @param client_index - opaque cookie to identify the sender
26     @param context - sender context, to match reply w/ request
27     @param namespace - the new default namespace; namespace[0] == 0 iff none
28 */
29 autoreply define lcp_default_ns_set
30 {
31   u32 client_index;
32   u32 context;
33   string namespace[32];         /* LCP_NS_LEN */
34 };
35
36 /** \brief get the default Linux Control Plane namespace
37     @param client_index - opaque cookie to identify the sender
38     @param context - sender context, to match reply w/ request
39 */
40 define lcp_default_ns_get
41 {
42   u32 client_index;
43   u32 context;
44 };
45
46 /** \brief get the default Linux Control Plane namespace
47     @param client_index - opaque cookie to identify the sender
48     @param context - sender context, to match reply w/ request
49     @param namespace - the default namespace; namespace[0] == 0 iff none
50 */
51 define lcp_default_ns_get_reply
52 {
53   u32 context;
54   string namespace[32];         /* LCP_NS_LEN */
55 };
56
57 enum lcp_itf_host_type : u8
58 {
59   LCP_API_ITF_HOST_TAP = 0,
60   LCP_API_ITF_HOST_TUN = 1,
61 };
62
63 /** \brief Add or delete a Linux Conrol Plane interface pair
64     @param client_index - opaque cookie to identify the sender
65     @param context - sender context, to match reply w/ request
66     @param is_add - 0 if deleting, != 0 if adding
67     @param sw_if_index - index of VPP PHY SW interface
68     @param host_if_name - host tap interface name
69     @param host_if_type - the type of host interface to create (tun, tap)
70     @param namespace - optional tap namespace; namespace[0] == 0 iff none
71 */
72 autoreply autoendian define lcp_itf_pair_add_del
73 {
74   u32 client_index;
75   u32 context;
76   bool is_add;
77   vl_api_interface_index_t sw_if_index;
78   string host_if_name[16];              /* IFNAMSIZ */
79   vl_api_lcp_itf_host_type_t host_if_type;
80   string namespace[32];                 /* LCP_NS_LEN */
81 };
82 autoendian define lcp_itf_pair_add_del_v2
83 {
84   u32 client_index;
85   u32 context;
86   bool is_add;
87   vl_api_interface_index_t sw_if_index;
88   string host_if_name[16];              /* IFNAMSIZ */
89   vl_api_lcp_itf_host_type_t host_if_type;
90   string namespace[32];                 /* LCP_NS_LEN */
91 };
92 define lcp_itf_pair_add_del_v2_reply
93 {
94   u32 context;
95   i32 retval;
96   vl_api_interface_index_t host_sw_if_index;
97 };
98
99 /** \brief Dump Linux Control Plane interface pair data
100     @param client_index - opaque cookie to identify the sender
101     @param context - sender context, to match reply w/ request
102     @param sw_if_index - interface to use as filter (~0 == "all")
103 */
104 define lcp_itf_pair_get
105 {
106   u32 client_index;
107   u32 context;
108   u32 cursor;
109 };
110 define lcp_itf_pair_get_reply
111 {
112   u32 context;
113   i32 retval;
114   u32 cursor;
115 };
116
117 /** \brief Linux Control Plane interface pair dump response
118     @param context - sender context which was passed in the request
119     @param phy_sw_if_index - VPP's sw_if_index for the PHY
120     @param host_sw_if_index - VPP's sw_if_index for the host tap
121     @param vif_index - tap linux index
122     @param host_if_name - host interface name
123     @param host_if_type - host interface type (tun, tap)
124     @param namespace - host interface namespace
125 */
126 autoendian define lcp_itf_pair_details
127 {
128   u32 context;
129   vl_api_interface_index_t phy_sw_if_index;
130   vl_api_interface_index_t host_sw_if_index;
131   u32 vif_index;
132   string host_if_name[16];      /* IFNAMSIZ */
133   vl_api_lcp_itf_host_type_t host_if_type;
134   string namespace[32];         /* LCP_NS_LEN */
135 };
136
137 service {
138   rpc lcp_itf_pair_get returns lcp_itf_pair_get_reply
139     stream lcp_itf_pair_details;
140 };
141
142 /** \brief Replace end/begin
143  */
144 autoreply define lcp_itf_pair_replace_begin
145 {
146   u32 client_index;
147   u32 context;
148 };
149 autoreply define lcp_itf_pair_replace_end
150 {
151   u32 client_index;
152   u32 context;
153 };
154
155 /*
156  * Linux-CP Error counters/messages
157  */
158 counters linuxcp {
159   packets {
160     severity info;
161     type counter64;
162     units "packets";
163     description "ARP packets processed";
164   };
165   copies {
166     severity info;
167     type counter64;
168     units "packets";
169     description "ARP replies copied to host";
170   };
171 };
172
173 paths {
174   "/err/linux-cp-arp-phy" "linuxcp";
175   "/err/linux-cp-arp-host" "linuxcp";
176 };
177
178 /*
179  * Local Variables:
180  * eval: (c-set-style "gnu")
181  * End:
182  */