linux-cp: Linux Interface Mirroring for Control Plane Integration
[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
83 /** \brief Dump Linux Control Plane interface pair data
84     @param client_index - opaque cookie to identify the sender
85     @param context - sender context, to match reply w/ request
86     @param sw_if_index - interface to use as filter (~0 == "all")
87 */
88 autoendian define lcp_itf_pair_get
89 {
90   u32 client_index;
91   u32 context;
92   u32 cursor;
93 };
94 autoendian define lcp_itf_pair_get_reply
95 {
96   u32 context;
97   i32 retval;
98   u32 cursor;
99 };
100
101 /** \brief Linux Control Plane interface pair dump response
102     @param context - sender context which was passed in the request
103     @param phy_sw_if_index - VPP's sw_if_index for the PHY
104     @param host_sw_if_index - VPP's sw_if_index for the host tap
105     @param vif_index - tap linux index
106     @param host_if_name - host interface name
107     @param host_if_type - host interface type (tun, tap)
108     @param namespace - host interface namespace
109 */
110 autoendian define lcp_itf_pair_details
111 {
112   u32 context;
113   vl_api_interface_index_t phy_sw_if_index;
114   vl_api_interface_index_t host_sw_if_index;
115   u32 vif_index;
116   string host_if_name[16];      /* IFNAMSIZ */
117   vl_api_lcp_itf_host_type_t host_if_type;
118   string namespace[32];         /* LCP_NS_LEN */
119 };
120
121 service {
122   rpc lcp_itf_pair_get returns lcp_itf_pair_get_reply
123     stream lcp_itf_pair_details;
124 };
125
126 /** \brief Replace end/begin
127  */
128 autoreply define lcp_itf_pair_replace_begin
129 {
130   u32 client_index;
131   u32 context;
132 };
133 autoreply define lcp_itf_pair_replace_end
134 {
135   u32 client_index;
136   u32 context;
137 };
138
139 /*
140  * Linux-CP Error counters/messages
141  */
142 counters linuxcp {
143   packets {
144     severity info;
145     type counter64;
146     units "packets";
147     description "ARP packets processed";
148   };
149   copies {
150     severity info;
151     type counter64;
152     units "packets";
153     description "ARP replies copied to host";
154   };
155 };
156
157 paths {
158   "/err/linux-cp-arp-phy" "linuxcp";
159   "/err/linux-cp-arp-host" "linuxcp";
160 };
161
162 /*
163  * Local Variables:
164  * eval: (c-set-style "gnu")
165  * End:
166  */