LISP: enhance binary part of some APIs
[vpp.git] / src / vat / api_format.c
index 176fe83..0bbefd6 100644 (file)
@@ -48,6 +48,7 @@
 #include <vnet/span/span.h>
 #include <vnet/policer/policer.h>
 #include <vnet/policer/police.h>
+#include <vnet/mfib/mfib_types.h>
 
 #include "vat/json_format.h"
 
 #include <vpp/api/vpe_all_api_h.h>
 #undef vl_printfun
 
+#define __plugin_msg_base 0
+#include <vlibapi/vat_helper_macros.h>
+
+f64
+vat_time_now (vat_main_t * vam)
+{
+#if VPP_API_TEST_BUILTIN
+  return vlib_time_now (vam->vlib_main);
+#else
+  return clib_time_now (&vam->clib_time);
+#endif
+}
+
+void
+errmsg (char *fmt, ...)
+{
+  vat_main_t *vam = &vat_main;
+  va_list va;
+  u8 *s;
+
+  va_start (va, fmt);
+  s = va_format (0, fmt, &va);
+  va_end (va);
+
+  vec_add1 (s, 0);
+
+#if VPP_API_TEST_BUILTIN
+  vlib_cli_output (vam->vlib_main, (char *) s);
+#else
+  {
+    if (vam->ifp != stdin)
+      fformat (vam->ofp, "%s(%d): \n", vam->current_file,
+              vam->input_line_number);
+    fformat (vam->ofp, (char *) s);
+    fflush (vam->ofp);
+  }
+#endif
+
+  vec_free (s);
+}
+
 static uword
 api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
 {
@@ -88,8 +130,6 @@ api_unformat_sw_if_index (unformat_input_t * input, va_list * args)
   return 1;
 }
 
-void vat_suspend (vlib_main_t * vm, f64 interval);
-
 #if VPP_API_TEST_BUILTIN == 0
 /* Parse an IP4 address %d.%d.%d.%d. */
 uword
@@ -466,6 +506,53 @@ unformat_flow_classify_table_type (unformat_input_t * input, va_list * va)
   return 1;
 }
 
+static const char *mfib_flag_names[] = MFIB_ENTRY_NAMES_SHORT;
+static const char *mfib_flag_long_names[] = MFIB_ENTRY_NAMES_LONG;
+static const char *mfib_itf_flag_long_names[] = MFIB_ITF_NAMES_LONG;
+static const char *mfib_itf_flag_names[] = MFIB_ITF_NAMES_SHORT;
+
+uword
+unformat_mfib_itf_flags (unformat_input_t * input, va_list * args)
+{
+  mfib_itf_flags_t old, *iflags = va_arg (*args, mfib_itf_flags_t *);
+  mfib_itf_attribute_t attr;
+
+  old = *iflags;
+  FOR_EACH_MFIB_ITF_ATTRIBUTE (attr)
+  {
+    if (unformat (input, mfib_itf_flag_long_names[attr]))
+      *iflags |= (1 << attr);
+  }
+  FOR_EACH_MFIB_ITF_ATTRIBUTE (attr)
+  {
+    if (unformat (input, mfib_itf_flag_names[attr]))
+      *iflags |= (1 << attr);
+  }
+
+  return (old == *iflags ? 0 : 1);
+}
+
+uword
+unformat_mfib_entry_flags (unformat_input_t * input, va_list * args)
+{
+  mfib_entry_flags_t old, *eflags = va_arg (*args, mfib_entry_flags_t *);
+  mfib_entry_attribute_t attr;
+
+  old = *eflags;
+  FOR_EACH_MFIB_ATTRIBUTE (attr)
+  {
+    if (unformat (input, mfib_flag_long_names[attr]))
+      *eflags |= (1 << attr);
+  }
+  FOR_EACH_MFIB_ATTRIBUTE (attr)
+  {
+    if (unformat (input, mfib_flag_names[attr]))
+      *eflags |= (1 << attr);
+  }
+
+  return (old == *eflags ? 0 : 1);
+}
+
 #if (VPP_API_TEST_BUILTIN==0)
 u8 *
 format_ip4_address (u8 * s, va_list * args)
@@ -2004,6 +2091,42 @@ static void vl_api_vnet_ip4_fib_counters_t_handler_json
     }
 }
 
