Add an option to dump details about specific LISP EID in API/CLI
[vpp.git] / vpp-api-test / vat / api_format.c
index 48e924a..fea2468 100644 (file)
@@ -30,7 +30,7 @@
 #include <vnet/vxlan-gpe/vxlan_gpe.h>
 #include <vnet/lisp-gpe/lisp_gpe.h>
 
-#include <api/vpe_msg_enum.h>
+#include <vpp-api/vpe_msg_enum.h>
 #include <vnet/l2/l2_classify.h> 
 #include <vnet/l2/l2_vtr.h>
 #include <vnet/classify/input_acl.h>
 #include "vat/json_format.h"
 
 #define vl_typedefs             /* define message structures */
-#include <api/vpe_all_api_h.h> 
+#include <vpp-api/vpe_all_api_h.h> 
 #undef vl_typedefs
 
 /* declare message handlers for each api */
 
 #define vl_endianfun             /* define message structures */
-#include <api/vpe_all_api_h.h> 
+#include <vpp-api/vpe_all_api_h.h> 
 #undef vl_endianfun
 
 /* instantiate all the print functions we know about */
 #define vl_print(handle, ...)
 #define vl_printfun
-#include <api/vpe_all_api_h.h>
+#include <vpp-api/vpe_all_api_h.h>
 #undef vl_printfun
 
 uword unformat_sw_if_index (unformat_input_t * input, va_list * args)
