API: Cleaning up message naming that does not follow the conventions
[vpp.git] / src / vat / api_format.c
index 61b8e1d..22a9166 100644 (file)
@@ -1037,7 +1037,7 @@ vl_api_cli_reply_t_handler (vl_api_cli_reply_t * mp)
   i32 retval = ntohl (mp->retval);
 
   vam->retval = retval;
-  vam->shmem_result = (u8 *) mp->reply_in_shmem;
+  vam->shmem_result = uword_to_pointer (mp->reply_in_shmem, u8 *);
   vam->result_ready = 1;
 }
 
@@ -1058,7 +1058,7 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp)
   pthread_mutex_lock (&am->vlib_rp->mutex);
   oldheap = svm_push_data_heap (am->vlib_rp);
 
-  reply = (u8 *) (mp->reply_in_shmem);
+  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
   vec_free (reply);
 
   svm_pop_heap (oldheap);
@@ -1323,6 +1323,9 @@ vl_api_ip6_nd_event_t_handler_json (vl_api_ip6_nd_event_t * mp)
   /* JSON output not supported */
 }
 
+#define vl_api_bridge_domain_details_t_endian vl_noop_handler
+#define vl_api_bridge_domain_details_t_print vl_noop_handler
+
 /*
  * Special-case: build the bridge domain table, maintain
  * the next bd id vbl.
@@ -1332,6 +1335,7 @@ static void vl_api_bridge_domain_details_t_handler
 {
   vat_main_t *vam = &vat_main;
   u32 n_sw_ifs = ntohl (mp->n_sw_ifs);
+  int i;
 
   print (vam->ofp, "\n%-3s %-3s %-3s %-3s %-3s %-3s",
         " ID", "LRN", "FWD", "FLD", "BVI", "#IF");
@@ -1341,7 +1345,37 @@ static void vl_api_bridge_domain_details_t_handler
         mp->flood, ntohl (mp->bvi_sw_if_index), n_sw_ifs);
 
   if (n_sw_ifs)
-    print (vam->ofp, "\n\n%s %s  %s", "sw_if_index", "SHG", "Interface Name");
+    {
+      vl_api_bridge_domain_sw_if_t *sw_ifs;
+      print (vam->ofp, "\n\n%s %s  %s", "sw_if_index", "SHG",
+            "Interface Name");
+
+      sw_ifs = mp->sw_if_details;
+      for (i = 0; i < n_sw_ifs; i++)
+       {
+         u8 *sw_if_name = 0;
+         u32 sw_if_index;
+         hash_pair_t *p;
+
+         sw_if_index = ntohl (sw_ifs->sw_if_index);
+
+         /* *INDENT-OFF* */
+         hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
+                            ({
+                              if ((u32) p->value[0] == sw_if_index)
+                                {
+                                  sw_if_name = (u8 *)(p->key);
+                                  break;
+                                }
+                            }));
+         /* *INDENT-ON* */
+         print (vam->ofp, "%7d     %3d  %s", sw_if_index,
+                sw_ifs->shg, sw_if_name ? (char *) sw_if_name :
+                "sw_if_index not found!");
+
+         sw_ifs++;
+       }
+    }
 }
 
 static void vl_api_bridge_domain_details_t_handler_json
@@ -1349,6 +1383,7 @@ static void vl_api_bridge_domain_details_t_handler_json
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node, *array = NULL;
+  u32 n_sw_ifs = ntohl (mp->n_sw_ifs);
 
   if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
@@ -1364,58 +1399,28 @@ static void vl_api_bridge_domain_details_t_handler_json
   vat_json_object_add_uint (node, "learn", mp->learn);
   vat_json_object_add_uint (node, "bvi_sw_if_index",
                            ntohl (mp->bvi_sw_if_index));
-  vat_json_object_add_uint (node, "n_sw_ifs", ntohl (mp->n_sw_ifs));
+  vat_json_object_add_uint (node, "n_sw_ifs", n_sw_ifs);
   array = vat_json_object_add (node, "sw_if");
   vat_json_init_array (array);
-}
 