+static void vl_api_vnet_ip4_nbr_counters_t_handler
+  (vl_api_vnet_ip4_nbr_counters_t * mp)
+{
+  /* not supported */
+}
+
+static void vl_api_vnet_ip4_nbr_counters_t_handler_json
+  (vl_api_vnet_ip4_nbr_counters_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vl_api_ip4_nbr_counter_t *v;
+  ip4_nbr_counter_t *counter;
+  u32 sw_if_index;
+  u32 count;
+  int i;
+
+  sw_if_index = ntohl (mp->sw_if_index);
+  count = ntohl (mp->count);
+  vec_validate (vam->ip4_nbr_counters, sw_if_index);
+
+  if (mp->begin)
+    vec_free (vam->ip4_nbr_counters[sw_if_index]);
+
+  v = (vl_api_ip4_nbr_counter_t *) & mp->c;
+  for (i = 0; i < count; i++)
+    {
+      vec_validate (vam->ip4_nbr_counters[sw_if_index], i);
+      counter = &vam->ip4_nbr_counters[sw_if_index][i];
+      counter->address.s_addr = v->address;
+      counter->packets = clib_net_to_host_u64 (v->packets);
+      counter->bytes = clib_net_to_host_u64 (v->bytes);
+      counter->linkt = v->link_type;
+      v++;
+    }
+}
+
 static void vl_api_vnet_ip6_fib_counters_t_handler
   (vl_api_vnet_ip6_fib_counters_t * mp)
 {
@@ -2049,6 +2172,43 @@ static void vl_api_vnet_ip6_fib_counters_t_handler_json
     }
 }
 
+static void vl_api_vnet_ip6_nbr_counters_t_handler
+  (vl_api_vnet_ip6_nbr_counters_t * mp)
+{
+  /* not supported */
+}
+
+static void vl_api_vnet_ip6_nbr_counters_t_handler_json
+  (vl_api_vnet_ip6_nbr_counters_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vl_api_ip6_nbr_counter_t *v;
+  ip6_nbr_counter_t *counter;
+  struct in6_addr ip6;
+  u32 sw_if_index;
+  u32 count;
+  int i;
+
+  sw_if_index = ntohl (mp->sw_if_index);
+  count = ntohl (mp->count);
+  vec_validate (vam->ip6_nbr_counters, sw_if_index);
+
+  if (mp->begin)
+    vec_free (vam->ip6_nbr_counters[sw_if_index]);
+
+  v = (vl_api_ip6_nbr_counter_t *) & mp->c;
+  for (i = 0; i < count; i++)
+    {
+      vec_validate (vam->ip6_nbr_counters[sw_if_index], i);
+      counter = &vam->ip6_nbr_counters[sw_if_index][i];
+      clib_memcpy (&ip6, &v->address, sizeof (ip6));
+      counter->address = ip6;
+      counter->packets = clib_net_to_host_u64 (v->packets);
+      counter->bytes = clib_net_to_host_u64 (v->bytes);
+      v++;
+    }
+}
+
 static void vl_api_get_first_msg_id_reply_t_handler
   (vl_api_get_first_msg_id_reply_t * mp)
 {
@@ -2522,6 +2682,161 @@ static void
   vec_free (s);
 }
 
