VPP-376: Refactor LISP dump API + VAT
[vpp.git] / vpp / vpp-api / custom_dump.c
index 5ca7ccc..a92e680 100644 (file)
@@ -2093,12 +2093,12 @@ static void *vl_api_classify_session_dump_t_print
   FINISH;
 }
 
-static void *vl_api_ipfix_enable_t_print
-  (vl_api_ipfix_enable_t * mp, void *handle)
+static void *vl_api_set_ipfix_exporter_t_print
+  (vl_api_set_ipfix_exporter_t * mp, void *handle)
 {
   u8 *s;
 
-  s = format (0, "SCRIPT: ipfix_enable ");
+  s = format (0, "SCRIPT: set_ipfix_exporter ");
 
   s = format (s, "collector-address %U ", format_ip4_address,
              (ip4_address_t *) mp->collector_address);
@@ -2108,16 +2108,64 @@ static void *vl_api_ipfix_enable_t_print
   s = format (s, "vrf-id %d ", ntohl (mp->vrf_id));
   s = format (s, "path-mtu %d ", ntohl (mp->path_mtu));
   s = format (s, "template-interval %d ", ntohl (mp->template_interval));
+  s = format (s, "udp-checksum %d ", mp->udp_checksum);
 
   FINISH;
 }
 
-static void *vl_api_ipfix_dump_t_print
-  (vl_api_ipfix_dump_t * mp, void *handle)
+static void *vl_api_ipfix_exporter_dump_t_print
+  (vl_api_ipfix_exporter_dump_t * mp, void *handle)
 {
   u8 *s;
 
-  s = format (0, "SCRIPT: ipfix_dump ");
+  s = format (0, "SCRIPT: ipfix_exporter_dump ");
+
+  FINISH;
+}
+
+static void *vl_api_set_ipfix_classify_stream_t_print
+  (vl_api_set_ipfix_classify_stream_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: set_ipfix_classify_stream ");
+
+  s = format (s, "domain-id %d ", ntohl (mp->domain_id));
+  s = format (s, "src-port %d ", ntohs (mp->src_port));
+
+  FINISH;
+}
+
+static void *vl_api_ipfix_classify_stream_dump_t_print
+  (vl_api_ipfix_classify_stream_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: ipfix_classify_stream_dump ");
+
+  FINISH;
+}
+
+static void *vl_api_ipfix_classify_table_add_del_t_print
+  (vl_api_ipfix_classify_table_add_del_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: ipfix_classify_table_add_del ");
+
+  s = format (s, "table-id %d ", ntohl (mp->table_id));
+  s = format (s, "ip-version %d ", mp->ip_version);
+  s = format (s, "transport-protocol %d ", mp->transport_protocol);
+
+  FINISH;
+}
+
+static void *vl_api_ipfix_classify_table_dump_t_print
+  (vl_api_ipfix_classify_table_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: ipfix_classify_table_dump ");
 
   FINISH;
 }
@@ -2289,24 +2337,6 @@ format_lisp_flat_eid (u8 * s, va_list * args)
   return 0;
 }
 
-static u8 *
-format_lisp_eid_vat (u8 * s, va_list * args)
-{
-  u32 type = va_arg (*args, u32);
-  u8 *eid = va_arg (*args, u8 *);
-  u32 eid_len = va_arg (*args, u32);
-  u8 *seid = va_arg (*args, u8 *);
-  u32 seid_len = va_arg (*args, u32);
-  u32 is_src_dst = va_arg (*args, u32);
-
-  if (is_src_dst)
-    s = format (s, "%U|", format_lisp_flat_eid, type, seid, seid_len);
-
-  s = format (s, "%U", format_lisp_flat_eid, type, eid, eid_len);
-
-  return s;
-}
-
 /** Used for transferring locators via VPP API */
 typedef CLIB_PACKED (struct
                     {
@@ -2349,9 +2379,14 @@ static void *vl_api_lisp_add_del_remote_mapping_t_print
   s = format (s, "%s ", mp->is_add ? "add" : "del");
   s = format (s, "vni %d ", clib_net_to_host_u32 (mp->vni));
 
-  s = format (s, "deid %U ", format_lisp_eid_vat,
-             mp->eid_type, mp->eid, mp->eid_len, mp->seid, mp->seid_len,
-             mp->is_src_dst);
+  s = format (s, "eid %U ", format_lisp_flat_eid,
+             mp->eid_type, mp->eid, mp->eid_len);
+
+  if (mp->is_src_dst)
+    {
+      s = format (s, "seid %U ", format_lisp_flat_eid,
+                 mp->eid_type, mp->seid, mp->seid_len);
+    }
 
   rloc_num = clib_net_to_host_u32 (mp->rloc_num);
 
@@ -2537,8 +2572,24 @@ static void *vl_api_lisp_locator_set_dump_t_print
   u8 *s;
 
   s = format (0, "SCRIPT: lisp_locator_set_dump ");
+  if (mp->filter == 1)
+    s = format (s, "local");
+  else if (mp->filter == 2)
+    s = format (s, "remote");
 
-  /* not possible to reconstruct original VAT command */
+  FINISH;
+}
+
+static void *vl_api_lisp_locator_dump_t_print
+  (vl_api_lisp_locator_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: lisp_locator_dump ");
+  if (mp->is_index_set)
+    s = format (s, "ls_index %d", clib_net_to_host_u32 (mp->ls_index));
+  else
+    s = format (s, "ls_name %s", mp->ls_name);
 
   FINISH;
 }
@@ -2733,8 +2784,12 @@ _(CLASSIFY_TABLE_IDS,classify_table_ids)                                \
 _(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface)             \
 _(CLASSIFY_TABLE_INFO,classify_table_info)                              \
 _(CLASSIFY_SESSION_DUMP,classify_session_dump)                          \
-_(IPFIX_ENABLE,ipfix_enable)                                            \
-_(IPFIX_DUMP,ipfix_dump)                                                \
+_(SET_IPFIX_EXPORTER, set_ipfix_exporter)                               \
+_(IPFIX_EXPORTER_DUMP, ipfix_exporter_dump)                             \
+_(SET_IPFIX_CLASSIFY_STREAM, set_ipfix_classify_stream)                 \
+_(IPFIX_CLASSIFY_STREAM_DUMP, ipfix_classify_stream_dump)               \
+_(IPFIX_CLASSIFY_TABLE_ADD_DEL, ipfix_classify_table_add_del)           \
+_(IPFIX_CLASSIFY_TABLE_DUMP, ipfix_classify_table_dump)                 \
 _(GET_NEXT_INDEX, get_next_index)                                       \
 _(PG_CREATE_INTERFACE,pg_create_interface)                              \
 _(PG_CAPTURE, pg_capture)                                               \
@@ -2767,7 +2822,7 @@ _(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump)                     \
 _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump)                           \
 _(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
-_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
+_(LISP_LOCATOR_DUMP, lisp_locator_dump)                                 \
 _(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel)                   \
 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump)                         \
 _(DELETE_SUBIF, delete_subif)