-/*
- * Special-case: build the bridge domain sw if table.
- */
-static void vl_api_bridge_domain_sw_if_details_t_handler
-  (vl_api_bridge_domain_sw_if_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  hash_pair_t *p;
-  u8 *sw_if_name = 0;
-  u32 sw_if_index;
 
-  sw_if_index = ntohl (mp->sw_if_index);
-  /* *INDENT-OFF* */
-  hash_foreach_pair (p, vam->sw_if_index_by_interface_name,
-  ({
-    if ((u32) p->value[0] == sw_if_index)
-      {
-        sw_if_name = (u8 *)(p->key);
-        break;
-      }
-  }));
-  /* *INDENT-ON* */
 
-  print (vam->ofp, "%7d     %3d  %s", sw_if_index,
-        mp->shg, sw_if_name ? (char *) sw_if_name :
-        "sw_if_index not found!");
-}
-
-static void vl_api_bridge_domain_sw_if_details_t_handler_json
-  (vl_api_bridge_domain_sw_if_details_t * mp)
-{
-  vat_main_t *vam = &vat_main;
-  vat_json_node_t *node = NULL;
-  uword last_index = 0;
-
-  ASSERT (VAT_JSON_ARRAY == vam->json_tree.type);
-  ASSERT (vec_len (vam->json_tree.array) >= 1);
-  last_index = vec_len (vam->json_tree.array) - 1;
-  node = &vam->json_tree.array[last_index];
-  node = vat_json_object_get_element (node, "sw_if");
-  ASSERT (NULL != node);
-  node = vat_json_array_add (node);
+  if (n_sw_ifs)
+    {
+      vl_api_bridge_domain_sw_if_t *sw_ifs;
+      int i;
 
-  vat_json_init_object (node);
-  vat_json_object_add_uint (node, "bd_id", ntohl (mp->bd_id));
-  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->sw_if_index));
-  vat_json_object_add_uint (node, "shg", mp->shg);
+      sw_ifs = mp->sw_if_details;
+      for (i = 0; i < n_sw_ifs; i++)
+       {
+         node = vat_json_array_add (array);
+         vat_json_init_object (node);
+         vat_json_object_add_uint (node, "sw_if_index",
+                                   ntohl (sw_ifs->sw_if_index));
+         vat_json_object_add_uint (node, "shg", sw_ifs->shg);
+         sw_ifs++;
+       }
+    }
 }
 
 static void vl_api_control_ping_reply_t_handler
@@ -2098,17 +2103,21 @@ set_combined_interface_counter (u8 vnet_counter_type, u32 sw_if_index,
   vam->combined_interface_counters[vnet_counter_type][sw_if_index] = counter;
 }
 
-static void vl_api_vnet_interface_counters_t_handler
-  (vl_api_vnet_interface_counters_t * mp)
+static void vl_api_vnet_interface_simple_counters_t_handler
+  (vl_api_vnet_interface_simple_counters_t * mp)
 {
   /* not supported */
 }
 
-static void vl_api_vnet_interface_counters_t_handler_json
-  (vl_api_vnet_interface_counters_t * mp)
+static void vl_api_vnet_interface_combined_counters_t_handler
+  (vl_api_vnet_interface_combined_counters_t * mp)
+{
+  /* not supported */
+}
+
+static void vl_api_vnet_interface_simple_counters_t_handler_json
+  (vl_api_vnet_interface_simple_counters_t * mp)
 {
-  interface_counter_t counter;
-  vlib_counter_t *v;
   u64 *v_packets;
   u64 packets;
   u32 count;
@@ -2118,31 +2127,38 @@ static void vl_api_vnet_interface_counters_t_handler_json
   count = ntohl (mp->count);
   first_sw_if_index = ntohl (mp->first_sw_if_index);
 
-  if (!mp->is_combined)
+  v_packets = (u64 *) & mp->data;
+  for (i = 0; i < count; i++)
     {
-      v_packets = (u64 *) & mp->data;
-      for (i = 0; i < count; i++)
-       {
-         packets =
-           clib_net_to_host_u64 (clib_mem_unaligned (v_packets, u64));
-         set_simple_interface_counter (mp->vnet_counter_type,
-                                       first_sw_if_index + i, packets);
-         v_packets++;
-       }
+      packets = clib_net_to_host_u64 (clib_mem_unaligned (v_packets, u64));
+      set_simple_interface_counter (mp->vnet_counter_type,
+                                   first_sw_if_index + i, packets);
+      v_packets++;
     }
-  else
+}
+
+static void vl_api_vnet_interface_combined_counters_t_handler_json
+  (vl_api_vnet_interface_combined_counters_t * mp)
+{
+  interface_counter_t counter;
+  vlib_counter_t *v;
+  u32 first_sw_if_index;
+  int i;
+  u32 count;
+
+  count = ntohl (mp->count);
+  first_sw_if_index = ntohl (mp->first_sw_if_index);
+
+  v = (vlib_counter_t *) & mp->data;
+  for (i = 0; i < count; i++)
     {
-      v = (vlib_counter_t *) & mp->data;
-      for (i = 0; i < count; i++)
-       {
-         counter.packets =
-           clib_net_to_host_u64 (clib_mem_unaligned (&v->packets, u64));
-         counter.bytes =
-           clib_net_to_host_u64 (clib_mem_unaligned (&v->bytes, u64));
-         set_combined_interface_counter (mp->vnet_counter_type,
-                                         first_sw_if_index + i, counter);
-         v++;
-       }
+      counter.packets =
+       clib_net_to_host_u64 (clib_mem_unaligned (&v->packets, u64));
+      counter.bytes =
+       clib_net_to_host_u64 (clib_mem_unaligned (&v->bytes, u64));
+      set_combined_interface_counter (mp->vnet_counter_type,
+                                     first_sw_if_index + i, counter);
+      v++;
     }
 }
 