+static void
+api_lisp_gpe_fwd_entry_net_to_host (vl_api_lisp_gpe_fwd_entry_t * e)
+{
+  e->dp_table = clib_net_to_host_u32 (e->dp_table);
+  e->fwd_entry_index = clib_net_to_host_u32 (e->fwd_entry_index);
+}
+
+static void
+  lisp_gpe_fwd_entries_get_reply_t_net_to_host
+  (vl_api_lisp_gpe_fwd_entries_get_reply_t * mp)
+{
+  u32 i;
+
+  mp->count = clib_net_to_host_u32 (mp->count);
+  for (i = 0; i < mp->count; i++)
+    {
+      api_lisp_gpe_fwd_entry_net_to_host (&mp->entries[i]);
+    }
+}
+
+static void
+  vl_api_lisp_gpe_fwd_entry_path_details_t_handler
+  (vl_api_lisp_gpe_fwd_entry_path_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
+
+  if (mp->lcl_loc.is_ip4)
+    format_ip_address_fcn = format_ip4_address;
+  else
+    format_ip_address_fcn = format_ip6_address;
+
+  print (vam->ofp, "w:%d %30U %30U", mp->rmt_loc.weight,
+        format_ip_address_fcn, &mp->lcl_loc,
+        format_ip_address_fcn, &mp->rmt_loc);
+}
+
+static void
+lisp_fill_locator_node (vat_json_node_t * n, vl_api_lisp_gpe_locator_t * loc)
+{
+  struct in6_addr ip6;
+  struct in_addr ip4;
+
+  if (loc->is_ip4)
+    {
+      clib_memcpy (&ip4, loc->addr, sizeof (ip4));
+      vat_json_object_add_ip4 (n, "address", ip4);
+    }
+  else
+    {
+      clib_memcpy (&ip6, loc->addr, sizeof (ip6));
+      vat_json_object_add_ip6 (n, "address", ip6);
+    }
+  vat_json_object_add_uint (n, "weight", loc->weight);
+}
+
+static void
+  vl_api_lisp_gpe_fwd_entry_path_details_t_handler_json
+  (vl_api_lisp_gpe_fwd_entry_path_details_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t *node = NULL;
+  vat_json_node_t *loc_node;
+
+  if (VAT_JSON_ARRAY != vam->json_tree.type)
+    {
+      ASSERT (VAT_JSON_NONE == vam->json_tree.type);
+      vat_json_init_array (&vam->json_tree);
+    }
+  node = vat_json_array_add (&vam->json_tree);
+  vat_json_init_object (node);
+
+  loc_node = vat_json_object_add (node, "local_locator");
+  vat_json_init_object (loc_node);
+  lisp_fill_locator_node (loc_node, &mp->lcl_loc);
+
+  loc_node = vat_json_object_add (node, "remote_locator");
+  vat_json_init_object (loc_node);
+  lisp_fill_locator_node (loc_node, &mp->rmt_loc);
+}
+
+static void
+  vl_api_lisp_gpe_fwd_entries_get_reply_t_handler
+  (vl_api_lisp_gpe_fwd_entries_get_reply_t * mp)
+{
+  vat_main_t *vam = &vat_main;
+  u32 i;
+  int retval = clib_net_to_host_u32 (mp->retval);
+  vl_api_lisp_gpe_fwd_entry_t *e;
+
+  if (retval)
+    goto end;
+
+  lisp_gpe_fwd_entries_get_reply_t_net_to_host (mp);
+
+  for (i = 0; i < mp->count; i++)
+    {
+      e = &mp->entries[i];
+      print (vam->ofp, "%10d %10d %U %40U", e->fwd_entry_index, e->dp_table,
+            format_lisp_flat_eid, e->eid_type, e->leid, e->leid_prefix_len,
+            format_lisp_flat_eid, e->eid_type, e->reid, e->reid_prefix_len);
+    }
+
+end:
+  vam->retval = retval;
+  vam->result_ready = 1;
+}
+
+static void
+  vl_api_lisp_gpe_fwd_entries_get_reply_t_handler_json
+  (vl_api_lisp_gpe_fwd_entries_get_reply_t * mp)
+{
+  u8 *s = 0;
+  vat_main_t *vam = &vat_main;
+  vat_json_node_t *e = 0, root;
+  u32 i;
+  int retval = clib_net_to_host_u32 (mp->retval);
+  vl_api_lisp_gpe_fwd_entry_t *fwd;
+
+  if (retval)
+    goto end;
+
+  lisp_gpe_fwd_entries_get_reply_t_net_to_host (mp);
+  vat_json_init_array (&root);
+
+  for (i = 0; i < mp->count; i++)
+    {
+      e = vat_json_array_add (&root);
+      fwd = &mp->entries[i];
+
+      vat_json_init_object (e);
+      vat_json_object_add_int (e, "fwd_entry_index", fwd->fwd_entry_index);
+      vat_json_object_add_int (e, "dp_table", fwd->dp_table);
+
+      s = format (0, "%U", format_lisp_flat_eid, fwd->eid_type, fwd->leid,
+                 fwd->leid_prefix_len);
+      vec_add1 (s, 0);
+      vat_json_object_add_string_copy (e, "leid", s);
+      vec_free (s);
+
+      s = format (0, "%U", format_lisp_flat_eid, fwd->eid_type, fwd->reid,
+                 fwd->reid_prefix_len);
+      vec_add1 (s, 0);
+      vat_json_object_add_string_copy (e, "reid", s);
+      vec_free (s);
+    }
+
+  vat_json_print (vam->ofp, &root);
+  vat_json_free (&root);
+
+end:
+  vam->retval = retval;
+  vam->result_ready = 1;
+}
+
 static void
   vl_api_lisp_adjacencies_get_reply_t_handler
   (vl_api_lisp_adjacencies_get_reply_t * mp)
@@ -3452,6 +3767,10 @@ static void vl_api_flow_classify_details_t_handler_json
 #define vl_api_vnet_ip4_fib_counters_t_print vl_noop_handler
 #define vl_api_vnet_ip6_fib_counters_t_endian vl_noop_handler
 #define vl_api_vnet_ip6_fib_counters_t_print vl_noop_handler
+#define vl_api_vnet_ip4_nbr_counters_t_endian vl_noop_handler
+#define vl_api_vnet_ip4_nbr_counters_t_print vl_noop_handler
+#define vl_api_vnet_ip6_nbr_counters_t_endian vl_noop_handler
+#define vl_api_vnet_ip6_nbr_counters_t_print vl_noop_handler
 #define vl_api_lisp_adjacencies_get_reply_t_endian vl_noop_handler
 #define vl_api_lisp_adjacencies_get_reply_t_print vl_noop_handler
 