@@ -1984,12 +1984,21 @@ vl_api_lisp_local_eid_table_details_t_handler (
 {
     vat_main_t *vam = &vat_main;
     u8 *prefix;
+    u8 * (*format_eid)(u8 *, va_list *) = 0;
 
-    prefix = format(0, "[&d] %U/%d",
+    switch (mp->eid_type)
+      {
+      case 0: format_eid = format_ip4_address; break;
+      case 1: format_eid = format_ip6_address; break;
+      case 2: format_eid = format_ethernet_address; break;
+      default:
+        errmsg ("unknown EID type %d!", mp->eid_type);
+        return;
+      }
+
+    prefix = format(0, "[%d] %U/%d",
                     clib_net_to_host_u32 (mp->vni),
-                    mp->eid_is_ipv6 ? format_ip6_address : format_ip4_address,
-                    mp->eid_ip_address,
-                    mp->eid_prefix_len);
+                    format_eid, mp->eid, mp->eid_prefix_len);
 
     fformat(vam->ofp, "%=20s%=30s\n",
             mp->locator_set_name, prefix);
@@ -2005,6 +2014,7 @@ vl_api_lisp_local_eid_table_details_t_handler_json (
     vat_json_node_t *node = NULL;
     struct in6_addr ip6;
     struct in_addr ip4;
+    u8 * s = 0;
 
     if (VAT_JSON_ARRAY != vam->json_tree.type) {
         ASSERT(VAT_JSON_NONE == vam->json_tree.type);
@@ -2014,15 +2024,28 @@ vl_api_lisp_local_eid_table_details_t_handler_json (
 
     vat_json_init_object(node);
     vat_json_object_add_string_copy(node, "locator-set", mp->locator_set_name);
-    if (mp->eid_is_ipv6) {
-        clib_memcpy(&ip6, mp->eid_ip_address, sizeof(ip6));
-        vat_json_object_add_ip6(node, "eid address", ip6);
-    } else {
-        clib_memcpy(&ip4, mp->eid_ip_address, sizeof(ip4));
-        vat_json_object_add_ip4(node, "eid address", ip4);
-    }
+    switch (mp->eid_type)
+      {
+      case 0:
+        clib_memcpy(&ip4, mp->eid, sizeof(ip4));
+        vat_json_object_add_ip4(node, "eid-address", ip4);
+        break;
+      case 1:
+        clib_memcpy(&ip6, mp->eid, sizeof(ip6));
+        vat_json_object_add_ip6(node, "eid-address", ip6);
+        break;
+      case 2:
+        s = format (0, "%U", format_ethernet_address, mp->eid);
+        vec_add1(s, 0);
+        vat_json_object_add_string_copy(node, "eid-address", s);
+        vec_free(s);
+        break;
+      default:
+        errmsg ("unknown EID type %d!", mp->eid_type);
+        return;
+      }
     vat_json_object_add_uint(node, "vni", clib_net_to_host_u32 (mp->vni));
-    vat_json_object_add_uint(node, "eid prefix len", mp->eid_prefix_len);
+    vat_json_object_add_uint(node, "eid-prefix-len", mp->eid_prefix_len);
 }
 
 static u8 *
@@ -2358,6 +2381,175 @@ static void vl_api_policer_details_t_handler_json
     vec_free(type_str);
 }
 
+static void vl_api_classify_table_ids_reply_t_handler (vl_api_classify_table_ids_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    int i, count = ntohl(mp->count);
+
+    if (count>0)
+       fformat (vam->ofp, "classify table ids (%d) : ", count);
+    for (i = 0; i < count; i++)
+    {
+        fformat (vam->ofp, "%d", ntohl(mp->ids[i]));
+        fformat (vam->ofp, (i<count-1)?",":"\n");
+    }
+    vam->retval = ntohl(mp->retval);
+    vam->result_ready = 1;
+}
+
+static void vl_api_classify_table_ids_reply_t_handler_json (vl_api_classify_table_ids_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    int i, count = ntohl(mp->count);
+
+    if (count>0) {
+        vat_json_node_t node;
+
+        vat_json_init_object(&node);
+           for (i = 0; i < count; i++)
+           {
+               vat_json_object_add_uint(&node, "table_id", ntohl(mp->ids[i]));
+           }
+           vat_json_print(vam->ofp, &node);
+           vat_json_free(&node);
+    }
+    vam->retval = ntohl(mp->retval);
+    vam->result_ready = 1;
+}
+
+static void vl_api_classify_table_by_interface_reply_t_handler (vl_api_classify_table_by_interface_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    u32 table_id;
+
+    table_id = ntohl(mp->l2_table_id);
+    if (table_id != ~0)
+       fformat (vam->ofp, "l2 table id : %d\n", table_id);
+    else
+       fformat (vam->ofp, "l2 table id : No input ACL tables configured\n");
+    table_id = ntohl(mp->ip4_table_id);
+    if (table_id != ~0)
+       fformat (vam->ofp, "ip4 table id : %d\n", table_id);
+    else
+       fformat (vam->ofp, "ip4 table id : No input ACL tables configured\n");
+    table_id = ntohl(mp->ip6_table_id);
+    if (table_id != ~0)
+       fformat (vam->ofp, "ip6 table id : %d\n", table_id);
+    else
+       fformat (vam->ofp, "ip6 table id : No input ACL tables configured\n");
+    vam->retval = ntohl(mp->retval);
+    vam->result_ready = 1;
+}
+
+static void vl_api_classify_table_by_interface_reply_t_handler_json (vl_api_classify_table_by_interface_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    vat_json_node_t node;
+
+    vat_json_init_object(&node);
+
+    vat_json_object_add_int(&node, "l2_table_id", ntohl(mp->l2_table_id));
+    vat_json_object_add_int(&node, "ip4_table_id", ntohl(mp->ip4_table_id));
+    vat_json_object_add_int(&node, "ip6_table_id", ntohl(mp->ip6_table_id));
+
+    vat_json_print(vam->ofp, &node);
+    vat_json_free(&node);
+
+    vam->retval = ntohl(mp->retval);
+    vam->result_ready = 1;
+}
+
+/* Format hex dump. */
+u8 * format_hex_bytes (u8 * s, va_list * va)
+{
+    u8 * bytes = va_arg (*va, u8 *);
+    int n_bytes = va_arg (*va, int);
+    uword i;
+
+    /* Print short or long form depending on byte count. */
+    uword short_form = n_bytes <= 32;
+    uword indent = format_get_indent (s);
+
+    if (n_bytes == 0)
+        return s;
+
+    for (i = 0; i < n_bytes; i++)
+    {
+        if (! short_form && (i % 32) == 0)
+            s = format (s, "%08x: ", i);
+        s = format (s, "%02x", bytes[i]);
+        if (! short_form && ((i + 1) % 32) == 0 && (i + 1) < n_bytes)
+            s = format (s, "\n%U", format_white_space, indent);
+    }
+
+    return s;
+}
+
+static void vl_api_classify_table_info_reply_t_handler (vl_api_classify_table_info_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    i32 retval = ntohl(mp->retval);
+    if (retval == 0) {
+        fformat (vam->ofp, "classify table info :\n");
+        fformat (vam->ofp, "sessions: %d nexttbl: %d nextnode: %d\n", ntohl(mp->active_sessions), ntohl(mp->next_table_index), ntohl(mp->miss_next_index));
+        fformat (vam->ofp, "nbuckets: %d skip: %d match: %d\n", ntohl(mp->nbuckets), ntohl(mp->skip_n_vectors), ntohl(mp->match_n_vectors));
+        fformat (vam->ofp, "mask: %U\n", format_hex_bytes, mp->mask, ntohl(mp->mask_length));
+    }
+    vam->retval = retval;
+    vam->result_ready = 1;
+}
+
+static void vl_api_classify_table_info_reply_t_handler_json (vl_api_classify_table_info_reply_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    vat_json_node_t node;
+
+    i32 retval = ntohl(mp->retval);
+    if (retval == 0) {
+        vat_json_init_object(&node);
+
+        vat_json_object_add_int(&node, "sessions", ntohl(mp->active_sessions));
+        vat_json_object_add_int(&node, "nexttbl", ntohl(mp->next_table_index));
+        vat_json_object_add_int(&node, "nextnode", ntohl(mp->miss_next_index));
+        vat_json_object_add_int(&node, "nbuckets", ntohl(mp->nbuckets));
+        vat_json_object_add_int(&node, "skip", ntohl(mp->skip_n_vectors));
+        vat_json_object_add_int(&node, "match", ntohl(mp->match_n_vectors));
+        u8 * s = format (0, "%U%c",format_hex_bytes, mp->mask, ntohl(mp->mask_length), 0);
+        vat_json_object_add_string_copy(&node, "mask", s);
+
+        vat_json_print(vam->ofp, &node);
+        vat_json_free(&node);
+    }
+    vam->retval = ntohl(mp->retval);
+    vam->result_ready = 1;
+}
+
+static void vl_api_classify_session_details_t_handler (vl_api_classify_session_details_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+
+    fformat (vam->ofp, "next_index: %d advance: %d opaque: %d ", ntohl(mp->hit_next_index), ntohl(mp->advance), ntohl(mp->opaque_index));
+    fformat (vam->ofp, "mask: %U\n", format_hex_bytes, mp->match, ntohl(mp->match_length));
+}
+
+static void vl_api_classify_session_details_t_handler_json (vl_api_classify_session_details_t * mp)
+{
+    vat_main_t * vam = &vat_main;
+    vat_json_node_t *node = NULL;
+
+    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);
+    vat_json_object_add_int(node, "next_index", ntohl(mp->hit_next_index));
+    vat_json_object_add_int(node, "advance", ntohl(mp->advance));
+    vat_json_object_add_int(node, "opaque", ntohl(mp->opaque_index));
+    u8 * s = format (0, "%U%c",format_hex_bytes, mp->match, ntohl(mp->match_length), 0);
+    vat_json_object_add_string_copy(node, "match", s);
+}
 
 #define vl_api_vnet_ip4_fib_counters_t_endian vl_noop_handler
 #define vl_api_vnet_ip4_fib_counters_t_print vl_noop_handler
@@ -2445,6 +2637,8 @@ _(trace_profile_del_reply)                              \
 _(lisp_add_del_locator_set_reply)                       \
 _(lisp_add_del_locator_reply)                           \
 _(lisp_add_del_local_eid_reply)                         \
+_(lisp_add_del_remote_mapping_reply)                    \
+_(lisp_add_del_adjacency_reply)                         \
 _(lisp_gpe_add_del_fwd_entry_reply)                     \
 _(lisp_add_del_map_resolver_reply)                      \
 _(lisp_gpe_enable_disable_reply)                        \
@@ -2626,6 +2820,8 @@ _(TRACE_PROFILE_DEL_REPLY, trace_profile_del_reply)                     \
 _(LISP_ADD_DEL_LOCATOR_SET_REPLY, lisp_add_del_locator_set_reply)       \
 _(LISP_ADD_DEL_LOCATOR_REPLY, lisp_add_del_locator_reply)               \
 _(LISP_ADD_DEL_LOCAL_EID_REPLY, lisp_add_del_local_eid_reply)           \
+_(LISP_ADD_DEL_REMOTE_MAPPING_REPLY, lisp_add_del_remote_mapping_reply) \
+_(LISP_ADD_DEL_ADJACENCY_REPLY, lisp_add_del_adjacency_reply)           \
 _(LISP_GPE_ADD_DEL_FWD_ENTRY_REPLY, lisp_gpe_add_del_fwd_entry_reply)   \
 _(LISP_ADD_DEL_MAP_RESOLVER_REPLY, lisp_add_del_map_resolver_reply)     \
 _(LISP_GPE_ENABLE_DISABLE_REPLY, lisp_gpe_enable_disable_reply)         \
@@ -2652,7 +2848,11 @@ _(NETMAP_DELETE_REPLY, netmap_delete_reply)                             \
 _(MPLS_GRE_TUNNEL_DETAILS, mpls_gre_tunnel_details)                     \
 _(MPLS_ETH_TUNNEL_DETAILS, mpls_eth_tunnel_details)                     \
 _(MPLS_FIB_ENCAP_DETAILS, mpls_fib_encap_details)                       \
-_(MPLS_FIB_DECAP_DETAILS, mpls_fib_decap_details)
+_(MPLS_FIB_DECAP_DETAILS, mpls_fib_decap_details)                       \
+_(CLASSIFY_TABLE_IDS_REPLY, classify_table_ids_reply)                   \
+_(CLASSIFY_TABLE_BY_INTERFACE_REPLY, classify_table_by_interface_reply) \
+_(CLASSIFY_TABLE_INFO_REPLY, classify_table_info_reply)                 \
+_(CLASSIFY_SESSION_DETAILS, classify_session_details)
 
 /* M: construct, but don't yet send a message */
 
@@ -5548,7 +5748,7 @@ static int api_sw_interface_ip6nd_ra_config (vat_main_t * vam)
     f64 timeout;
     u32 sw_if_index;
     u8 sw_if_index_set = 0;
-    u8 surpress = 0;
+    u8 suppress = 0;
     u8 managed = 0;
     u8 other = 0;
     u8 ll_option = 0;
@@ -5579,8 +5779,8 @@ static int api_sw_interface_ip6nd_ra_config (vat_main_t * vam)
             ;
         else if (unformat (i, "interval %d", &initial_interval))
             ;
-       else if (unformat (i, "surpress"))
-           surpress = 1;
+       else if (unformat (i, "suppress") || unformat (i, "surpress"))
+           suppress = 1;
        else if (unformat (i, "managed"))
            managed = 1;
        else if (unformat (i, "other"))
@@ -5615,7 +5815,7 @@ static int api_sw_interface_ip6nd_ra_config (vat_main_t * vam)
     mp->lifetime = ntohl(lifetime);
     mp->initial_count = ntohl(initial_count);
     mp->initial_interval = ntohl(initial_interval);
-    mp->surpress = surpress;
+    mp->suppress = suppress;
     mp->managed = managed;
     mp->other = other;
     mp->ll_option = ll_option;
@@ -9818,9 +10018,9 @@ api_lisp_add_del_locator(vat_main_t * vam)
     u32 sw_if_index = ~0;
     u8  sw_if_index_set = 0;
     u8  sw_if_index_if_name_set = 0;
-    u8  priority = ~0;
+    u32  priority = ~0;
     u8  priority_set = 0;
-    u8  weight = ~0;
+    u32  weight = ~0;
     u8  weight_set = 0;
     u8  is_add = 1;
     u8  *locator_set_name = NULL;
@@ -9913,9 +10113,11 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
     u8 is_add = 1;
     u8 eidv4_set = 0;
     u8 eidv6_set = 0;
+    u8 eid_type = (u8)~0;
     ip4_address_t eidv4;
     ip6_address_t eidv6;
-    u8 tmp_eid_lenght = ~0;
+    u8 mac[6] = {0};
+    u32 tmp_eid_lenght = ~0;
     u8 eid_lenght = ~0;
     u8 *locator_set_name = NULL;
     u8 locator_set_name_set = 0;
@@ -9931,10 +10133,14 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
             &eidv4, &tmp_eid_lenght)) {
             eid_lenght = tmp_eid_lenght;
             eidv4_set = 1;
+            eid_type = 0; /* ipv4 type */
         } else if (unformat(input, "eid %U/%d", unformat_ip6_address,
             &eidv6, &tmp_eid_lenght)) {
             eid_lenght = tmp_eid_lenght;
             eidv6_set = 1;
+            eid_type = 1; /* ipv6 type */
+        } else if (unformat(input, "eid %U", unformat_ethernet_address, mac)) {
+            eid_type = 2; /* mac type */
         } else if (unformat(input, "locator-set %s", &locator_set_name)) {
             locator_set_name_set = 1;
         } else