@@ -2405,7 +2421,7 @@ static void vl_api_get_node_graph_reply_t_handler
   if (retval != 0)
     return;
 
-  reply = (u8 *) (mp->reply_in_shmem);
+  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
   pvt_copy = vec_dup (reply);
 
   /* Toss the shared-memory original... */
@@ -2456,7 +2472,7 @@ static void vl_api_get_node_graph_reply_t_handler_json
   vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
   vat_json_object_add_uint (&node, "reply_in_shmem", mp->reply_in_shmem);
 
-  reply = (u8 *) (mp->reply_in_shmem);
+  reply = uword_to_pointer (mp->reply_in_shmem, u8 *);
 
   /* Toss the shared-memory original... */
   pthread_mutex_lock (&am->vlib_rp->mutex);
@@ -4118,8 +4134,10 @@ static void vl_api_flow_classify_details_t_handler_json
   vat_json_object_add_uint (node, "table_index", ntohl (mp->table_index));
 }
 
-
-
+#define vl_api_vnet_interface_simple_counters_t_endian vl_noop_handler
+#define vl_api_vnet_interface_simple_counters_t_print vl_noop_handler
+#define vl_api_vnet_interface_combined_counters_t_endian vl_noop_handler
+#define vl_api_vnet_interface_combined_counters_t_print vl_noop_handler
 #define vl_api_vnet_ip4_fib_counters_t_endian vl_noop_handler
 #define vl_api_vnet_ip4_fib_counters_t_print vl_noop_handler
 #define vl_api_vnet_ip6_fib_counters_t_endian vl_noop_handler
@@ -4199,6 +4217,7 @@ _(ipsec_interface_add_del_spd_reply)                    \
 _(ipsec_spd_add_del_entry_reply)                        \
 _(ipsec_sad_add_del_entry_reply)                        \
 _(ipsec_sa_set_key_reply)                               \
+_(ipsec_tunnel_if_add_del_reply)                        \
 _(ikev2_profile_add_del_reply)                          \
 _(ikev2_profile_set_auth_reply)                         \
 _(ikev2_profile_set_id_reply)                           \
@@ -4238,6 +4257,7 @@ _(one_add_del_map_request_itr_rlocs_reply)              \
 _(one_eid_table_add_del_map_reply)                      \
 _(one_use_petr_reply)                                   \
 _(one_stats_enable_disable_reply)                       \
+_(one_stats_flush_reply)                                \
 _(gpe_add_del_fwd_entry_reply)                          \
 _(gpe_enable_disable_reply)                             \
 _(gpe_set_encap_mode_reply)                             \
@@ -4319,7 +4339,6 @@ _(SW_INTERFACE_SET_L2_BRIDGE_REPLY,                                     \
   sw_interface_set_l2_bridge_reply)                                     \
 _(BRIDGE_DOMAIN_ADD_DEL_REPLY, bridge_domain_add_del_reply)             \
 _(BRIDGE_DOMAIN_DETAILS, bridge_domain_details)                         \