@@ -3476,6 +3795,7 @@ _(bridge_domain_add_del_reply)                          \
 _(sw_interface_set_l2_xconnect_reply)                   \
 _(l2fib_add_del_reply)                                  \
 _(ip_add_del_route_reply)                               \
+_(ip_mroute_add_del_reply)                              \
 _(mpls_route_add_del_reply)                             \
 _(mpls_ip_bind_unbind_reply)                            \
 _(proxy_arp_add_del_reply)                              \
@@ -3676,6 +3996,7 @@ _(TAP_MODIFY_REPLY, tap_modify_reply)                                     \
 _(TAP_DELETE_REPLY, tap_delete_reply)                                  \
 _(SW_INTERFACE_TAP_DETAILS, sw_interface_tap_details)                   \
 _(IP_ADD_DEL_ROUTE_REPLY, ip_add_del_route_reply)                      \
+_(IP_MROUTE_ADD_DEL_REPLY, ip_mroute_add_del_reply)                    \
 _(MPLS_ROUTE_ADD_DEL_REPLY, mpls_route_add_del_reply)                  \
 _(MPLS_IP_BIND_UNBIND_REPLY, mpls_ip_bind_unbind_reply)                        \
 _(PROXY_ARP_ADD_DEL_REPLY, proxy_arp_add_del_reply)                     \
@@ -3761,6 +4082,8 @@ _(DHCP_COMPL_EVENT, dhcp_compl_event)                                   \
 _(VNET_INTERFACE_COUNTERS, vnet_interface_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)                         \
+_(VNET_IP6_NBR_COUNTERS, vnet_ip6_nbr_counters)                         \
 _(MAP_ADD_DOMAIN_REPLY, map_add_domain_reply)                           \
 _(MAP_DEL_DOMAIN_REPLY, map_del_domain_reply)                           \
 _(MAP_ADD_DEL_RULE_REPLY, map_add_del_rule_reply)                      \
@@ -3801,6 +4124,9 @@ _(LISP_EID_TABLE_VNI_DETAILS, lisp_eid_table_vni_details)               \
 _(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details)                 \
 _(LISP_MAP_SERVER_DETAILS, lisp_map_server_details)                     \
 _(LISP_ADJACENCIES_GET_REPLY, lisp_adjacencies_get_reply)               \
+_(LISP_GPE_FWD_ENTRIES_GET_REPLY, lisp_gpe_fwd_entries_get_reply)       \
+_(LISP_GPE_FWD_ENTRY_PATH_DETAILS,                                      \
+  lisp_gpe_fwd_entry_path_details)                                      \
 _(SHOW_LISP_STATUS_REPLY, show_lisp_status_reply)                       \
 _(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY,                             \
   lisp_add_del_map_request_itr_rlocs_reply)                             \
@@ -3867,59 +4193,6 @@ _(SW_INTERFACE_SET_DPDK_HQOS_TCTBL_REPLY,                               \
   sw_interface_set_dpdk_hqos_tctbl_reply)
 #endif
 
