lb: add APIs for set interface nat4 and nat6
[vpp.git] / src / plugins / lb / lb.api
1 option version = "1.0.0";
2 import "plugins/lb/lb_types.api";
3 import "vnet/interface_types.api";
4
5 /** \brief Configure Load-Balancer global parameters (unlike the CLI, both ip4_src_address and ip6_src_address need to be specified.
6     @param client_index - opaque cookie to identify the sender
7     @param context - sender context, to match reply w/ request
8     @param ip4_src_address - IPv4 address to be used as source for IPv4 traffic(applicable in GRE4/GRE6/NAT4/NAT6 mode only).
9     @param ip6_src_address - IPv6 address to be used as source for IPv6 traffic(applicable in GRE4/GRE6/NAT4/NAT6 mode only).
10     @param sticky_buckets_per_core - Number of buckets *per worker thread* in the
11            established flow table (must be power of 2).
12     @param flow_timeout - Time in seconds after which, if no packet is received
13            for a given flow, the flow is removed from the established flow table.
14 */
15 autoreply manual_print define lb_conf
16 {
17   u32 client_index;
18   u32 context;
19   vl_api_ip4_address_t ip4_src_address;
20   vl_api_ip6_address_t ip6_src_address;
21   u32 sticky_buckets_per_core;
22   u32 flow_timeout;
23 };
24
25 /** \brief Add a virtual address (or prefix)
26     @param client_index - opaque cookie to identify the sender
27     @param context - sender context, to match reply w/ request
28     @param pfx - ip prefix and length
29     @param protocol - tcp or udp.
30     @param port - destination port. (0) means 'all-port VIP'
31     @param encap - Encap is ip4 GRE(0) or ip6 GRE(1) or L3DSR(2) or NAT4(3) or NAT6(4).
32     @param dscp - DSCP bit corresponding to VIP(applicable in L3DSR mode only).
33     @param type - service type(applicable in NAT4/NAT6 mode only).
34     @param target_port - Pod's port corresponding to specific service(applicable in NAT4/NAT6 mode only).
35     @param node_port - Node's port(applicable in NAT4/NAT6 mode only).
36     @param new_flows_table_length - Size of the new connections flow table used
37            for this VIP (must be power of 2).
38     @param is_del - The VIP should be removed.
39 */
40 autoreply manual_print define lb_add_del_vip {
41   u32 client_index;
42   u32 context;
43   vl_api_address_with_prefix_t pfx;
44   u8 protocol [default=255];
45   u16 port;
46   vl_api_lb_encap_type_t encap;
47   u8 dscp;
48   vl_api_lb_srv_type_t type ; /* LB_API_SRV_TYPE_CLUSTERIP */
49   u16 target_port;
50   u16 node_port;
51   u32 new_flows_table_length [default=1024];
52   bool is_del;
53 };
54
55 /** \brief Add an application server for a given VIP
56     @param client_index - opaque cookie to identify the sender
57     @param context - sender context, to match reply w/ request
58     @param pfx - ip prefix and length
59     @param protocol - tcp or udp.
60     @param port - destination port.
61     @param as_address - The application server address (IPv4 in lower order 32 bits).
62     @param is_del - The AS should be removed.
63     @param is_flush - The sessions related to this AS should be flushed.
64 */
65 autoreply manual_print define lb_add_del_as {
66   u32 client_index;
67   u32 context;
68   vl_api_address_with_prefix_t pfx;
69   u8 protocol [default=255];
70   u16 port;
71   vl_api_address_t as_address;
72   bool is_del;
73   bool is_flush;
74 };
75
76 /** \brief Flush a given vip
77     @param client_index - opaque cookie to identify the sender
78     @param context - sender context, to match reply w/ request
79     @param pfx - ip prefix and length
80     @param protocol - tcp or udp.
81     @param port - destination port.
82 */
83 autoreply manual_print define lb_flush_vip {
84   u32 client_index;
85   u32 context;
86   vl_api_address_with_prefix_t pfx;
87   u8 protocol;
88   u16 port;
89 };
90
91 /** \brief Dump all vips
92     @param client_index - opaque cookie to identify the sender
93     @param context - sender context, to match reply w/ request
94 */
95 define lb_vip_dump{
96   u32 client_index;
97   u32 context;
98   vl_api_address_with_prefix_t pfx;
99   vl_api_prefix_matcher_t pfx_matcher;
100   u8 protocol [default=255];
101   u16 port;
102
103 };
104
105 /** \brief Reply all configured vip
106     @param context - sender context, to match reply w/ request
107     @param vip - all vip addrs.
108 */
109 define lb_vip_details {
110   u32 context;
111   vl_api_lb_vip_t vip;
112   vl_api_lb_encap_type_t encap;
113   vl_api_ip_dscp_t dscp;
114   vl_api_lb_srv_type_t srv_type;
115   u16 target_port;
116   u16 flow_table_length;
117 };
118
119 /** \brief dump AS list per VIP or all ASs for all VIPs
120     @param client_index - opaque cookie to identify the sender
121     @param context - sender context, to match reply w/ request
122     @param pfx - ip prefix and length.
123     @param protocol - tcp or udp.
124     @param port - destination port.
125 */
126 define lb_as_dump{
127   u32 client_index;
128   u32 context;
129   /* vip */
130   vl_api_address_with_prefix_t pfx;
131   u8 protocol;
132   u16 port;
133 };
134
135 /** \brief lb_as_details
136     @param context - sender context, to match reply w/ request
137     @param as - AS detail record
138 */
139 define lb_as_details {
140   u32 context;
141   vl_api_lb_vip_t vip;
142   vl_api_address_t app_srv;
143   u8 flags;
144   u32 in_use_since;
145 };
146
147 /** \brief Enable/disable NAT4 feature on the interface
148     @param client_index - opaque cookie to identify the sender
149     @param context - sender context, to match reply w/ request
150     @param is_add - true if add, false if delete
151     @param sw_if_index - software index of the interface
152 */
153 autoreply define lb_add_del_intf_nat4 {
154   u32 client_index;
155   u32 context;
156   bool is_add;
157   vl_api_interface_index_t sw_if_index;
158 };
159
160 /** \brief Enable/disable NAT6 feature on the interface
161     @param client_index - opaque cookie to identify the sender
162     @param context - sender context, to match reply w/ request
163     @param is_add - true if add, false if delete
164     @param sw_if_index - software index of the interface
165 */
166 autoreply define lb_add_del_intf_nat6 {
167   u32 client_index;
168   u32 context;
169   bool is_add;
170   vl_api_interface_index_t sw_if_index;
171 };