-_(BRIDGE_DOMAIN_SW_IF_DETAILS, bridge_domain_sw_if_details)             \
 _(BRIDGE_DOMAIN_SET_MAC_AGE_REPLY, bridge_domain_set_mac_age_reply)     \
 _(L2FIB_ADD_DEL_REPLY, l2fib_add_del_reply)                             \
 _(L2FIB_FLUSH_INT_REPLY, l2fib_flush_int_reply)                         \
@@ -4394,7 +4413,7 @@ _(CREATE_VHOST_USER_IF_REPLY, create_vhost_user_if_reply)               \
 _(MODIFY_VHOST_USER_IF_REPLY, modify_vhost_user_if_reply)               \
 _(DELETE_VHOST_USER_IF_REPLY, delete_vhost_user_if_reply)               \
 _(SHOW_VERSION_REPLY, show_version_reply)                               \
-_(L2_FIB_TABLE_ENTRY, l2_fib_table_entry)                              \
+_(L2_FIB_TABLE_DETAILS, l2_fib_table_details)                          \
 _(VXLAN_GPE_ADD_DEL_TUNNEL_REPLY, vxlan_gpe_add_del_tunnel_reply)          \
 _(VXLAN_GPE_TUNNEL_DETAILS, vxlan_gpe_tunnel_details)                   \
 _(INTERFACE_NAME_RENUMBER_REPLY, interface_name_renumber_reply)                \
@@ -4410,6 +4429,7 @@ _(IPSEC_INTERFACE_ADD_DEL_SPD_REPLY, ipsec_interface_add_del_spd_reply) \
 _(IPSEC_SPD_ADD_DEL_ENTRY_REPLY, ipsec_spd_add_del_entry_reply)         \
 _(IPSEC_SAD_ADD_DEL_ENTRY_REPLY, ipsec_sad_add_del_entry_reply)         \
 _(IPSEC_SA_SET_KEY_REPLY, ipsec_sa_set_key_reply)                       \
+_(IPSEC_TUNNEL_IF_ADD_DEL_REPLY, ipsec_tunnel_if_add_del_reply)         \
 _(IKEV2_PROFILE_ADD_DEL_REPLY, ikev2_profile_add_del_reply)             \
 _(IKEV2_PROFILE_SET_AUTH_REPLY, ikev2_profile_set_auth_reply)           \
 _(IKEV2_PROFILE_SET_ID_REPLY, ikev2_profile_set_id_reply)               \
@@ -4465,6 +4485,7 @@ _(ONE_MAP_RESOLVER_DETAILS, one_map_resolver_details)                   \
 _(ONE_MAP_SERVER_DETAILS, one_map_server_details)                       \
 _(ONE_ADJACENCIES_GET_REPLY, one_adjacencies_get_reply)                 \
 _(ONE_STATS_DETAILS, one_stats_details)                                 \
+_(ONE_STATS_FLUSH_REPLY, one_stats_flush_reply)                         \
 _(ONE_STATS_ENABLE_DISABLE_REPLY, one_stats_enable_disable_reply)       \
 _(SHOW_ONE_STATS_ENABLE_DISABLE_REPLY,                                  \
   show_one_stats_enable_disable_reply)                                  \
@@ -4535,7 +4556,8 @@ _(SW_INTERFACE_GET_TABLE_REPLY, sw_interface_get_table_reply)
 
 #define foreach_standalone_reply_msg                                   \
 _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags)                       \
-_(VNET_INTERFACE_COUNTERS, vnet_interface_counters)                     \
+_(VNET_INTERFACE_SIMPLE_COUNTERS, vnet_interface_simple_counters)       \
+_(VNET_INTERFACE_COMBINED_COUNTERS, vnet_interface_combined_counters)   \
 _(VNET_IP4_FIB_COUNTERS, vnet_ip4_fib_counters)                         \
 _(VNET_IP6_FIB_COUNTERS, vnet_ip6_fib_counters)                         \
 _(VNET_IP4_NBR_COUNTERS, vnet_ip4_nbr_counters)                         \
@@ -4917,7 +4939,7 @@ int
 exec (vat_main_t * vam)
 {
   api_main_t *am = &api_main;
-  vl_api_cli_request_t *mp;
+  vl_api_cli_t *mp;
   f64 timeout;
   void *oldheap;
   u8 *cmd = 0;
@@ -4938,7 +4960,7 @@ exec (vat_main_t * vam)
     }
 
 