-/* M: construct, but don't yet send a message */
-
-#define M(T,t)                                          \
-do {                                                    \
-    vam->result_ready = 0;                              \
-    mp = vl_msg_api_alloc_as_if_client(sizeof(*mp));    \
-    memset (mp, 0, sizeof (*mp));                       \
-    mp->_vl_msg_id = ntohs (VL_API_##T);                \
-    mp->client_index = vam->my_client_index;            \
-} while(0);
-
-#define M2(T,t,n)                                               \
-do {                                                            \
-    vam->result_ready = 0;                                      \
-    mp = vl_msg_api_alloc_as_if_client(sizeof(*mp)+(n));        \
-    memset (mp, 0, sizeof (*mp));                               \
-    mp->_vl_msg_id = ntohs (VL_API_##T);                        \
-    mp->client_index = vam->my_client_index;                    \
-} while(0);
-
-
-/* S: send a message */
-#define S (vl_msg_api_send_shmem (vam->vl_input_queue, (u8 *)&mp))
-
-/* W: wait for results, with timeout */
-#define W                                       \
-do {                                            \
-    timeout = vat_time_now (vam) + 1.0;         \
-                                                \
-    while (vat_time_now (vam) < timeout) {      \
-        if (vam->result_ready == 1) {           \
-            return (vam->retval);               \
-        }                                       \
-        vat_suspend (vam->vlib_main, 1e-3);     \
-    }                                           \
-    return -99;                                 \
-} while(0);
-
-/* W2: wait for results, with timeout */
-#define W2(body)                                \
-do {                                            \
-    timeout = vat_time_now (vam) + 1.0;         \
-                                                \
-    while (vat_time_now (vam) < timeout) {      \
-        if (vam->result_ready == 1) {           \
-         (body);                               \
-         return (vam->retval);                 \
-        }                                       \
-        vat_suspend (vam->vlib_main, 1e-3);     \
-    }                                           \
-    return -99;                                 \
-} while(0);
-
 typedef struct
 {
   u8 *name;
@@ -4146,6 +4419,8 @@ dump_stats_table (vat_main_t * vam)
   u64 packets;
   ip4_fib_counter_t *c4;
   ip6_fib_counter_t *c6;
+  ip4_nbr_counter_t *n4;
+  ip6_nbr_counter_t *n6;
   int i, j;
 
   if (!vam->json_output)
@@ -4241,6 +4516,49 @@ dump_stats_table (vat_main_t * vam)
        }
     }
 
+  /* ip4 nbr counters */
+  msg_array = vat_json_object_add (&node, "ip4_nbr_counters");
+  vat_json_init_array (msg_array);
+  for (i = 0; i < vec_len (vam->ip4_nbr_counters); i++)
+    {
+      msg = vat_json_array_add (msg_array);
+      vat_json_init_object (msg);
+      vat_json_object_add_uint (msg, "sw_if_index", i);
+      counter_array = vat_json_object_add (msg, "c");
+      vat_json_init_array (counter_array);
+      for (j = 0; j < vec_len (vam->ip4_nbr_counters[i]); j++)
+       {
+         counter = vat_json_array_add (counter_array);
+         vat_json_init_object (counter);
+         n4 = &vam->ip4_nbr_counters[i][j];
+         vat_json_object_add_ip4 (counter, "address", n4->address);
+         vat_json_object_add_uint (counter, "link-type", n4->linkt);
+         vat_json_object_add_uint (counter, "packets", n4->packets);
+         vat_json_object_add_uint (counter, "bytes", n4->bytes);
+       }
+    }
+
+  /* ip6 nbr counters */
+  msg_array = vat_json_object_add (&node, "ip6_nbr_counters");
+  vat_json_init_array (msg_array);
+  for (i = 0; i < vec_len (vam->ip6_nbr_counters); i++)
+    {
+      msg = vat_json_array_add (msg_array);
+      vat_json_init_object (msg);
+      vat_json_object_add_uint (msg, "sw_if_index", i);
+      counter_array = vat_json_object_add (msg, "c");
+      vat_json_init_array (counter_array);
+      for (j = 0; j < vec_len (vam->ip6_nbr_counters[i]); j++)
+       {
+         counter = vat_json_array_add (counter_array);
+         vat_json_init_object (counter);
+         n6 = &vam->ip6_nbr_counters[i][j];
+         vat_json_object_add_ip6 (counter, "address", n6->address);
+         vat_json_object_add_uint (counter, "packets", n6->packets);
+         vat_json_object_add_uint (counter, "bytes", n6->bytes);
+       }
+    }
+
   vat_json_print (vam->ofp, &node);
   vat_json_free (&node);
 
@@ -5173,7 +5491,7 @@ api_sw_interface_set_vxlan_bypass (vat_main_t * vam)
   f64 timeout;
   u32 sw_if_index = 0;
   u8 sw_if_index_set = 0;
-  u8 is_enable = 0;
+  u8 is_enable = 1;
   u8 is_ipv6 = 0;
 
   /* Parse args required to build the message */
@@ -5790,6 +6108,12 @@ api_tap_connect (vat_main_t * vam)
   u8 name_set = 0;
   u8 *tap_name;
   u8 *tag = 0;
+  ip4_address_t ip4_address;
+  u32 ip4_mask_width;
+  int ip4_address_set = 0;
+  ip6_address_t ip6_address;
+  u32 ip6_mask_width;
+  int ip6_address_set = 0;
 
   memset (mac_address, 0, sizeof (mac_address));
 
@@ -5806,6 +6130,12 @@ api_tap_connect (vat_main_t * vam)
        name_set = 1;
       else if (unformat (i, "tag %s", &tag))
        ;
+      else if (unformat (i, "address %U/%d",
+                        unformat_ip4_address, &ip4_address, &ip4_mask_width))
+       ip4_address_set = 1;
+      else if (unformat (i, "address %U/%d",
+                        unformat_ip6_address, &ip6_address, &ip6_mask_width))
+       ip6_address_set = 1;
       else
        break;
     }
@@ -5837,6 +6167,19 @@ api_tap_connect (vat_main_t * vam)
   if (tag)
     clib_memcpy (mp->tag, tag, vec_len (tag));
 
