bond: Add bonding driver and LACP protocol
[vpp.git] / src / vpp / api / custom_dump.c
index 49fe2a8..ded6e7d 100644 (file)
@@ -26,6 +26,7 @@
 #include <vnet/l2/l2_input.h>
 #include <vnet/srv6/sr.h>
 #include <vnet/srmpls/sr_mpls.h>
+#include <vnet/gre/gre.h>
 #include <vnet/vxlan-gpe/vxlan_gpe.h>
 #include <vnet/geneve/geneve.h>
 #include <vnet/classify/policer_classify.h>
@@ -46,6 +47,8 @@
 
 #include <vpp/api/vpe_msg_enum.h>
 
+#include <vnet/bonding/node.h>
+
 #define vl_typedefs            /* define message structures */
 #include <vpp/api/vpe_all_api_h.h>
 #undef vl_typedefs
@@ -557,7 +560,7 @@ static void *vl_api_tap_create_v2_t_print
   memset (null_mac, 0, sizeof (null_mac));
 
   s = format (0, "SCRIPT: tap_create_v2 ");
-  s = format (s, "id %s ", mp->id);
+  s = format (s, "id %u ", mp->id);
   if (memcmp (mp->mac_address, null_mac, 6))
     s = format (s, "mac-address %U ",
                format_ethernet_address, mp->mac_address);
@@ -608,6 +611,84 @@ static void *vl_api_sw_interface_tap_v2_dump_t_print
   FINISH;
 }
 
+static void *vl_api_bond_create_t_print
+  (vl_api_bond_create_t * mp, void *handle)
+{
+  u8 *s;
+  u8 null_mac[6];
+
+  memset (null_mac, 0, sizeof (null_mac));
+
+  s = format (0, "SCRIPT: bond_create ");
+  if (memcmp (mp->mac_address, null_mac, 6))
+    s = format (s, "mac-address %U ",
+               format_ethernet_address, mp->mac_address);
+  if (mp->mode)
+    s = format (s, "mode %U", format_bond_mode, mp->mode);
+  if (mp->lb)
+    s = format (s, "lb %U", format_bond_load_balance, mp->lb);
+  FINISH;
+}
+
+static void *vl_api_bond_delete_t_print
+  (vl_api_bond_delete_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: bond_delete ");
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+  FINISH;
+}
+
+static void *vl_api_bond_enslave_t_print
+  (vl_api_bond_enslave_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: bond_enslave ");
+  s = format (s, "bond_sw_if_index %u ", mp->bond_sw_if_index);
+  s = format (s, "sw_if_index %u ", mp->sw_if_index);
+  if (mp->is_passive)
+    s = format (s, "passive ");
+  if (mp->is_long_timeout)
+    s = format (s, "long-timeout ");
+
+  FINISH;
+}
+
+static void *vl_api_bond_detach_slave_t_print
+  (vl_api_bond_detach_slave_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: bond_detach_slave ");
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+  FINISH;
+}
+
+static void *vl_api_sw_interface_bond_dump_t_print
+  (vl_api_sw_interface_bond_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: sw_interface_bond_dump ");
+
+  FINISH;
+}
+
+static void *vl_api_sw_interface_slave_dump_t_print
+  (vl_api_sw_interface_slave_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: sw_interface_slave_dump ");
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+  FINISH;
+}
+
 static void *vl_api_ip_add_del_route_t_print
   (vl_api_ip_add_del_route_t * mp, void *handle)
 {
@@ -1622,9 +1703,14 @@ static void *vl_api_gre_add_del_tunnel_t_print
              (ip46_address_t *) & (mp->src_address),
              mp->is_ipv6 ? IP46_TYPE_IP6 : IP46_TYPE_IP4);
 
-  if (mp->teb)
+  s = format (s, "instance %d ", ntohl (mp->instance));
+
+  if (mp->tunnel_type == GRE_TUNNEL_TYPE_TEB)
     s = format (s, "teb ");
 
+  if (mp->tunnel_type == GRE_TUNNEL_TYPE_ERSPAN)
+    s = format (s, "erspan %d ", ntohs (mp->session_id));
+
   if (mp->outer_fib_id)
     s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
 
@@ -1806,9 +1892,15 @@ static void *vl_api_cli_inband_t_print
   (vl_api_cli_inband_t * mp, void *handle)
 {
   u8 *s;
+  u8 *cmd = 0;
+  u32 length = ntohl (mp->length);
+
+  vec_validate (cmd, length);
+  clib_memcpy (cmd, mp->cmd, length);
 
-  s = format (0, "SCRIPT: cli_inband ");
+  s = format (0, "SCRIPT: exec %v ", cmd);
 
+  vec_free (cmd);
   FINISH;
 }
 
@@ -3345,6 +3437,10 @@ _(TAP_CONNECT, tap_connect)                                             \
 _(TAP_MODIFY, tap_modify)                                               \
 _(TAP_DELETE, tap_delete)                                               \
 _(SW_INTERFACE_TAP_DUMP, sw_interface_tap_dump)                         \
+_(BOND_CREATE, bond_create)                                             \
+_(BOND_DELETE, bond_delete)                                             \
+_(BOND_ENSLAVE, bond_enslave)                                           \
+_(BOND_DETACH_SLAVE, bond_detach_slave)                                 \
 _(TAP_CREATE_V2, tap_create_v2)                                         \
 _(TAP_DELETE_V2, tap_delete_v2)                                         \
 _(SW_INTERFACE_TAP_V2_DUMP, sw_interface_tap_v2_dump)                   \