-  M (CLI_REQUEST, mp);
+  M (CLI, mp);
 
   /*
    * Copy cmd into shared memory.
@@ -4955,7 +4977,7 @@ exec (vat_main_t * vam)
   svm_pop_heap (oldheap);
   pthread_mutex_unlock (&am->vlib_rp->mutex);
 
-  mp->cmd_in_shmem = (u64) cmd;
+  mp->cmd_in_shmem = pointer_to_uword (cmd);
   S (mp);
   timeout = vat_time_now (vam) + 10.0;
 
@@ -11878,8 +11900,8 @@ format_l2_fib_mac_address (u8 * s, va_list * args)
                 a[2], a[3], a[4], a[5], a[6], a[7]);
 }
 
-static void vl_api_l2_fib_table_entry_t_handler
-  (vl_api_l2_fib_table_entry_t * mp)
+static void vl_api_l2_fib_table_details_t_handler
+  (vl_api_l2_fib_table_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
 
@@ -11890,8 +11912,8 @@ static void vl_api_l2_fib_table_entry_t_handler
         mp->bvi_mac);
 }
 
-static void vl_api_l2_fib_table_entry_t_handler_json
-  (vl_api_l2_fib_table_entry_t * mp)
+static void vl_api_l2_fib_table_details_t_handler_json
+  (vl_api_l2_fib_table_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -12665,6 +12687,134 @@ api_ipsec_sa_set_key (vat_main_t * vam)
   return ret;
 }
 
+static int
+api_ipsec_tunnel_if_add_del (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_ipsec_tunnel_if_add_del_t *mp;
+  u32 local_spi = 0, remote_spi = 0;
+  u32 crypto_alg = 0, integ_alg = 0;
+  u8 *lck = NULL, *rck = NULL;
+  u8 *lik = NULL, *rik = NULL;
+  ip4_address_t local_ip = { {0} };
+  ip4_address_t remote_ip = { {0} };
+  u8 is_add = 1;
+  u8 esn = 0;
+  u8 anti_replay = 0;
+  int ret;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "del"))
+       is_add = 0;
+      else if (unformat (i, "esn"))
+       esn = 1;
+      else if (unformat (i, "anti_replay"))
+       anti_replay = 1;
+      else if (unformat (i, "local_spi %d", &local_spi))
+       ;
+      else if (unformat (i, "remote_spi %d", &remote_spi))
+       ;
+      else if (unformat (i, "local_ip %U", unformat_ip4_address, &local_ip))
+       ;
+      else if (unformat (i, "remote_ip %U", unformat_ip4_address, &remote_ip))
+       ;
+      else if (unformat (i, "local_crypto_key %U", unformat_hex_string, &lck))
+       ;
+      else
+       if (unformat (i, "remote_crypto_key %U", unformat_hex_string, &rck))
+       ;
+      else if (unformat (i, "local_integ_key %U", unformat_hex_string, &lik))
+       ;
+      else if (unformat (i, "remote_integ_key %U", unformat_hex_string, &rik))
+       ;
+      else
+       if (unformat
+           (i, "crypto_alg %U", unformat_ipsec_crypto_alg, &crypto_alg))
+       {
+         if (crypto_alg < IPSEC_CRYPTO_ALG_AES_CBC_128 ||
+             crypto_alg >= IPSEC_CRYPTO_N_ALG)
+           {
+             errmsg ("unsupported crypto-alg: '%U'\n",
+                     format_ipsec_crypto_alg, crypto_alg);
+             return -99;
+           }
+       }
+      else
+       if (unformat
+           (i, "integ_alg %U", unformat_ipsec_integ_alg, &integ_alg))
+       {
+         if (integ_alg < IPSEC_INTEG_ALG_SHA1_96 ||
+             integ_alg >= IPSEC_INTEG_N_ALG)
+           {
+             errmsg ("unsupported integ-alg: '%U'\n",
+                     format_ipsec_integ_alg, integ_alg);
+             return -99;
+           }
+       }
+      else
+       {
+         errmsg ("parse error '%U'\n", format_unformat_error, i);
+         return -99;
+       }
+    }
+
+  M (IPSEC_TUNNEL_IF_ADD_DEL, mp);
+
+  mp->is_add = is_add;
+  mp->esn = esn;
+  mp->anti_replay = anti_replay;
+
+  clib_memcpy (mp->local_ip, &local_ip, sizeof (ip4_address_t));
+  clib_memcpy (mp->remote_ip, &remote_ip, sizeof (ip4_address_t));
+
+  mp->local_spi = htonl (local_spi);
+  mp->remote_spi = htonl (remote_spi);
+  mp->crypto_alg = (u8) crypto_alg;
+
+  mp->local_crypto_key_len = 0;
+  if (lck)
+    {
+      mp->local_crypto_key_len = vec_len (lck);
+      if (mp->local_crypto_key_len > sizeof (mp->local_crypto_key))
+       mp->local_crypto_key_len = sizeof (mp->local_crypto_key);
+      clib_memcpy (mp->local_crypto_key, lck, mp->local_crypto_key_len);
+    }
+
+  mp->remote_crypto_key_len = 0;
+  if (rck)
+    {
+      mp->remote_crypto_key_len = vec_len (rck);
+      if (mp->remote_crypto_key_len > sizeof (mp->remote_crypto_key))
+       mp->remote_crypto_key_len = sizeof (mp->remote_crypto_key);
+      clib_memcpy (mp->remote_crypto_key, rck, mp->remote_crypto_key_len);
+    }
+
+  mp->integ_alg = (u8) integ_alg;
+
+  mp->local_integ_key_len = 0;
+  if (lik)
+    {
+      mp->local_integ_key_len = vec_len (lik);
+      if (mp->local_integ_key_len > sizeof (mp->local_integ_key))
+       mp->local_integ_key_len = sizeof (mp->local_integ_key);
+      clib_memcpy (mp->local_integ_key, lik, mp->local_integ_key_len);
+    }
+
+  mp->remote_integ_key_len = 0;
+  if (rik)
+    {
+      mp->remote_integ_key_len = vec_len (rik);
+      if (mp->remote_integ_key_len > sizeof (mp->remote_integ_key))
+       mp->remote_integ_key_len = sizeof (mp->remote_integ_key);
+      clib_memcpy (mp->remote_integ_key, rik, mp->remote_integ_key_len);
+    }
+
+  S (mp);
+  W (ret);
+  return ret;
+}
+
 static int
 api_ikev2_profile_add_del (vat_main_t * vam)
 {
@@ -15855,6 +16005,18 @@ api_one_map_resolver_dump (vat_main_t * vam)
 
 #define api_lisp_map_resolver_dump api_one_map_resolver_dump
 
+static int
+api_one_stats_flush (vat_main_t * vam)
+{
+  vl_api_one_stats_flush_t *mp;
+  int ret = 0;
+
+  M (ONE_STATS_FLUSH, mp);
+  S (mp);
+  W (ret);
+  return ret;
+}
+
 static int
 api_one_stats_dump (vat_main_t * vam)
 {
@@ -16369,32 +16531,82 @@ api_netmap_delete (vat_main_t * vam)
   return ret;
 }
 
-static void vl_api_mpls_tunnel_details_t_handler
-  (vl_api_mpls_tunnel_details_t * mp)
+static void
+vl_api_mpls_fib_path_print (vat_main_t * vam, vl_api_fib_path2_t * fp)
+{
+  if (fp->afi == IP46_TYPE_IP6)
+    print (vam->ofp,
+          "  weight %d, sw_if_index %d, is_local %d, is_drop %d, "
+          "is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
+          ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
+          fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
+          format_ip6_address, fp->next_hop);
+  else if (fp->afi == IP46_TYPE_IP4)
+    print (vam->ofp,
+          "  weight %d, sw_if_index %d, is_local %d, is_drop %d, "
+          "is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
+          ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
+          fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
+          format_ip4_address, fp->next_hop);
+}
+
+static void
+vl_api_mpls_fib_path_json_print (vat_json_node_t * node,
+                                vl_api_fib_path2_t * fp)
+{
+  struct in_addr ip4;
+  struct in6_addr ip6;
+
+  vat_json_object_add_uint (node, "weight", ntohl (fp->weight));
+  vat_json_object_add_uint (node, "sw_if_index", ntohl (fp->sw_if_index));
+  vat_json_object_add_uint (node, "is_local", fp->is_local);
+  vat_json_object_add_uint (node, "is_drop", fp->is_drop);
+  vat_json_object_add_uint (node, "is_unreach", fp->is_unreach);
+  vat_json_object_add_uint (node, "is_prohibit", fp->is_prohibit);
+  vat_json_object_add_uint (node, "next_hop_afi", fp->afi);
+  if (fp->afi == IP46_TYPE_IP4)
+    {
+      clib_memcpy (&ip4, &fp->next_hop, sizeof (ip4));
+      vat_json_object_add_ip4 (node, "next_hop", ip4);
+    }
+  else if (fp->afi == IP46_TYPE_IP6)
+    {
+      clib_memcpy (&ip6, &fp->next_hop, sizeof (ip6));
+      vat_json_object_add_ip6 (node, "next_hop", ip6);
+    }
+}
+
+static void
+vl_api_mpls_tunnel_details_t_handler (vl_api_mpls_tunnel_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
-  i32 len = mp->mt_next_hop_n_labels;
+  int count = ntohl (mp->mt_count);
+  vl_api_fib_path2_t *fp;
   i32 i;
 
-  print (vam->ofp, "[%d]: via %U %d labels ",
-        mp->tunnel_index,
-        format_ip4_address, mp->mt_next_hop,
-        ntohl (mp->mt_next_hop_sw_if_index));
-  for (i = 0; i < len; i++)
+  print (vam->ofp, "[%d]: sw_if_index %d via:",
+        ntohl (mp->mt_tunnel_index), ntohl (mp->mt_sw_if_index));
+  fp = mp->mt_paths;
+  for (i = 0; i < count; i++)
     {
-      print (vam->ofp, "%u ", ntohl (mp->mt_next_hop_out_labels[i]));
+      vl_api_mpls_fib_path_print (vam, fp);
+      fp++;
     }
+
   print (vam->ofp, "");
 }
 
-static void vl_api_mpls_tunnel_details_t_handler_json
-  (vl_api_mpls_tunnel_details_t * mp)
+#define vl_api_mpls_tunnel_details_t_endian vl_noop_handler
+#define vl_api_mpls_tunnel_details_t_print vl_noop_handler
+
+static void
+vl_api_mpls_tunnel_details_t_handler_json (vl_api_mpls_tunnel_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
-  struct in_addr ip4;
+  int count = ntohl (mp->mt_count);
+  vl_api_fib_path2_t *fp;
   i32 i;
-  i32 len = mp->mt_next_hop_n_labels;
 
   if (VAT_JSON_ARRAY != vam->json_tree.type)
     {
@@ -16404,17 +16616,17 @@ static void vl_api_mpls_tunnel_details_t_handler_json
   node = vat_json_array_add (&vam->json_tree);
 
   vat_json_init_object (node);
-  vat_json_object_add_uint (node, "tunnel_index", ntohl (mp->tunnel_index));
-  clib_memcpy (&ip4, &(mp->mt_next_hop), sizeof (ip4));
-  vat_json_object_add_ip4 (node, "next_hop", ip4);
-  vat_json_object_add_uint (node, "next_hop_sw_if_index",
-                           ntohl (mp->mt_next_hop_sw_if_index));
-  vat_json_object_add_uint (node, "l2_only", ntohl (mp->mt_l2_only));
-  vat_json_object_add_uint (node, "label_count", len);
-  for (i = 0; i < len; i++)
+  vat_json_object_add_uint (node, "tunnel_index",
+                           ntohl (mp->mt_tunnel_index));
+  vat_json_object_add_uint (node, "sw_if_index", ntohl (mp->mt_sw_if_index));
+
+  vat_json_object_add_uint (node, "l2_only", mp->mt_l2_only);
+
+  fp = mp->mt_paths;
+  for (i = 0; i < count; i++)
     {
-      vat_json_object_add_uint (node, "label",
-                               ntohl (mp->mt_next_hop_out_labels[i]));
+      vl_api_mpls_fib_path_json_print (node, fp);
+      fp++;
     }
 }
 
@@ -16453,6 +16665,7 @@ api_mpls_tunnel_dump (vat_main_t * vam)
 #define vl_api_mpls_fib_details_t_endian vl_noop_handler
 #define vl_api_mpls_fib_details_t_print vl_noop_handler
 
+
 static void
 vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp)
 {
@@ -16467,20 +16680,7 @@ vl_api_mpls_fib_details_t_handler (vl_api_mpls_fib_details_t * mp)
   fp = mp->path;
   for (i = 0; i < count; i++)
     {
-      if (fp->afi == IP46_TYPE_IP6)
-       print (vam->ofp,
-              "  weight %d, sw_if_index %d, is_local %d, is_drop %d, "
-              "is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
-              ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
-              fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
-              format_ip6_address, fp->next_hop);
-      else if (fp->afi == IP46_TYPE_IP4)
-       print (vam->ofp,
-              "  weight %d, sw_if_index %d, is_local %d, is_drop %d, "
-              "is_unreach %d, is_prohitbit %d, afi %d, next_hop %U",
-              ntohl (fp->weight), ntohl (fp->sw_if_index), fp->is_local,
-              fp->is_drop, fp->is_unreach, fp->is_prohibit, fp->afi,
-              format_ip4_address, fp->next_hop);
+      vl_api_mpls_fib_path_print (vam, fp);
       fp++;
     }
 }
@@ -16491,8 +16691,6 @@ static void vl_api_mpls_fib_details_t_handler_json
   vat_main_t *vam = &vat_main;
   int count = ntohl (mp->count);
   vat_json_node_t *node = NULL;
-  struct in_addr ip4;
-  struct in6_addr ip6;
   vl_api_fib_path2_t *fp;
   int i;
 
@@ -16511,23 +16709,8 @@ static void vl_api_mpls_fib_details_t_handler_json
   fp = mp->path;
   for (i = 0; i < count; i++)
     {
-      vat_json_object_add_uint (node, "weight", ntohl (fp->weight));
-      vat_json_object_add_uint (node, "sw_if_index", ntohl (fp->sw_if_index));
-      vat_json_object_add_uint (node, "is_local", fp->is_local);
-      vat_json_object_add_uint (node, "is_drop", fp->is_drop);
-      vat_json_object_add_uint (node, "is_unreach", fp->is_unreach);
-      vat_json_object_add_uint (node, "is_prohibit", fp->is_prohibit);
-      vat_json_object_add_uint (node, "next_hop_afi", fp->afi);
-      if (fp->afi == IP46_TYPE_IP4)
-       {
-         clib_memcpy (&ip4, &fp->next_hop, sizeof (ip4));
-         vat_json_object_add_ip4 (node, "next_hop", ip4);
-       }
-      else if (fp->afi == IP46_TYPE_IP6)
-       {
-         clib_memcpy (&ip6, &fp->next_hop, sizeof (ip6));
-         vat_json_object_add_ip6 (node, "next_hop", ip6);
-       }
+      vl_api_mpls_fib_path_json_print (node, fp);
+      fp++;
     }
 }
 
@@ -18779,6 +18962,10 @@ _(ipsec_spd_add_del_entry, "spd_id <n> priority <n> action <action>\n"  \
   "  laddr_stop <ip4|ip6> raddr_start <ip4|ip6> raddr_stop <ip4|ip6>\n" \
   "  [lport_start <n> lport_stop <n>] [rport_start <n> rport_stop <n>]" ) \
 _(ipsec_sa_set_key, "sa_id <n> crypto_key <hex> integ_key <hex>")       \
+_(ipsec_tunnel_if_add_del, "local_spi <n> remote_spi <n>\n"             \
+  "  crypto_alg <alg> local_crypto_key <hex> remote_crypto_key <hex>\n" \
+  "  integ_alg <alg> local_integ_key <hex> remote_integ_key <hex>\n"    \
+  "  local_ip <addr> remote_ip <addr> [esn] [anti_replay] [del]\n")     \
 _(ikev2_profile_add_del, "name <profile_name> [del]")                   \
 _(ikev2_profile_set_auth, "name <profile_name> auth_method <method>\n"  \
   "(auth_data 0x<data> | auth_data <data>)")                            \
@@ -18859,6 +19046,7 @@ _(show_one_rloc_probe_state, "")                                        \
 _(show_one_map_register_state, "")                                      \
 _(show_one_status, "")                                                  \
 _(one_stats_dump, "")                                                   \
+_(one_stats_flush, "")                                                  \
 _(one_get_map_request_itr_rlocs, "")                                    \
 _(show_one_pitr, "")                                                    \
 _(show_one_use_petr, "")                                                \