+  if (ip4_address_set)
+    {
+      mp->ip4_address_set = 1;
+      clib_memcpy (mp->ip4_address, &ip4_address, sizeof (mp->ip4_address));
+      mp->ip4_mask_width = ip4_mask_width;
+    }
+  if (ip6_address_set)
+    {
+      mp->ip6_address_set = 1;
+      clib_memcpy (mp->ip6_address, &ip6_address, sizeof (mp->ip6_address));
+      mp->ip6_mask_width = ip6_mask_width;
+    }
+
   vec_free (tap_name);
   vec_free (tag);
 
@@ -6248,6 +6591,123 @@ api_ip_add_del_route (vat_main_t * vam)
   return (vam->retval);
 }
 
+static int
+api_ip_mroute_add_del (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_ip_mroute_add_del_t *mp;
+  f64 timeout;
+  u32 sw_if_index = ~0, vrf_id = 0;
+  u8 is_ipv6 = 0;
+  u8 is_local = 0;
+  u8 create_vrf_if_needed = 0;
+  u8 is_add = 1;
+  u8 address_set = 0;
+  u32 grp_address_length = 0;
+  ip4_address_t v4_grp_address, v4_src_address;
+  ip6_address_t v6_grp_address, v6_src_address;
+  mfib_itf_flags_t iflags = 0;
+  mfib_entry_flags_t eflags = 0;
+
+  /* Parse args required to build the message */
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "sw_if_index %d", &sw_if_index))
+       ;
+      else if (unformat (i, "%U %U",
+                        unformat_ip4_address, &v4_src_address,
+                        unformat_ip4_address, &v4_grp_address))
+       {
+         grp_address_length = 64;
+         address_set = 1;
+         is_ipv6 = 0;
+       }
+      else if (unformat (i, "%U %U",
+                        unformat_ip6_address, &v6_src_address,
+                        unformat_ip6_address, &v6_grp_address))
+       {
+         grp_address_length = 256;
+         address_set = 1;
+         is_ipv6 = 1;
+       }
+      else if (unformat (i, "%U", unformat_ip4_address, &v4_grp_address))
+       {
+         memset (&v4_src_address, 0, sizeof (v4_src_address));
+         grp_address_length = 32;
+         address_set = 1;
+         is_ipv6 = 0;
+       }
+      else if (unformat (i, "%U", unformat_ip6_address, &v6_grp_address))
+       {
+         memset (&v6_src_address, 0, sizeof (v6_src_address));
+         grp_address_length = 128;
+         address_set = 1;
+         is_ipv6 = 1;
+       }
+      else if (unformat (i, "/%d", &grp_address_length))
+       ;
+      else if (unformat (i, "local"))
+       {
+         is_local = 1;
+       }
+      else if (unformat (i, "del"))
+       is_add = 0;
+      else if (unformat (i, "add"))
+       is_add = 1;
+      else if (unformat (i, "vrf %d", &vrf_id))
+       ;
+      else if (unformat (i, "create-vrf"))
+       create_vrf_if_needed = 1;
+      else if (unformat (i, "%U", unformat_mfib_itf_flags, &iflags))
+       ;
+      else if (unformat (i, "%U", unformat_mfib_entry_flags, &eflags))
+       ;
+      else
+       {
+         clib_warning ("parse error '%U'", format_unformat_error, i);
+         return -99;
+       }
+    }
+
+  if (address_set == 0)
+    {
+      errmsg ("missing addresses\n");
+      return -99;
+    }
+
+  /* Construct the API message */
+  M (IP_MROUTE_ADD_DEL, ip_mroute_add_del);
+
+  mp->next_hop_sw_if_index = ntohl (sw_if_index);
+  mp->table_id = ntohl (vrf_id);
+  mp->create_vrf_if_needed = create_vrf_if_needed;
+
+  mp->is_add = is_add;
+  mp->is_ipv6 = is_ipv6;
+  mp->is_local = is_local;
+  mp->itf_flags = ntohl (iflags);
+  mp->entry_flags = ntohl (eflags);
+  mp->grp_address_length = grp_address_length;
+  mp->grp_address_length = ntohs (mp->grp_address_length);
+
+  if (is_ipv6)
+    {
+      clib_memcpy (mp->grp_address, &v6_grp_address, sizeof (v6_grp_address));
+      clib_memcpy (mp->src_address, &v6_src_address, sizeof (v6_src_address));
+    }
+  else
+    {
+      clib_memcpy (mp->grp_address, &v4_grp_address, sizeof (v4_grp_address));
+      clib_memcpy (mp->src_address, &v4_src_address, sizeof (v4_src_address));
+
+    }
+
+  /* send it... */
+  S;
+  /* Wait for a reply... */
+  W;
+}
+
 static int
 api_mpls_route_add_del (vat_main_t * vam)
 {
@@ -11894,11 +12354,7 @@ api_ipsec_sad_add_del_entry (vat_main_t * vam)
        if (unformat
            (i, "integ_alg %U", unformat_ipsec_integ_alg, &integ_alg))
        {
-#if DPDK_CRYPTO==1
-         if (integ_alg < IPSEC_INTEG_ALG_NONE ||
-#else
          if (integ_alg < IPSEC_INTEG_ALG_SHA1_96 ||
-#endif
              integ_alg >= IPSEC_INTEG_N_ALG)
            {
              clib_warning ("unsupported integ-alg: '%U'",
@@ -11916,33 +12372,6 @@ api_ipsec_sad_add_del_entry (vat_main_t * vam)
 
     }
 
-#if DPDK_CRYPTO==1
-  /*Special cases, aes-gcm-128 encryption */
-  if (crypto_alg == IPSEC_CRYPTO_ALG_AES_GCM_128)
-    {
-      if (integ_alg != IPSEC_INTEG_ALG_NONE
-         && integ_alg != IPSEC_INTEG_ALG_AES_GCM_128)
-       {
-         clib_warning
-           ("unsupported: aes-gcm-128 crypto-alg needs none as integ-alg");
-         return -99;
-       }
-      else                     /*set integ-alg internally to aes-gcm-128 */
-       integ_alg = IPSEC_INTEG_ALG_AES_GCM_128;
-    }
-  else if (integ_alg == IPSEC_INTEG_ALG_AES_GCM_128)
-    {
-      clib_warning ("unsupported integ-alg: aes-gcm-128");
-      return -99;
-    }
-  else if (integ_alg == IPSEC_INTEG_ALG_NONE)
-    {
-      clib_warning ("unsupported integ-alg: none");
-      return -99;
-    }
-#endif
-
-
   M (IPSEC_SAD_ADD_DEL_ENTRY, ipsec_sad_add_del_entry);
 
   mp->sad_id = ntohl (sad_id);
@@ -12814,16 +13243,6 @@ lisp_eid_put_vat (u8 * dst, u8 eid[16], u8 type)
   clib_memcpy (dst, eid, lisp_eid_size_vat (type));
 }
 
-/* *INDENT-OFF* */
-/** Used for transferring locators via VPP API */
-typedef CLIB_PACKED(struct
-{
-  u32 sw_if_index; /**< locator sw_if_index */
-  u8 priority; /**< locator priority */
-  u8 weight;   /**< locator weight */
-}) ls_locator_t;
-/* *INDENT-ON* */
-
 static int
 api_lisp_add_del_locator_set (vat_main_t * vam)
 {
@@ -12833,7 +13252,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
   u8 is_add = 1;
   u8 *locator_set_name = NULL;
   u8 locator_set_name_set = 0;
-  ls_locator_t locator, *locators = 0;
+  vl_api_local_locator_t locator, *locators = 0;
   u32 sw_if_index, priority, weight;
   u32 data_len = 0;
 
@@ -12886,7 +13305,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
     }
   vec_add1 (locator_set_name, 0);
 
-  data_len = sizeof (ls_locator_t) * vec_len (locators);
+  data_len = sizeof (vl_api_local_locator_t) * vec_len (locators);
 
   /* Construct the API message */
   M2 (LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set, data_len);
@@ -13888,7 +14307,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
   u32 action = ~0, p, w, data_len;
   ip4_address_t rloc4;
   ip6_address_t rloc6;
-  rloc_t *rlocs = 0, rloc, *curr_rloc = 0;
+  vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
 
   memset (&rloc, 0, sizeof (rloc));
 
@@ -13967,7 +14386,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
       return -99;
     }
 
-  data_len = vec_len (rlocs) * sizeof (rloc_t);
+  data_len = vec_len (rlocs) * sizeof (vl_api_remote_locator_t);
 
   M2 (LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping, data_len);
   mp->is_add = is_add;
@@ -14580,6 +14999,58 @@ api_lisp_eid_table_dump (vat_main_t * vam)
   return 0;
 }
 
+static int
+api_lisp_gpe_fwd_entries_get (vat_main_t * vam)
+{
+  unformat_input_t *i = vam->input;
+  vl_api_lisp_gpe_fwd_entries_get_t *mp;
+  f64 timeout = ~0;
+  u8 vni_set = 0;
+  u32 vni = ~0;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "vni %d", &vni))
+       {
+         vni_set = 1;
+       }
+      else
+       {
+         errmsg ("parse error '%U'", format_unformat_error, i);
+         return -99;
+       }
+    }
+
+  if (!vni_set)
+    {
+      errmsg ("vni not set!");
+      return -99;
+    }
+
+  if (!vam->json_output)
+    {
+      print (vam->ofp, "%10s %10s %s %40s", "fwd_index", "dp_table",
+            "leid", "reid");
+    }
+
+  M (LISP_GPE_FWD_ENTRIES_GET, lisp_gpe_fwd_entries_get);
+  mp->vni = clib_host_to_net_u32 (vni);
+
+  /* send it... */
+  S;
+
+  /* Wait for a reply... */
+  W;
+
+  /* NOTREACHED */
+  return 0;
+}
+
+#define vl_api_lisp_gpe_fwd_entries_get_reply_t_endian vl_noop_handler
+#define vl_api_lisp_gpe_fwd_entries_get_reply_t_print vl_noop_handler
+#define vl_api_lisp_gpe_fwd_entry_path_details_t_endian vl_noop_handler
+#define vl_api_lisp_gpe_fwd_entry_path_details_t_print vl_noop_handler
+
 static int
 api_lisp_adjacencies_get (vat_main_t * vam)
 {
@@ -14703,6 +15174,50 @@ api_show_lisp_status (vat_main_t * vam)
   return 0;
 }
 