@@ -9946,6 +10152,12 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
         return -99;
     }
 
+    if ((u8)~0 == eid_type) {
+        errmsg ("EID address not set!");
+        vec_free(locator_set_name);
+        return -99;
+    }
+
     if (vec_len(locator_set_name) > 64) {
         errmsg ("locator-set name too long\n");
         vec_free(locator_set_name);
@@ -9959,12 +10171,6 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
         return -99;
     }
 
-    if (!eidv4_set && !eidv6_set) {
-        errmsg ("eid addresses not set\n");
-        vec_free(locator_set_name);
-        return -99;
-    }
-
     if (eidv4_set && eid_lenght > 32) {
         errmsg ("eid prefix to big\n");
         vec_free(locator_set_name);
@@ -9981,13 +10187,18 @@ api_lisp_add_del_local_eid(vat_main_t * vam)
     M(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid);
 
     mp->is_add = is_add;
-    if (eidv6_set) {
-        mp->is_ipv6 = 1;
-        clib_memcpy(mp->ip_address, &eidv6, sizeof(eidv6));
-    } else {
-        mp->is_ipv6 = 0;
-        clib_memcpy(mp->ip_address, &eidv4, sizeof(eidv4));
+    switch (eid_type) {
+    case 0: /* ipv4 */
+      clib_memcpy (mp->eid, &eidv4, sizeof(eidv4));
+      break;
+    case 1: /* ipv6 */
+      clib_memcpy (mp->eid, &eidv6, sizeof(eidv6));
+      break;
+    case 2: /* mac */
+      clib_memcpy (mp->eid, mac, 6);
+      break;
     }
+    mp->eid_type = eid_type;
     mp->prefix_len = eid_lenght;
     mp->vni = clib_host_to_net_u32(vni);
     clib_memcpy(mp->locator_set_name, locator_set_name,
@@ -10015,7 +10226,7 @@ api_lisp_gpe_add_del_fwd_entry(vat_main_t * vam)
     u8 eidv6_set = 0, slocv6_set = 0, dlocv6_set = 0;
     ip4_address_t eidv4, slocv4, dlocv4;
     ip6_address_t eidv6, slocv6, dlocv6;
-    u8 tmp_eid_lenght = ~0;
+    u32 tmp_eid_lenght = ~0;
     u8 eid_lenght = ~0;
 
     /* Parse args required to build the message */
@@ -10359,8 +10570,7 @@ api_lisp_eid_table_add_del_map (vat_main_t * vam)
 }
 
 /**
- * Add/del remote mapping from LISP control plane and updates
- * forwarding entries in data-plane accordingly.
+ * Add/del remote mapping to/from LISP control plane
  *
  * @param vam vpp API test context
  * @return return code
@@ -10372,15 +10582,18 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
     vl_api_lisp_add_del_remote_mapping_t *mp;
     f64 timeout = ~0;
     u32 vni = 0;
-    u8 seid_set = 0, deid_set = 0;
     ip4_address_t seid4, deid4, rloc4;
     ip6_address_t seid6, deid6, rloc6;
+    u8 deid_mac[6] = {0};
+    u8 seid_mac[6] = {0};
+    u8 deid_type, seid_type;
     u32 seid_len = 0, deid_len = 0, len;
-    u8 deid_is_ip4 = 0, seid_is_ip4 = 0;
     u8 is_add = 1, del_all = 0;
     u32 action = ~0;
     rloc_t * rlocs = 0, rloc;
 
+    seid_type = deid_type =  (u8)~0;
+
     /* Parse args required to build the message */
     while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
         if (unformat(input, "del-all")) {
@@ -10391,24 +10604,26 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
             is_add = 1;
         } else if (unformat(input, "deid %U/%d", unformat_ip4_address,
                             &deid4, &len)) {
-            deid_set = 1;
-            deid_is_ip4 = 1;
+            deid_type = 0; /* ipv4 */
             deid_len = len;
         } else if (unformat(input, "deid %U/%d", unformat_ip6_address,
                             &deid6, &len)) {
-            deid_set = 1;
-            deid_is_ip4 = 0;
+            deid_type = 1; /* ipv6 */
             deid_len = len;
+        } else if (unformat(input, "deid %U", unformat_ethernet_address,
+                            deid_mac)) {
+            deid_type = 2; /* mac */
         } else if (unformat(input, "seid %U/%d", unformat_ip4_address,
                             &seid4, &len)) {
-            seid_set = 1;
-            seid_is_ip4 = 1;
+            seid_type = 0; /* ipv4 */
             seid_len = len;
         } else if (unformat(input, "seid %U/%d", unformat_ip6_address,
                             &seid6, &len)) {
-            seid_set = 1;
-            seid_is_ip4 = 0;
+            seid_type = 1; /* ipv6 */
             seid_len = len;
+        } else if (unformat(input, "seid %U", unformat_ethernet_address,
+                            seid_mac)) {
+            seid_type = 2; /* mac */
         } else if (unformat(input, "vni %d", &vni)) {
             ;
         } else if (unformat(input, "rloc %U", unformat_ip4_address, &rloc4)) {
@@ -10427,13 +10642,13 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
         }
     }
 
-    if (!seid_set || !deid_set) {
+    if ((u8)~0 == deid_type) {
         errmsg ("missing params!");
         return -99;
     }
 
-    if (seid_is_ip4 != deid_is_ip4) {
-        errmsg ("source and destination EIDs are not in " "same IP family!");
+    if (seid_type != deid_type) {
+        errmsg ("source and destination EIDs are of different types!");
         return -99;
     }
 
@@ -10450,20 +10665,153 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
     mp->action = (u8) action;
     mp->deid_len = deid_len;
     mp->del_all = del_all;
-    if (seid_is_ip4) {
-        mp->eid_is_ip4 = 1;
+    mp->eid_type = deid_type;
+
+    switch (mp->eid_type) {
+    case 0:
         clib_memcpy (mp->seid, &seid4, sizeof (seid4));
-    } else {
-        mp->eid_is_ip4 = 0;
+        clib_memcpy (mp->deid, &deid4, sizeof (deid4));
+        break;
+    case 1:
         clib_memcpy (mp->seid, &seid6, sizeof (seid6));
+        clib_memcpy (mp->deid, &deid6, sizeof (deid6));
+        break;
+    case 2:
+        clib_memcpy (mp->seid, seid_mac, 6);
+        clib_memcpy (mp->deid, deid_mac, 6);
+        break;
+    default:
+        errmsg ("unknown EID type %d!", mp->eid_type);
+        return 0;
+    }
+
+    mp->rloc_num = vec_len (rlocs);
+    clib_memcpy (mp->rlocs, rlocs, (sizeof (rloc_t) * vec_len (rlocs)));
+    vec_free (rlocs);
+
+    /* send it... */
+    S;
+
+    /* Wait for a reply... */
+    W;
+
+    /* NOTREACHED */
+    return 0;
+}
+
+/**
+ * Add/del LISP adjacency. Saves mapping in LISP control plane and updates
+ * forwarding entries in data-plane accordingly.
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_lisp_add_del_adjacency (vat_main_t * vam)
+{
+    unformat_input_t * input = vam->input;
+    vl_api_lisp_add_del_adjacency_t *mp;
+    f64 timeout = ~0;
+    u32 vni = 0;
+    ip4_address_t seid4, deid4, rloc4;
+    ip6_address_t seid6, deid6, rloc6;
+    u8 deid_mac[6] = {0};
+    u8 seid_mac[6] = {0};
+    u8 deid_type, seid_type;
+    u32 seid_len = 0, deid_len = 0, len;
+    u8 is_add = 1;
+    u32 action = ~0;
+    rloc_t * rlocs = 0, rloc;
+
+    memset(mp, 0, sizeof(mp[0]));
+    seid_type = deid_type =  (u8)~0;
+
+    /* Parse args required to build the message */
+    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
+        if (unformat(input, "del")) {
+            is_add = 0;
+        } else if (unformat(input, "add")) {
+            is_add = 1;
+        } else if (unformat(input, "deid %U/%d", unformat_ip4_address,
+                            &deid4, &len)) {
+            deid_type = 0; /* ipv4 */
+            deid_len = len;
+        } else if (unformat(input, "deid %U/%d", unformat_ip6_address,
+                            &deid6, &len)) {
+            deid_type = 1; /* ipv6 */
+            deid_len = len;
+        } else if (unformat(input, "deid %U", unformat_ethernet_address,
+                            deid_mac)) {
+            deid_type = 2; /* mac */
+        } else if (unformat(input, "seid %U/%d", unformat_ip4_address,
+                            &seid4, &len)) {
+            seid_type = 0; /* ipv4 */
+            seid_len = len;
+        } else if (unformat(input, "seid %U/%d", unformat_ip6_address,
+                            &seid6, &len)) {
+            seid_type = 1; /* ipv6 */
+            seid_len = len;
+        } else if (unformat(input, "seid %U", unformat_ethernet_address,
+                            seid_mac)) {
+            seid_type = 2; /* mac */
+        } else if (unformat(input, "vni %d", &vni)) {
+            ;
+        } else if (unformat(input, "rloc %U", unformat_ip4_address, &rloc4)) {
+            rloc.is_ip4 = 1;
+            clib_memcpy (&rloc.addr, &rloc4, sizeof (rloc4));
+            vec_add1 (rlocs, rloc);
+        } else if (unformat(input, "rloc %U", unformat_ip6_address, &rloc6)) {
+            rloc.is_ip4 = 0;
+            clib_memcpy (&rloc.addr, &rloc6, sizeof (rloc6));
+            vec_add1 (rlocs, rloc);
+        } else if (unformat(input, "action %d", &action)) {
+            ;
+        } else {
+            clib_warning ("parse error '%U'", format_unformat_error, input);
+            return -99;
+        }
+    }
+
+    if ((u8)~0 == deid_type) {
+        errmsg ("missing params!");
+        return -99;
+    }
+
+    if (seid_type != deid_type) {
+        errmsg ("source and destination EIDs are of different types!");
+        return -99;
+    }
+
+    if (is_add && (~0 == action)
+        && 0 == vec_len (rlocs)) {
+          errmsg ("no action set for negative map-reply!");
+          return -99;
     }
 
-    if (deid_is_ip4) {
-        mp->eid_is_ip4 = 1;
+    M(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency);
+    mp->is_add = is_add;
+    mp->vni = htonl (vni);
+    mp->seid_len = seid_len;
+    mp->action = (u8) action;
+    mp->deid_len = deid_len;
+    mp->eid_type = deid_type;
+
+    switch (mp->eid_type) {
+    case 0:
+        clib_memcpy (mp->seid, &seid4, sizeof (seid4));
         clib_memcpy (mp->deid, &deid4, sizeof (deid4));
-    } else {
-        mp->eid_is_ip4 = 0;
+        break;
+    case 1:
+        clib_memcpy (mp->seid, &seid6, sizeof (seid6));
         clib_memcpy (mp->deid, &deid6, sizeof (deid6));
+        break;
+    case 2:
+        clib_memcpy (mp->seid, seid_mac, 6);
+        clib_memcpy (mp->deid, deid_mac, 6);
+        break;
+    default:
+        errmsg ("unknown EID type %d!", mp->eid_type);
+        return 0;
     }
 
     mp->rloc_num = vec_len (rlocs);
@@ -10618,8 +10966,34 @@ api_lisp_locator_set_dump(vat_main_t *vam)
 static int
 api_lisp_local_eid_table_dump(vat_main_t *vam)
 {
+    unformat_input_t * i = vam->input;
     vl_api_lisp_local_eid_table_dump_t *mp;
     f64 timeout = ~0;
+    struct in_addr ip4;
+    struct in6_addr ip6;
+    u8 mac[6];
+    u8 eid_type = ~0, eid_set;
+    u32 prefix_length = ~0, t, vni = 0;
+
+    while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
+        if (unformat (i, "eid %U/%d", unformat_ip4_address, &ip4, &t)) {
+            eid_set = 1;
+            eid_type = 0;
+            prefix_length = t;
+        } else if (unformat (i, "eid %U/%d", unformat_ip6_address, &ip6, &t)) {
+            eid_set = 1;
+            eid_type = 1;
+            prefix_length = t;
+        } else if (unformat (i, "eid %U", unformat_ethernet_address, mac)) {
+            eid_set = 1;
+            eid_type = 2;
+        } else if (unformat (i, "vni %d", &t))
+            vni = t;
+        else {
+            errmsg ("parse error '%U'", format_unformat_error, i);
+            return -99;
+        }
+    }
 
     if (!vam->json_output) {
         fformat(vam->ofp, "%=20s%=30s\n",
@@ -10627,6 +11001,29 @@ api_lisp_local_eid_table_dump(vat_main_t *vam)
     }
 
     M(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump);
+
+    if (eid_set) {
+        mp->eid_set = 1;
+        mp->vni = htonl (vni);
+        mp->eid_type = eid_type;
+        switch (eid_type) {
+        case 0:
+            mp->prefix_length = prefix_length;
+            clib_memcpy (mp->eid, &ip4, sizeof (ip4));
+            break;
+        case 1:
+            mp->prefix_length = prefix_length;
+            clib_memcpy (mp->eid, &ip6, sizeof (ip6));
+            break;
+        case 2:
+            clib_memcpy (mp->eid, mac, sizeof (mac));
+            break;
+        default:
+            errmsg ("unknown EID type %d!", eid_type);
+            return -99;
+        }
+    }
+
     /* send it... */
     S;
 
@@ -11322,6 +11719,113 @@ static int api_mpls_fib_decap_dump (vat_main_t * vam)
     W;
 }
 
+int api_classify_table_ids (vat_main_t *vam)
+{
+    vl_api_classify_table_ids_t *mp;
+    f64 timeout;
+
+    /* Construct the API message */
+    M(CLASSIFY_TABLE_IDS, classify_table_ids);
+    mp->context = 0;
+
+    S; W;
+    /* NOTREACHED */
+    return 0;
+}
+
+int api_classify_table_by_interface (vat_main_t *vam)
+{
+    unformat_input_t * input = vam->input;
+    vl_api_classify_table_by_interface_t *mp;
+    f64 timeout;
+
+    u32 sw_if_index = ~0;
+    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
+        if (unformat (input, "%U", unformat_sw_if_index, vam, &sw_if_index))
+            ;
+        else if (unformat (input, "sw_if_index %d", &sw_if_index))
+            ;
+        else
+            break;
+    }
+    if (sw_if_index == ~0) {
+        errmsg ("missing interface name or sw_if_index\n");
+        return -99;
+    }
+
+    /* Construct the API message */
+    M(CLASSIFY_TABLE_BY_INTERFACE, classify_table_by_interface);
+    mp->context = 0;
+    mp->sw_if_index = ntohl(sw_if_index);
+
+    S; W;
+    /* NOTREACHED */
+    return 0;
+}
+
+int api_classify_table_info (vat_main_t *vam)
+{
+    unformat_input_t * input = vam->input;
+    vl_api_classify_table_info_t *mp;
+    f64 timeout;
+
+    u32 table_id = ~0;
+    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
+        if (unformat (input, "table_id %d", &table_id))
+            ;
+        else
+            break;
+    }
+    if (table_id == ~0) {
+        errmsg ("missing table id\n");
+        return -99;
+    }
+
+    /* Construct the API message */
+    M(CLASSIFY_TABLE_INFO, classify_table_info);
+    mp->context = 0;
+    mp->table_id = ntohl(table_id);
+
+    S; W;
+    /* NOTREACHED */
+    return 0;
+}
+
+int api_classify_session_dump (vat_main_t *vam)
+{
+    unformat_input_t * input = vam->input;
+    vl_api_classify_session_dump_t *mp;
+    f64 timeout;
+
+    u32 table_id = ~0;
+    while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) {
+        if (unformat (input, "table_id %d", &table_id))
+            ;
+        else
+            break;
+    }
+    if (table_id == ~0) {
+        errmsg ("missing table id\n");
+        return -99;
+    }
+
+    /* Construct the API message */
+    M(CLASSIFY_SESSION_DUMP, classify_session_dump);
+    mp->context = 0;
+    mp->table_id = ntohl(table_id);
+    S;
+
+    /* Use a control ping for synchronization */
+    {
+        vl_api_control_ping_t * mp;
+        M(CONTROL_PING, control_ping);
+        S;
+    }
+    W;
+    /* NOTREACHED */
+    return 0;
+}
+
 static int q_or_quit (vat_main_t * vam)
 {
     longjmp (vam->jump_buf, 1);
@@ -11660,7 +12164,7 @@ _(sw_interface_ip6nd_ra_prefix,                                         \
   "[nolink] [isno]")                                                    \
 _(sw_interface_ip6nd_ra_config,                                         \
   "<intfc> | sw_if_index <id> [maxint <n>] [minint <n>]\n"              \
-  "[life <n>] [count <n>] [interval <n>] [surpress]\n"                  \
+  "[life <n>] [count <n>] [interval <n>] [suppress]\n"                  \
   "[managed] [other] [ll] [send] [cease] [isno] [def]")                 \
 _(set_arp_neighbor_limit, "arp_nbr_limit <n> [ipv6]")                   \
 _(l2_patch_add_del,                                                     \
@@ -11799,10 +12303,12 @@ _(lisp_add_del_map_resolver, "<ip4|6-addr> [del]")                      \
 _(lisp_gpe_enable_disable, "enable|disable")                            \
 _(lisp_enable_disable, "enable|disable")                                \
 _(lisp_gpe_add_del_iface, "up|down")                                    \
-_(lisp_add_del_remote_mapping, "add|del vni <vni> table-id <id> "       \
-                               "deid <dest-eid> seid"                   \
+_(lisp_add_del_remote_mapping, "add|del vni <vni> deid <dest-eid> seid" \
                                " <src-eid> rloc <locator> "             \
-                               "[rloc <loc> ... ]")                     \
+                               "[rloc <loc> ... ] action <action>")     \
+_(lisp_add_del_adjacency, "add|del vni <vni> deid <dest-eid> seid"      \
+                              " <src-eid> rloc <locator> "              \
+                              "[rloc <loc> ... ] action <action>")      \
 _(lisp_pitr_set_locator_set, "locator-set <loc-set-name> | del")        \
 _(lisp_add_del_map_request_itr_rlocs, "<loc-set-name> [del]")           \
 _(lisp_eid_table_add_del_map, "[del] vni <vni> vrf <vrf>")              \
@@ -11822,7 +12328,11 @@ _(netmap_delete, "name <interface name>")                               \
 _(mpls_gre_tunnel_dump, "tunnel_index <tunnel-id>")                     \
 _(mpls_eth_tunnel_dump, "tunnel_index <tunnel-id>")                     \
 _(mpls_fib_encap_dump, "")                                              \
-_(mpls_fib_decap_dump, "")
+_(mpls_fib_decap_dump, "")                                              \
+_(classify_table_ids, "")                                               \
+_(classify_table_by_interface, "sw_if_index <sw_if_index>")             \
+_(classify_table_info, "table_id <nn>")                                 \
+_(classify_session_dump, "table_id <nn>")
 
 /* List of command functions, CLI names map directly to functions */
 #define foreach_cli_function                                    \
@@ -11904,7 +12414,7 @@ void vat_api_hookup (vat_main_t *vam)
 
 #undef vl_api_version
 #define vl_api_version(n,v) static u32 vpe_api_version = v;
-#include <api/vpe.api.h>
+#include <vpp-api/vpe.api.h>
 #undef vl_api_version
 
 void vl_client_add_api_signatures (vl_api_memclnt_create_t *mp)