lb: remove api boilerplate
[vpp.git] / src / plugins / lb / lb.api
index 545d6b1..e30bab6 100644 (file)
@@ -1,6 +1,8 @@
 option version = "1.0.0";
+import "plugins/lb/lb_types.api";
+import "vnet/interface_types.api";
 
-/** \brief Configure Load-Balancer global parameters
+/** \brief Configure Load-Balancer global parameters (unlike the CLI, both ip4_src_address and ip6_src_address need to be specified.
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
     @param ip4_src_address - IPv4 address to be used as source for IPv4 traffic(applicable in GRE4/GRE6/NAT4/NAT6 mode only).
@@ -10,23 +12,23 @@ option version = "1.0.0";
     @param flow_timeout - Time in seconds after which, if no packet is received
            for a given flow, the flow is removed from the established flow table.
 */
-autoreply define lb_conf
+autoreply manual_print define lb_conf
 {
   u32 client_index;
   u32 context;
-  u32 ip4_src_address;
-  u8 ip6_src_address[16];
+  vl_api_ip4_address_t ip4_src_address;
+  vl_api_ip6_address_t ip6_src_address;
   u32 sticky_buckets_per_core;
   u32 flow_timeout;
+  option vat_help = "[ip4-src-address <addr>] [ip6-src-address <addr>] [buckets <n>] [timeout <s>]";
 };
 
 /** \brief Add a virtual address (or prefix)
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
-    @param ip_prefix - IP address (IPv4 in lower order 32 bits).
-    @param prefix_length - IP prefix length (96 + 'IPv4 prefix length' for IPv4).
+    @param pfx - ip prefix and length
     @param protocol - tcp or udp.
-    @param port - destination port.
+    @param port - destination port. (0) means 'all-port VIP'
     @param encap - Encap is ip4 GRE(0) or ip6 GRE(1) or L3DSR(2) or NAT4(3) or NAT6(4).
     @param dscp - DSCP bit corresponding to VIP(applicable in L3DSR mode only).
     @param type - service type(applicable in NAT4/NAT6 mode only).
@@ -36,42 +38,138 @@ autoreply define lb_conf
            for this VIP (must be power of 2).
     @param is_del - The VIP should be removed.
 */
-autoreply define lb_add_del_vip {
+autoreply manual_print define lb_add_del_vip {
   u32 client_index;
   u32 context;
-  u8 ip_prefix[16];
-  u8 prefix_length;
-  u8 protocol;
+  vl_api_address_with_prefix_t pfx;
+  u8 protocol [default=255];
   u16 port;
-  u8 encap;
+  vl_api_lb_encap_type_t encap;
   u8 dscp;
-  u8 type;
+  vl_api_lb_srv_type_t type ; /* LB_API_SRV_TYPE_CLUSTERIP */
   u16 target_port;
   u16 node_port;
-  u32 new_flows_table_length;
-  u8 is_del;
+  u32 new_flows_table_length [default=1024];
+  bool is_del;
+  option vat_help = "<prefix> [protocol (tcp|udp) port <n>] [encap (gre6|gre4|l3dsr|nat4|nat6)] [dscp <n>] [type (nodeport|clusterip) target_port <n>] [new_len <n>] [del]";
 };
 
 /** \brief Add an application server for a given VIP
     @param client_index - opaque cookie to identify the sender
     @param context - sender context, to match reply w/ request
-    @param vip_ip_prefix - VIP IP address (IPv4 in lower order 32 bits).
-    @param vip_prefix_length - VIP IP prefix length (96 + 'IPv4 prefix length' for IPv4).
+    @param pfx - ip prefix and length
     @param protocol - tcp or udp.
     @param port - destination port.
     @param as_address - The application server address (IPv4 in lower order 32 bits).
     @param is_del - The AS should be removed.
     @param is_flush - The sessions related to this AS should be flushed.
 */
-autoreply define lb_add_del_as {
+autoreply manual_print define lb_add_del_as {
+  u32 client_index;
+  u32 context;
+  vl_api_address_with_prefix_t pfx;
+  u8 protocol [default=255];
+  u16 port;
+  vl_api_address_t as_address;
+  bool is_del;
+  bool is_flush;
+  option vat_help = "<vip-prefix> [protocol (tcp|udp) port <n>] [<address>] [del] [flush]";
+};
+
+/** \brief Flush a given vip
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param pfx - ip prefix and length
+    @param protocol - tcp or udp.
+    @param port - destination port.
+*/
+autoreply manual_print define lb_flush_vip {
+  u32 client_index;
+  u32 context;
+  vl_api_address_with_prefix_t pfx;
+  u8 protocol;
+  u16 port;
+};
+
+/** \brief Dump all vips
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define lb_vip_dump{
+  u32 client_index;
+  u32 context;
+  vl_api_address_with_prefix_t pfx;
+  vl_api_prefix_matcher_t pfx_matcher;
+  u8 protocol [default=255];
+  u16 port;
+
+};
+
+/** \brief Reply all configured vip
+    @param context - sender context, to match reply w/ request
+    @param vip - all vip addrs.
+*/
+define lb_vip_details {
+  u32 context;
+  vl_api_lb_vip_t vip;
+  vl_api_lb_encap_type_t encap;
+  vl_api_ip_dscp_t dscp;
+  vl_api_lb_srv_type_t srv_type;
+  u16 target_port;
+  u16 flow_table_length;
+};
+
+/** \brief dump AS list per VIP or all ASs for all VIPs
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param pfx - ip prefix and length.
+    @param protocol - tcp or udp.
+    @param port - destination port.
+*/
+define lb_as_dump{
   u32 client_index;
   u32 context;
-  u8 vip_ip_prefix[16];
-  u8 vip_prefix_length;
+  /* vip */
+  vl_api_address_with_prefix_t pfx;
   u8 protocol;
   u16 port;
-  u8 as_address[16];
-  u8 is_del;
-  u8 is_flush;
+  option vat_help = "<vip-prefix> [protocol (tcp|udp) port <n>]";
+};
+
+/** \brief lb_as_details
+    @param context - sender context, to match reply w/ request
+    @param as - AS detail record
+*/
+define lb_as_details {
+  u32 context;
+  vl_api_lb_vip_t vip;
+  vl_api_address_t app_srv;
+  u8 flags;
+  u32 in_use_since;
+};
+
+/** \brief Enable/disable NAT4 feature on the interface
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - true if add, false if delete
+    @param sw_if_index - software index of the interface
+*/
+autoreply define lb_add_del_intf_nat4 {
+  u32 client_index;
+  u32 context;
+  bool is_add;
+  vl_api_interface_index_t sw_if_index;
 };
 
+/** \brief Enable/disable NAT6 feature on the interface
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - true if add, false if delete
+    @param sw_if_index - software index of the interface
+*/
+autoreply define lb_add_del_intf_nat6 {
+  u32 client_index;
+  u32 context;
+  bool is_add;
+  vl_api_interface_index_t sw_if_index;
+};