+static int
+api_lisp_gpe_fwd_entry_path_dump (vat_main_t * vam)
+{
+  vl_api_lisp_gpe_fwd_entry_path_dump_t *mp;
+  f64 timeout = ~0;
+  unformat_input_t *i = vam->input;
+  u32 fwd_entry_index = ~0;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "index %d", &fwd_entry_index))
+       ;
+      else
+       break;
+    }
+
+  if (~0 == fwd_entry_index)
+    {
+      errmsg ("no index specified!");
+      return -99;
+    }
+
+  if (!vam->json_output)
+    {
+      print (vam->ofp, "first line");
+    }
+
+  M (LISP_GPE_FWD_ENTRY_PATH_DUMP, lisp_gpe_fwd_entry_path_dump);
+
+  /* send it... */
+  S;
+  /* Use a control ping for synchronization */
+  {
+    vl_api_control_ping_t *mp;
+    M (CONTROL_PING, control_ping);
+    S;
+  }
+  /* Wait for a reply... */
+  W;
+
+  /* NOTREACHED */
+  return 0;
+}
+
 static int
 api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
 {
@@ -16018,7 +16533,10 @@ static void
   vat_json_object_add_uint (node, "src-if-index", sw_if_index_from);
   vat_json_object_add_string_copy (node, "src-if-name", sw_if_from_name);
   vat_json_object_add_uint (node, "dst-if-index", sw_if_index_to);
-  vat_json_object_add_string_copy (node, "dst-if-name", sw_if_to_name);
+  if (0 != sw_if_to_name)
+    {
+      vat_json_object_add_string_copy (node, "dst-if-name", sw_if_to_name);
+    }
   vat_json_object_add_uint (node, "state", mp->state);
 }
 
@@ -17348,7 +17866,7 @@ _(sw_interface_set_mpls_enable,                                         \
 _(sw_interface_set_vpath,                                               \
   "<intfc> | sw_if_index <id> enable | disable")                        \
 _(sw_interface_set_vxlan_bypass,                                        \
-  "<intfc> | sw_if_index <id> [ip4 | ip6] enable | disable")            \
+  "<intfc> | sw_if_index <id> [ip4 | ip6] [enable | disable]")          \
 _(sw_interface_set_l2_xconnect,                                         \
   "rx <intfc> | rx_sw_if_index <id> tx <intfc> | tx_sw_if_index <id>\n" \
   "enable | disable")                                                   \
@@ -17377,6 +17895,9 @@ _(ip_add_del_route,                                                     \
   "[<intfc> | sw_if_index <id>] [resolve-attempts <n>]\n"               \
   "[weight <n>] [drop] [local] [classify <n>] [del]\n"                  \
   "[multipath] [count <n>]")                                            \
+_(ip_mroute_add_del,                                                    \
+  "<src> <grp>/<mask> [table-id <n>]\n"                                 \
+  "[<intfc> | sw_if_index <id>] [local] [del]")                         \
 _(mpls_route_add_del,                                                   \
   "<label> <eos> via <addr> [table-id <n>]\n"                           \
   "[<intfc> | sw_if_index <id>] [resolve-attempts <n>]\n"               \
@@ -17587,6 +18108,8 @@ _(lisp_eid_table_map_dump, "l2|l3")                                     \
 _(lisp_map_resolver_dump, "")                                           \
 _(lisp_map_server_dump, "")                                             \
 _(lisp_adjacencies_get, "vni <vni>")                                    \
+_(lisp_gpe_fwd_entries_get, "vni <vni>")                                \
+_(lisp_gpe_fwd_entry_path_dump, "index <fwd_entry_index>")              \
 _(show_lisp_rloc_probe_state, "")                                       \
 _(show_lisp_map_register_state, "")                                     \
 _(show_lisp_status, "")                                                 \