Add Overlay Network Engine API 32/5432/6
authorFilip Tehlar <ftehlar@cisco.com>
Fri, 17 Feb 2017 13:29:11 +0000 (14:29 +0100)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 21 Feb 2017 23:29:45 +0000 (23:29 +0000)
Change-Id: I6b5984df176688f0722a2888e73f05d8ed8b9310
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
src/vat/api_format.c
src/vnet.am
src/vnet/lisp-cp/lisp_api.c
src/vnet/lisp-cp/lisp_cli.c
src/vnet/lisp-cp/one.api [new file with mode: 0644]
src/vnet/lisp-cp/one_api.c [new file with mode: 0644]
src/vnet/lisp-cp/one_cli.c [new file with mode: 0644]
src/vnet/vnet_all_api_h.h

index 78c5e27..b0df35f 100644 (file)
@@ -1611,8 +1611,8 @@ static void vl_api_l2tpv3_create_tunnel_reply_t_handler_json
 }
 
 
-static void vl_api_lisp_add_del_locator_set_reply_t_handler
-  (vl_api_lisp_add_del_locator_set_reply_t * mp)
+static void vl_api_one_add_del_locator_set_reply_t_handler
+  (vl_api_one_add_del_locator_set_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -1627,8 +1627,8 @@ static void vl_api_lisp_add_del_locator_set_reply_t_handler
     }
 }
 
-static void vl_api_lisp_add_del_locator_set_reply_t_handler_json
-  (vl_api_lisp_add_del_locator_set_reply_t * mp)
+static void vl_api_one_add_del_locator_set_reply_t_handler_json
+  (vl_api_one_add_del_locator_set_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -2356,7 +2356,7 @@ static void vl_api_get_node_graph_reply_t_handler_json
 }
 
 static void
-vl_api_lisp_locator_details_t_handler (vl_api_lisp_locator_details_t * mp)
+vl_api_one_locator_details_t_handler (vl_api_one_locator_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   u8 *s = 0;
@@ -2379,8 +2379,7 @@ vl_api_lisp_locator_details_t_handler (vl_api_lisp_locator_details_t * mp)
 }
 
 static void
-vl_api_lisp_locator_details_t_handler_json (vl_api_lisp_locator_details_t *
-                                           mp)
+vl_api_one_locator_details_t_handler_json (vl_api_one_locator_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -2418,8 +2417,8 @@ vl_api_lisp_locator_details_t_handler_json (vl_api_lisp_locator_details_t *
 }
 
 static void
-vl_api_lisp_locator_set_details_t_handler (vl_api_lisp_locator_set_details_t *
-                                          mp)
+vl_api_one_locator_set_details_t_handler (vl_api_one_locator_set_details_t *
+                                         mp)
 {
   vat_main_t *vam = &vat_main;
   u8 *ls_name = 0;
@@ -2432,8 +2431,8 @@ vl_api_lisp_locator_set_details_t_handler (vl_api_lisp_locator_set_details_t *
 }
 
 static void
-  vl_api_lisp_locator_set_details_t_handler_json
-  (vl_api_lisp_locator_set_details_t * mp)
+  vl_api_one_locator_set_details_t_handler_json
+  (vl_api_one_locator_set_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = 0;
@@ -2494,7 +2493,7 @@ format_lisp_eid_vat (u8 * s, va_list * args)
 }
 
 static void
-vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+vl_api_one_eid_table_details_t_handler (vl_api_one_eid_table_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   u8 *s = 0, *eid = 0;
@@ -2523,8 +2522,8 @@ vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
 }
 
 static void
-vl_api_lisp_eid_table_details_t_handler_json (vl_api_lisp_eid_table_details_t
-                                             * mp)
+vl_api_one_eid_table_details_t_handler_json (vl_api_one_eid_table_details_t
+                                            * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = 0;
@@ -2566,8 +2565,8 @@ vl_api_lisp_eid_table_details_t_handler_json (vl_api_lisp_eid_table_details_t
 }
 
 static void
-  vl_api_lisp_eid_table_map_details_t_handler
-  (vl_api_lisp_eid_table_map_details_t * mp)
+  vl_api_one_eid_table_map_details_t_handler
+  (vl_api_one_eid_table_map_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
 
@@ -2579,8 +2578,8 @@ static void
 }
 
 static void
-  vl_api_lisp_eid_table_map_details_t_handler_json
-  (vl_api_lisp_eid_table_map_details_t * mp)
+  vl_api_one_eid_table_map_details_t_handler_json
+  (vl_api_one_eid_table_map_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -2598,8 +2597,8 @@ static void
 }
 
 static void
-  vl_api_lisp_eid_table_vni_details_t_handler
-  (vl_api_lisp_eid_table_vni_details_t * mp)
+  vl_api_one_eid_table_vni_details_t_handler
+  (vl_api_one_eid_table_vni_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
 
@@ -2609,8 +2608,8 @@ static void
 }
 
 static void
-  vl_api_lisp_eid_table_vni_details_t_handler_json
-  (vl_api_lisp_eid_table_vni_details_t * mp)
+  vl_api_one_eid_table_vni_details_t_handler_json
+  (vl_api_one_eid_table_vni_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -2626,8 +2625,8 @@ static void
 }
 
 static void
-  vl_api_show_lisp_map_register_state_reply_t_handler
-  (vl_api_show_lisp_map_register_state_reply_t * mp)
+  vl_api_show_one_map_register_state_reply_t_handler
+  (vl_api_show_one_map_register_state_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   int retval = clib_net_to_host_u32 (mp->retval);
@@ -2639,8 +2638,8 @@ static void
 }
 
 static void
-  vl_api_show_lisp_map_register_state_reply_t_handler_json
-  (vl_api_show_lisp_map_register_state_reply_t * mp)
+  vl_api_show_one_map_register_state_reply_t_handler_json
+  (vl_api_show_one_map_register_state_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t _node, *node = &_node;
@@ -2660,8 +2659,8 @@ static void
 }
 
 static void
-  vl_api_show_lisp_rloc_probe_state_reply_t_handler
-  (vl_api_show_lisp_rloc_probe_state_reply_t * mp)
+  vl_api_show_one_rloc_probe_state_reply_t_handler
+  (vl_api_show_one_rloc_probe_state_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   int retval = clib_net_to_host_u32 (mp->retval);
@@ -2676,8 +2675,8 @@ end:
 }
 
 static void
-  vl_api_show_lisp_rloc_probe_state_reply_t_handler_json
-  (vl_api_show_lisp_rloc_probe_state_reply_t * mp)
+  vl_api_show_one_rloc_probe_state_reply_t_handler_json
+  (vl_api_show_one_rloc_probe_state_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t _node, *node = &_node;
@@ -2851,13 +2850,13 @@ end:
 }
 
 static void
-  vl_api_lisp_adjacencies_get_reply_t_handler
-  (vl_api_lisp_adjacencies_get_reply_t * mp)
+  vl_api_one_adjacencies_get_reply_t_handler
+  (vl_api_one_adjacencies_get_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   u32 i, n;
   int retval = clib_net_to_host_u32 (mp->retval);
-  vl_api_lisp_adjacency_t *a;
+  vl_api_one_adjacency_t *a;
 
   if (retval)
     goto end;
@@ -2878,15 +2877,15 @@ end:
 }
 
 static void
-  vl_api_lisp_adjacencies_get_reply_t_handler_json
-  (vl_api_lisp_adjacencies_get_reply_t * mp)
+  vl_api_one_adjacencies_get_reply_t_handler_json
+  (vl_api_one_adjacencies_get_reply_t * mp)
 {
   u8 *s = 0;
   vat_main_t *vam = &vat_main;
   vat_json_node_t *e = 0, root;
   u32 i, n;
   int retval = clib_net_to_host_u32 (mp->retval);
-  vl_api_lisp_adjacency_t *a;
+  vl_api_one_adjacency_t *a;
 
   if (retval)
     goto end;
@@ -2922,8 +2921,7 @@ end:
 }
 
 static void
-vl_api_lisp_map_server_details_t_handler (vl_api_lisp_map_server_details_t
-                                         * mp)
+vl_api_one_map_server_details_t_handler (vl_api_one_map_server_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
 
@@ -2933,8 +2931,8 @@ vl_api_lisp_map_server_details_t_handler (vl_api_lisp_map_server_details_t
 }
 
 static void
-  vl_api_lisp_map_server_details_t_handler_json
-  (vl_api_lisp_map_server_details_t * mp)
+  vl_api_one_map_server_details_t_handler_json
+  (vl_api_one_map_server_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -2962,8 +2960,8 @@ static void
 }
 
 static void
-vl_api_lisp_map_resolver_details_t_handler (vl_api_lisp_map_resolver_details_t
-                                           * mp)
+vl_api_one_map_resolver_details_t_handler (vl_api_one_map_resolver_details_t
+                                          * mp)
 {
   vat_main_t *vam = &vat_main;
 
@@ -2973,8 +2971,8 @@ vl_api_lisp_map_resolver_details_t_handler (vl_api_lisp_map_resolver_details_t
 }
 
 static void
-  vl_api_lisp_map_resolver_details_t_handler_json
-  (vl_api_lisp_map_resolver_details_t * mp)
+  vl_api_one_map_resolver_details_t_handler_json
+  (vl_api_one_map_resolver_details_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -3002,8 +3000,7 @@ static void
 }
 
 static void
-  vl_api_show_lisp_status_reply_t_handler
-  (vl_api_show_lisp_status_reply_t * mp)
+vl_api_show_one_status_reply_t_handler (vl_api_show_one_status_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -3020,8 +3017,8 @@ static void
 }
 
 static void
-  vl_api_show_lisp_status_reply_t_handler_json
-  (vl_api_show_lisp_status_reply_t * mp)
+  vl_api_show_one_status_reply_t_handler_json
+  (vl_api_show_one_status_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -3049,8 +3046,8 @@ static void
 }
 
 static void
-  vl_api_lisp_get_map_request_itr_rlocs_reply_t_handler
-  (vl_api_lisp_get_map_request_itr_rlocs_reply_t * mp)
+  vl_api_one_get_map_request_itr_rlocs_reply_t_handler
+  (vl_api_one_get_map_request_itr_rlocs_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -3065,8 +3062,8 @@ static void
 }
 
 static void
-  vl_api_lisp_get_map_request_itr_rlocs_reply_t_handler_json
-  (vl_api_lisp_get_map_request_itr_rlocs_reply_t * mp)
+  vl_api_one_get_map_request_itr_rlocs_reply_t_handler_json
+  (vl_api_one_get_map_request_itr_rlocs_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t *node = NULL;
@@ -3104,8 +3101,8 @@ format_lisp_map_request_mode (u8 * s, va_list * args)
 }
 
 static void
-  vl_api_show_lisp_map_request_mode_reply_t_handler
-  (vl_api_show_lisp_map_request_mode_reply_t * mp)
+  vl_api_show_one_map_request_mode_reply_t_handler
+  (vl_api_show_one_map_request_mode_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -3122,8 +3119,8 @@ static void
 }
 
 static void
-  vl_api_show_lisp_map_request_mode_reply_t_handler_json
-  (vl_api_show_lisp_map_request_mode_reply_t * mp)
+  vl_api_show_one_map_request_mode_reply_t_handler_json
+  (vl_api_show_one_map_request_mode_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -3145,7 +3142,7 @@ static void
 }
 
 static void
-vl_api_show_lisp_pitr_reply_t_handler (vl_api_show_lisp_pitr_reply_t * mp)
+vl_api_show_one_pitr_reply_t_handler (vl_api_show_one_pitr_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   i32 retval = ntohl (mp->retval);
@@ -3162,8 +3159,7 @@ vl_api_show_lisp_pitr_reply_t_handler (vl_api_show_lisp_pitr_reply_t * mp)
 }
 
 static void
-vl_api_show_lisp_pitr_reply_t_handler_json (vl_api_show_lisp_pitr_reply_t *
-                                           mp)
+vl_api_show_one_pitr_reply_t_handler_json (vl_api_show_one_pitr_reply_t * mp)
 {
   vat_main_t *vam = &vat_main;
   vat_json_node_t node;
@@ -3784,8 +3780,8 @@ static void vl_api_flow_classify_details_t_handler_json
 #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
+#define vl_api_one_adjacencies_get_reply_t_endian vl_noop_handler
+#define vl_api_one_adjacencies_get_reply_t_print vl_noop_handler
 
 /*
  * Generate boilerplate reply handlers, which
@@ -3874,22 +3870,22 @@ _(cop_whitelist_enable_disable_reply)                   \
 _(sw_interface_clear_stats_reply)                       \
 _(ioam_enable_reply)                              \
 _(ioam_disable_reply)                              \
-_(lisp_add_del_locator_reply)                           \
-_(lisp_add_del_local_eid_reply)                         \
-_(lisp_add_del_remote_mapping_reply)                    \
-_(lisp_add_del_adjacency_reply)                         \
+_(one_add_del_locator_reply)                            \
+_(one_add_del_local_eid_reply)                          \
+_(one_add_del_remote_mapping_reply)                     \
+_(one_add_del_adjacency_reply)                          \
+_(one_add_del_map_resolver_reply)                       \
+_(one_add_del_map_server_reply)                         \
+_(one_enable_disable_reply)                             \
+_(one_rloc_probe_enable_disable_reply)                  \
+_(one_map_register_enable_disable_reply)                \
+_(one_pitr_set_locator_set_reply)                       \
+_(one_map_request_mode_reply)                           \
+_(one_add_del_map_request_itr_rlocs_reply)              \
+_(one_eid_table_add_del_map_reply)                      \
 _(gpe_add_del_fwd_entry_reply)                          \
-_(lisp_add_del_map_resolver_reply)                      \
-_(lisp_add_del_map_server_reply)                        \
 _(gpe_enable_disable_reply)                             \
 _(gpe_add_del_iface_reply)                              \
-_(lisp_enable_disable_reply)                            \
-_(lisp_rloc_probe_enable_disable_reply)                 \
-_(lisp_map_register_enable_disable_reply)               \
-_(lisp_pitr_set_locator_set_reply)                      \
-_(lisp_map_request_mode_reply)                          \
-_(lisp_add_del_map_request_itr_rlocs_reply)             \
-_(lisp_eid_table_add_del_map_reply)                     \
 _(vxlan_gpe_add_del_tunnel_reply)                       \
 _(af_packet_delete_reply)                               \
 _(policer_classify_set_interface_reply)                 \
@@ -4126,45 +4122,45 @@ _(GET_NODE_GRAPH_REPLY, get_node_graph_reply)                           \
 _(SW_INTERFACE_CLEAR_STATS_REPLY, sw_interface_clear_stats_reply)      \
 _(IOAM_ENABLE_REPLY, ioam_enable_reply)                   \
 _(IOAM_DISABLE_REPLY, ioam_disable_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)           \
-_(GPE_ADD_DEL_FWD_ENTRY_REPLY, gpe_add_del_fwd_entry_reply)             \
-_(LISP_ADD_DEL_MAP_RESOLVER_REPLY, lisp_add_del_map_resolver_reply)     \
-_(LISP_ADD_DEL_MAP_SERVER_REPLY, lisp_add_del_map_server_reply)         \
-_(GPE_ENABLE_DISABLE_REPLY, gpe_enable_disable_reply)                   \
-_(LISP_ENABLE_DISABLE_REPLY, lisp_enable_disable_reply)                 \
-_(LISP_MAP_REGISTER_ENABLE_DISABLE_REPLY,                               \
-  lisp_map_register_enable_disable_reply)                               \
-_(LISP_RLOC_PROBE_ENABLE_DISABLE_REPLY,                                 \
-  lisp_rloc_probe_enable_disable_reply)                                 \
-_(LISP_PITR_SET_LOCATOR_SET_REPLY, lisp_pitr_set_locator_set_reply)     \
-_(LISP_MAP_REQUEST_MODE_REPLY, lisp_map_request_mode_reply)             \
-_(LISP_EID_TABLE_ADD_DEL_MAP_REPLY, lisp_eid_table_add_del_map_reply)   \
+_(ONE_ADD_DEL_LOCATOR_SET_REPLY, one_add_del_locator_set_reply)         \
+_(ONE_ADD_DEL_LOCATOR_REPLY, one_add_del_locator_reply)                 \
+_(ONE_ADD_DEL_LOCAL_EID_REPLY, one_add_del_local_eid_reply)             \
+_(ONE_ADD_DEL_REMOTE_MAPPING_REPLY, one_add_del_remote_mapping_reply)   \
+_(ONE_ADD_DEL_ADJACENCY_REPLY, one_add_del_adjacency_reply)             \
+_(ONE_ADD_DEL_MAP_RESOLVER_REPLY, one_add_del_map_resolver_reply)       \
+_(ONE_ADD_DEL_MAP_SERVER_REPLY, one_add_del_map_server_reply)           \
+_(ONE_ENABLE_DISABLE_REPLY, one_enable_disable_reply)                   \
+_(ONE_MAP_REGISTER_ENABLE_DISABLE_REPLY,                                \
+  one_map_register_enable_disable_reply)                                \
+_(ONE_RLOC_PROBE_ENABLE_DISABLE_REPLY,                                  \
+  one_rloc_probe_enable_disable_reply)                                  \
+_(ONE_PITR_SET_LOCATOR_SET_REPLY, one_pitr_set_locator_set_reply)       \
+_(ONE_MAP_REQUEST_MODE_REPLY, one_map_request_mode_reply)               \
+_(ONE_EID_TABLE_ADD_DEL_MAP_REPLY, one_eid_table_add_del_map_reply)     \
+_(ONE_LOCATOR_SET_DETAILS, one_locator_set_details)                     \
+_(ONE_LOCATOR_DETAILS, one_locator_details)                             \
+_(ONE_EID_TABLE_DETAILS, one_eid_table_details)                         \
+_(ONE_EID_TABLE_MAP_DETAILS, one_eid_table_map_details)                 \
+_(ONE_EID_TABLE_VNI_DETAILS, one_eid_table_vni_details)                 \
+_(ONE_MAP_RESOLVER_DETAILS, one_map_resolver_details)                   \
+_(ONE_MAP_SERVER_DETAILS, one_map_server_details)                       \
+_(ONE_ADJACENCIES_GET_REPLY, one_adjacencies_get_reply)                 \
 _(GPE_ADD_DEL_IFACE_REPLY, gpe_add_del_iface_reply)                     \
-_(LISP_LOCATOR_SET_DETAILS, lisp_locator_set_details)                   \
-_(LISP_LOCATOR_DETAILS, lisp_locator_details)                           \
-_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details)                       \
-_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details)               \
-_(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)               \
+_(GPE_ENABLE_DISABLE_REPLY, gpe_enable_disable_reply)                   \
+_(GPE_ADD_DEL_FWD_ENTRY_REPLY, gpe_add_del_fwd_entry_reply)             \
 _(GPE_FWD_ENTRIES_GET_REPLY, gpe_fwd_entries_get_reply)                 \
 _(GPE_FWD_ENTRY_PATH_DETAILS,                                           \
   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)                             \
-_(LISP_GET_MAP_REQUEST_ITR_RLOCS_REPLY,                                 \
-  lisp_get_map_request_itr_rlocs_reply)                                 \
-_(SHOW_LISP_PITR_REPLY, show_lisp_pitr_reply)                           \
-_(SHOW_LISP_MAP_REQUEST_MODE_REPLY, show_lisp_map_request_mode_reply)   \
-_(SHOW_LISP_RLOC_PROBE_STATE_REPLY, show_lisp_rloc_probe_state_reply)   \
-_(SHOW_LISP_MAP_REGISTER_STATE_REPLY,                                   \
-  show_lisp_map_register_state_reply)                                   \
+_(SHOW_ONE_STATUS_REPLY, show_one_status_reply)                         \
+_(ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY,                              \
+  one_add_del_map_request_itr_rlocs_reply)                              \
+_(ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,                                  \
+  one_get_map_request_itr_rlocs_reply)                                  \
+_(SHOW_ONE_PITR_REPLY, show_one_pitr_reply)                             \
+_(SHOW_ONE_MAP_REQUEST_MODE_REPLY, show_one_map_request_mode_reply)     \
+_(SHOW_ONE_RLOC_PROBE_STATE_REPLY, show_one_rloc_probe_state_reply)     \
+_(SHOW_ONE_MAP_REGISTER_STATE_REPLY,                                    \
+  show_one_map_register_state_reply)                                    \
 _(AF_PACKET_CREATE_REPLY, af_packet_create_reply)                       \
 _(AF_PACKET_DELETE_REPLY, af_packet_delete_reply)                       \
 _(POLICER_ADD_DEL_REPLY, policer_add_del_reply)                         \
@@ -13564,10 +13560,10 @@ lisp_eid_put_vat (u8 * dst, u8 eid[16], u8 type)
 }
 
 static int
-api_lisp_add_del_locator_set (vat_main_t * vam)
+api_one_add_del_locator_set (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_locator_set_t *mp;
+  vl_api_one_add_del_locator_set_t *mp;
   u8 is_add = 1;
   u8 *locator_set_name = NULL;
   u8 locator_set_name_set = 0;
@@ -13628,7 +13624,7 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
   data_len = sizeof (vl_api_local_locator_t) * vec_len (locators);
 
   /* Construct the API message */
-  M2 (LISP_ADD_DEL_LOCATOR_SET, mp, data_len);
+  M2 (ONE_ADD_DEL_LOCATOR_SET, mp, data_len);
 
   mp->is_add = is_add;
   clib_memcpy (mp->locator_set_name, locator_set_name,
@@ -13648,11 +13644,13 @@ api_lisp_add_del_locator_set (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_locator_set api_one_add_del_locator_set
+
 static int
-api_lisp_add_del_locator (vat_main_t * vam)
+api_one_add_del_locator (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_locator_t *mp;
+  vl_api_one_add_del_locator_t *mp;
   u32 tmp_if_index = ~0;
   u32 sw_if_index = ~0;
   u8 sw_if_index_set = 0;
@@ -13743,7 +13741,7 @@ api_lisp_add_del_locator (vat_main_t * vam)
   vec_add1 (locator_set_name, 0);
 
   /* Construct the API message */
-  M (LISP_ADD_DEL_LOCATOR, mp);
+  M (ONE_ADD_DEL_LOCATOR, mp);
 
   mp->is_add = is_add;
   mp->sw_if_index = ntohl (sw_if_index);
@@ -13761,6 +13759,8 @@ api_lisp_add_del_locator (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_locator api_one_add_del_locator
+
 uword
 unformat_hmac_key_id (unformat_input_t * input, va_list * args)
 {
@@ -13787,10 +13787,10 @@ unformat_hmac_key_id (unformat_input_t * input, va_list * args)
 }
 
 static int
-api_lisp_add_del_local_eid (vat_main_t * vam)
+api_one_add_del_local_eid (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_local_eid_t *mp;
+  vl_api_one_add_del_local_eid_t *mp;
   u8 is_add = 1;
   u8 eid_set = 0;
   lisp_eid_vat_t _eid, *eid = &_eid;
@@ -13863,7 +13863,7 @@ api_lisp_add_del_local_eid (vat_main_t * vam)
   vec_add1 (locator_set_name, 0);
 
   /* Construct the API message */
-  M (LISP_ADD_DEL_LOCAL_EID, mp);
+  M (ONE_ADD_DEL_LOCAL_EID, mp);
 
   mp->is_add = is_add;
   lisp_eid_put_vat (mp->eid, eid->addr, eid->type);
@@ -13886,16 +13886,7 @@ api_lisp_add_del_local_eid (vat_main_t * vam)
   return ret;
 }
 
-/* *INDENT-OFF* */
-/** Used for transferring locators via VPP API */
-typedef CLIB_PACKED(struct
-{
-  u8 is_ip4; /**< is locator an IPv4 address? */
-  u8 priority; /**< locator priority */
-  u8 weight;   /**< locator weight */
-  u8 addr[16]; /**< IPv4/IPv6 address */
-}) rloc_t;
-/* *INDENT-ON* */
+#define api_lisp_add_del_local_eid api_one_add_del_local_eid
 
 static int
 api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
@@ -14037,10 +14028,10 @@ api_lisp_gpe_add_del_fwd_entry (vat_main_t * vam)
 }
 
 static int
-api_lisp_add_del_map_server (vat_main_t * vam)
+api_one_add_del_map_server (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_map_server_t *mp;
+  vl_api_one_add_del_map_server_t *mp;
   u8 is_add = 1;
   u8 ipv4_set = 0;
   u8 ipv6_set = 0;
@@ -14080,7 +14071,7 @@ api_lisp_add_del_map_server (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (LISP_ADD_DEL_MAP_SERVER, mp);
+  M (ONE_ADD_DEL_MAP_SERVER, mp);
 
   mp->is_add = is_add;
   if (ipv6_set)
@@ -14102,11 +14093,13 @@ api_lisp_add_del_map_server (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_map_server api_one_add_del_map_server
+
 static int
-api_lisp_add_del_map_resolver (vat_main_t * vam)
+api_one_add_del_map_resolver (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_map_resolver_t *mp;
+  vl_api_one_add_del_map_resolver_t *mp;
   u8 is_add = 1;
   u8 ipv4_set = 0;
   u8 ipv6_set = 0;
@@ -14146,7 +14139,7 @@ api_lisp_add_del_map_resolver (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (LISP_ADD_DEL_MAP_RESOLVER, mp);
+  M (ONE_ADD_DEL_MAP_RESOLVER, mp);
 
   mp->is_add = is_add;
   if (ipv6_set)
@@ -14168,6 +14161,8 @@ api_lisp_add_del_map_resolver (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_map_resolver api_one_add_del_map_resolver
+
 static int
 api_lisp_gpe_enable_disable (vat_main_t * vam)
 {
@@ -14214,10 +14209,10 @@ api_lisp_gpe_enable_disable (vat_main_t * vam)
 }
 
 static int
-api_lisp_rloc_probe_enable_disable (vat_main_t * vam)
+api_one_rloc_probe_enable_disable (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_rloc_probe_enable_disable_t *mp;
+  vl_api_one_rloc_probe_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
   int ret;
@@ -14243,7 +14238,7 @@ api_lisp_rloc_probe_enable_disable (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (LISP_RLOC_PROBE_ENABLE_DISABLE, mp);
+  M (ONE_RLOC_PROBE_ENABLE_DISABLE, mp);
 
   mp->is_enabled = is_en;
 
@@ -14255,11 +14250,13 @@ api_lisp_rloc_probe_enable_disable (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_rloc_probe_enable_disable api_one_rloc_probe_enable_disable
+
 static int
-api_lisp_map_register_enable_disable (vat_main_t * vam)
+api_one_map_register_enable_disable (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_map_register_enable_disable_t *mp;
+  vl_api_one_map_register_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
   int ret;
@@ -14285,7 +14282,7 @@ api_lisp_map_register_enable_disable (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (LISP_MAP_REGISTER_ENABLE_DISABLE, mp);
+  M (ONE_MAP_REGISTER_ENABLE_DISABLE, mp);
 
   mp->is_enabled = is_en;
 
@@ -14297,11 +14294,13 @@ api_lisp_map_register_enable_disable (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_map_register_enable_disable api_one_map_register_enable_disable
+
 static int
-api_lisp_enable_disable (vat_main_t * vam)
+api_one_enable_disable (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_enable_disable_t *mp;
+  vl_api_one_enable_disable_t *mp;
   u8 is_set = 0;
   u8 is_en = 0;
   int ret;
@@ -14329,7 +14328,7 @@ api_lisp_enable_disable (vat_main_t * vam)
     }
 
   /* Construct the API message */
-  M (LISP_ENABLE_DISABLE, mp);
+  M (ONE_ENABLE_DISABLE, mp);
 
   mp->is_en = is_en;
 
@@ -14341,13 +14340,15 @@ api_lisp_enable_disable (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_enable_disable api_one_enable_disable
+
 static int
-api_show_lisp_map_register_state (vat_main_t * vam)
+api_show_one_map_register_state (vat_main_t * vam)
 {
-  vl_api_show_lisp_map_register_state_t *mp;
+  vl_api_show_one_map_register_state_t *mp;
   int ret;
 
-  M (SHOW_LISP_MAP_REGISTER_STATE, mp);
+  M (SHOW_ONE_MAP_REGISTER_STATE, mp);
 
   /* send */
   S (mp);
@@ -14357,13 +14358,15 @@ api_show_lisp_map_register_state (vat_main_t * vam)
   return ret;
 }
 
+#define api_show_lisp_map_register_state api_show_one_map_register_state
+
 static int
-api_show_lisp_rloc_probe_state (vat_main_t * vam)
+api_show_one_rloc_probe_state (vat_main_t * vam)
 {
-  vl_api_show_lisp_rloc_probe_state_t *mp;
+  vl_api_show_one_rloc_probe_state_t *mp;
   int ret;
 
-  M (SHOW_LISP_RLOC_PROBE_STATE, mp);
+  M (SHOW_ONE_RLOC_PROBE_STATE, mp);
 
   /* send */
   S (mp);
@@ -14373,13 +14376,15 @@ api_show_lisp_rloc_probe_state (vat_main_t * vam)
   return ret;
 }
 
+#define api_show_lisp_rloc_probe_state api_show_one_rloc_probe_state
+
 static int
-api_show_lisp_map_request_mode (vat_main_t * vam)
+api_show_one_map_request_mode (vat_main_t * vam)
 {
-  vl_api_show_lisp_map_request_mode_t *mp;
+  vl_api_show_one_map_request_mode_t *mp;
   int ret;
 
-  M (SHOW_LISP_MAP_REQUEST_MODE, mp);
+  M (SHOW_ONE_MAP_REQUEST_MODE, mp);
 
   /* send */
   S (mp);
@@ -14389,11 +14394,13 @@ api_show_lisp_map_request_mode (vat_main_t * vam)
   return ret;
 }
 
+#define api_show_lisp_map_request_mode api_show_one_map_request_mode
+
 static int
-api_lisp_map_request_mode (vat_main_t * vam)
+api_one_map_request_mode (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_map_request_mode_t *mp;
+  vl_api_one_map_request_mode_t *mp;
   u8 mode = 0;
   int ret;
 
@@ -14411,7 +14418,7 @@ api_lisp_map_request_mode (vat_main_t * vam)
        }
     }
 
-  M (LISP_MAP_REQUEST_MODE, mp);
+  M (ONE_MAP_REQUEST_MODE, mp);
 
   mp->mode = mode;
 
@@ -14423,18 +14430,20 @@ api_lisp_map_request_mode (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_map_request_mode api_one_map_request_mode
+
 /**
- * Enable/disable LISP proxy ITR.
+ * Enable/disable ONE proxy ITR.
  *
  * @param vam vpp API test context
  * @return return code
  */
 static int
-api_lisp_pitr_set_locator_set (vat_main_t * vam)
+api_one_pitr_set_locator_set (vat_main_t * vam)
 {
   u8 ls_name_set = 0;
   unformat_input_t *input = vam->input;
-  vl_api_lisp_pitr_set_locator_set_t *mp;
+  vl_api_one_pitr_set_locator_set_t *mp;
   u8 is_add = 1;
   u8 *ls_name = 0;
   int ret;
@@ -14459,7 +14468,7 @@ api_lisp_pitr_set_locator_set (vat_main_t * vam)
       return -99;
     }
 
-  M (LISP_PITR_SET_LOCATOR_SET, mp);
+  M (ONE_PITR_SET_LOCATOR_SET, mp);
 
   mp->is_add = is_add;
   clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
@@ -14473,10 +14482,12 @@ api_lisp_pitr_set_locator_set (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_pitr_set_locator_set api_one_pitr_set_locator_set
+
 static int
-api_show_lisp_pitr (vat_main_t * vam)
+api_show_one_pitr (vat_main_t * vam)
 {
-  vl_api_show_lisp_pitr_t *mp;
+  vl_api_show_one_pitr_t *mp;
   int ret;
 
   if (!vam->json_output)
@@ -14484,7 +14495,7 @@ api_show_lisp_pitr (vat_main_t * vam)
       print (vam->ofp, "%=20s", "lisp status:");
     }
 
-  M (SHOW_LISP_PITR, mp);
+  M (SHOW_ONE_PITR, mp);
   /* send it... */
   S (mp);
 
@@ -14493,14 +14504,16 @@ api_show_lisp_pitr (vat_main_t * vam)
   return ret;
 }
 
+#define api_show_lisp_pitr api_show_one_pitr
+
 /**
  * Add/delete mapping between vni and vrf
  */
 static int
-api_lisp_eid_table_add_del_map (vat_main_t * vam)
+api_one_eid_table_add_del_map (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_eid_table_add_del_map_t *mp;
+  vl_api_one_eid_table_add_del_map_t *mp;
   u8 is_add = 1, vni_set = 0, vrf_set = 0, bd_index_set = 0;
   u32 vni, vrf, bd_index;
   int ret;
@@ -14532,7 +14545,7 @@ api_lisp_eid_table_add_del_map (vat_main_t * vam)
       return -99;
     }
 
-  M (LISP_EID_TABLE_ADD_DEL_MAP, mp);
+  M (ONE_EID_TABLE_ADD_DEL_MAP, mp);
 
   mp->is_add = is_add;
   mp->vni = htonl (vni);
@@ -14547,6 +14560,8 @@ api_lisp_eid_table_add_del_map (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_eid_table_add_del_map api_one_eid_table_add_del_map
+
 uword
 unformat_negative_mapping_action (unformat_input_t * input, va_list * args)
 {
@@ -14577,16 +14592,16 @@ unformat_negative_mapping_action (unformat_input_t * input, va_list * args)
 }
 
 /**
- * Add/del remote mapping to/from LISP control plane
+ * Add/del remote mapping to/from ONE control plane
  *
  * @param vam vpp API test context
  * @return return code
  */
 static int
-api_lisp_add_del_remote_mapping (vat_main_t * vam)
+api_one_add_del_remote_mapping (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_remote_mapping_t *mp;
+  vl_api_one_add_del_remote_mapping_t *mp;
   u32 vni = 0;
   lisp_eid_vat_t _eid, *eid = &_eid;
   lisp_eid_vat_t _seid, *seid = &_seid;
@@ -14676,7 +14691,7 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
 
   data_len = vec_len (rlocs) * sizeof (vl_api_remote_locator_t);
 
-  M2 (LISP_ADD_DEL_REMOTE_MAPPING, mp, data_len);
+  M2 (ONE_ADD_DEL_REMOTE_MAPPING, mp, data_len);
   mp->is_add = is_add;
   mp->vni = htonl (vni);
   mp->action = (u8) action;
@@ -14700,18 +14715,20 @@ api_lisp_add_del_remote_mapping (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_remote_mapping api_one_add_del_remote_mapping
+
 /**
- * Add/del LISP adjacency. Saves mapping in LISP control plane and updates
+ * Add/del ONE adjacency. Saves mapping in ONE 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)
+api_one_add_del_adjacency (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_adjacency_t *mp;
+  vl_api_one_add_del_adjacency_t *mp;
   u32 vni = 0;
   ip4_address_t leid4, reid4;
   ip6_address_t leid6, reid6;
@@ -14792,7 +14809,7 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
       return -99;
     }
 
-  M (LISP_ADD_DEL_ADJACENCY, mp);
+  M (ONE_ADD_DEL_ADJACENCY, mp);
   mp->is_add = is_add;
   mp->vni = htonl (vni);
   mp->leid_len = leid_len;
@@ -14826,6 +14843,8 @@ api_lisp_add_del_adjacency (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_adjacency api_one_add_del_adjacency
+
 static int
 api_lisp_gpe_add_del_iface (vat_main_t * vam)
 {
@@ -14893,16 +14912,16 @@ api_lisp_gpe_add_del_iface (vat_main_t * vam)
 }
 
 /**
- * Add/del map request itr rlocs from LISP control plane and updates
+ * Add/del map request itr rlocs from ONE control plane and updates
  *
  * @param vam vpp API test context
  * @return return code
  */
 static int
-api_lisp_add_del_map_request_itr_rlocs (vat_main_t * vam)
+api_one_add_del_map_request_itr_rlocs (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_add_del_map_request_itr_rlocs_t *mp;
+  vl_api_one_add_del_map_request_itr_rlocs_t *mp;
   u8 *locator_set_name = 0;
   u8 locator_set_name_set = 0;
   u8 is_add = 1;
@@ -14939,7 +14958,7 @@ api_lisp_add_del_map_request_itr_rlocs (vat_main_t * vam)
       return -99;
     }
 
-  M (LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, mp);
+  M (ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, mp);
   mp->is_add = is_add;
   if (is_add)
     {
@@ -14960,11 +14979,13 @@ api_lisp_add_del_map_request_itr_rlocs (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_add_del_map_request_itr_rlocs api_one_add_del_map_request_itr_rlocs
+
 static int
-api_lisp_locator_dump (vat_main_t * vam)
+api_one_locator_dump (vat_main_t * vam)
 {
   unformat_input_t *input = vam->input;
-  vl_api_lisp_locator_dump_t *mp;
+  vl_api_one_locator_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   u8 is_index_set = 0, is_name_set = 0;
   u8 *ls_name = 0;
@@ -15012,7 +15033,7 @@ api_lisp_locator_dump (vat_main_t * vam)
       print (vam->ofp, "%=16s%=16s%=16s", "locator", "priority", "weight");
     }
 
-  M (LISP_LOCATOR_DUMP, mp);
+  M (ONE_LOCATOR_DUMP, mp);
   mp->is_index_set = is_index_set;
 
   if (is_index_set)
@@ -15036,10 +15057,12 @@ api_lisp_locator_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_locator_dump api_one_locator_dump
+
 static int
-api_lisp_locator_set_dump (vat_main_t * vam)
+api_one_locator_set_dump (vat_main_t * vam)
 {
-  vl_api_lisp_locator_set_dump_t *mp;
+  vl_api_one_locator_set_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   unformat_input_t *input = vam->input;
   u8 filter = 0;
@@ -15068,7 +15091,7 @@ api_lisp_locator_set_dump (vat_main_t * vam)
       print (vam->ofp, "%=10s%=15s", "ls_index", "ls_name");
     }
 
-  M (LISP_LOCATOR_SET_DUMP, mp);
+  M (ONE_LOCATOR_SET_DUMP, mp);
 
   mp->filter = filter;
 
@@ -15084,13 +15107,15 @@ api_lisp_locator_set_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_locator_set_dump api_one_locator_set_dump
+
 static int
-api_lisp_eid_table_map_dump (vat_main_t * vam)
+api_one_eid_table_map_dump (vat_main_t * vam)
 {
   u8 is_l2 = 0;
   u8 mode_set = 0;
   unformat_input_t *input = vam->input;
-  vl_api_lisp_eid_table_map_dump_t *mp;
+  vl_api_one_eid_table_map_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   int ret;
 
@@ -15125,7 +15150,7 @@ api_lisp_eid_table_map_dump (vat_main_t * vam)
       print (vam->ofp, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF");
     }
 
-  M (LISP_EID_TABLE_MAP_DUMP, mp);
+  M (ONE_EID_TABLE_MAP_DUMP, mp);
   mp->is_l2 = is_l2;
 
   /* send it... */
@@ -15140,10 +15165,12 @@ api_lisp_eid_table_map_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_eid_table_map_dump api_one_eid_table_map_dump
+
 static int
-api_lisp_eid_table_vni_dump (vat_main_t * vam)
+api_one_eid_table_vni_dump (vat_main_t * vam)
 {
-  vl_api_lisp_eid_table_vni_dump_t *mp;
+  vl_api_one_eid_table_vni_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   int ret;
 
@@ -15152,7 +15179,7 @@ api_lisp_eid_table_vni_dump (vat_main_t * vam)
       print (vam->ofp, "VNI");
     }
 
-  M (LISP_EID_TABLE_VNI_DUMP, mp);
+  M (ONE_EID_TABLE_VNI_DUMP, mp);
 
   /* send it... */
   S (mp);
@@ -15166,11 +15193,13 @@ api_lisp_eid_table_vni_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_eid_table_vni_dump api_one_eid_table_vni_dump
+
 static int
-api_lisp_eid_table_dump (vat_main_t * vam)
+api_one_eid_table_dump (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_lisp_eid_table_dump_t *mp;
+  vl_api_one_eid_table_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   struct in_addr ip4;
   struct in6_addr ip6;
@@ -15224,7 +15253,7 @@ api_lisp_eid_table_dump (vat_main_t * vam)
             "type", "ls_index", "ttl", "authoritative", "key_id", "key");
     }
 
-  M (LISP_EID_TABLE_DUMP, mp);
+  M (ONE_EID_TABLE_DUMP, mp);
 
   mp->filter = filter;
   if (eid_set)
@@ -15263,6 +15292,8 @@ api_lisp_eid_table_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_eid_table_dump api_one_eid_table_dump
+
 static int
 api_lisp_gpe_fwd_entries_get (vat_main_t * vam)
 {
@@ -15314,10 +15345,10 @@ api_lisp_gpe_fwd_entries_get (vat_main_t * vam)
 #define vl_api_gpe_fwd_entry_path_details_t_print vl_noop_handler
 
 static int
-api_lisp_adjacencies_get (vat_main_t * vam)
+api_one_adjacencies_get (vat_main_t * vam)
 {
   unformat_input_t *i = vam->input;
-  vl_api_lisp_adjacencies_get_t *mp;
+  vl_api_one_adjacencies_get_t *mp;
   u8 vni_set = 0;
   u32 vni = ~0;
   int ret;
@@ -15346,7 +15377,7 @@ api_lisp_adjacencies_get (vat_main_t * vam)
       print (vam->ofp, "%s %40s", "leid", "reid");
     }
 
-  M (LISP_ADJACENCIES_GET, mp);
+  M (ONE_ADJACENCIES_GET, mp);
   mp->vni = clib_host_to_net_u32 (vni);
 
   /* send it... */
@@ -15357,10 +15388,12 @@ api_lisp_adjacencies_get (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_adjacencies_get api_one_adjacencies_get
+
 static int
-api_lisp_map_server_dump (vat_main_t * vam)
+api_one_map_server_dump (vat_main_t * vam)
 {
-  vl_api_lisp_map_server_dump_t *mp;
+  vl_api_one_map_server_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   int ret;
 
@@ -15369,7 +15402,7 @@ api_lisp_map_server_dump (vat_main_t * vam)
       print (vam->ofp, "%=20s", "Map server");
     }
 
-  M (LISP_MAP_SERVER_DUMP, mp);
+  M (ONE_MAP_SERVER_DUMP, mp);
   /* send it... */
   S (mp);
 
@@ -15382,10 +15415,12 @@ api_lisp_map_server_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_map_server_dump api_one_map_server_dump
+
 static int
-api_lisp_map_resolver_dump (vat_main_t * vam)
+api_one_map_resolver_dump (vat_main_t * vam)
 {
-  vl_api_lisp_map_resolver_dump_t *mp;
+  vl_api_one_map_resolver_dump_t *mp;
   vl_api_control_ping_t *mp_ping;
   int ret;
 
@@ -15394,7 +15429,7 @@ api_lisp_map_resolver_dump (vat_main_t * vam)
       print (vam->ofp, "%=20s", "Map resolver");
     }
 
-  M (LISP_MAP_RESOLVER_DUMP, mp);
+  M (ONE_MAP_RESOLVER_DUMP, mp);
   /* send it... */
   S (mp);
 
@@ -15407,18 +15442,20 @@ api_lisp_map_resolver_dump (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_map_resolver_dump api_one_map_resolver_dump
+
 static int
-api_show_lisp_status (vat_main_t * vam)
+api_show_one_status (vat_main_t * vam)
 {
-  vl_api_show_lisp_status_t *mp;
+  vl_api_show_one_status_t *mp;
   int ret;
 
   if (!vam->json_output)
     {
-      print (vam->ofp, "%-20s%-16s", "lisp status", "locator-set");
+      print (vam->ofp, "%-20s%-16s", "ONE status", "locator-set");
     }
 
-  M (SHOW_LISP_STATUS, mp);
+  M (SHOW_ONE_STATUS, mp);
   /* send it... */
   S (mp);
   /* Wait for a reply... */
@@ -15426,6 +15463,8 @@ api_show_lisp_status (vat_main_t * vam)
   return ret;
 }
 
+#define api_show_lisp_status api_show_one_status
+
 static int
 api_lisp_gpe_fwd_entry_path_dump (vat_main_t * vam)
 {
@@ -15468,9 +15507,9 @@ api_lisp_gpe_fwd_entry_path_dump (vat_main_t * vam)
 }
 
 static int
-api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
+api_one_get_map_request_itr_rlocs (vat_main_t * vam)
 {
-  vl_api_lisp_get_map_request_itr_rlocs_t *mp;
+  vl_api_one_get_map_request_itr_rlocs_t *mp;
   int ret;
 
   if (!vam->json_output)
@@ -15478,7 +15517,7 @@ api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
       print (vam->ofp, "%=20s", "itr-rlocs:");
     }
 
-  M (LISP_GET_MAP_REQUEST_ITR_RLOCS, mp);
+  M (ONE_GET_MAP_REQUEST_ITR_RLOCS, mp);
   /* send it... */
   S (mp);
   /* Wait for a reply... */
@@ -15486,6 +15525,8 @@ api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
   return ret;
 }
 
+#define api_lisp_get_map_request_itr_rlocs api_one_get_map_request_itr_rlocs
+
 static int
 api_af_packet_create (vat_main_t * vam)
 {
@@ -18332,7 +18373,48 @@ _(get_node_graph, " ")                                                  \
 _(sw_interface_clear_stats,"<intfc> | sw_if_index <nn>")                \
 _(ioam_enable, "[trace] [pow] [ppc <encap|decap>]")                     \
 _(ioam_disable, "")                                                     \
-_(lisp_add_del_locator_set, "locator-set <locator_name> [iface <intf> |" \
+_(one_add_del_locator_set, "locator-set <locator_name> [iface <intf> |" \
+                            " sw_if_index <sw_if_index> p <priority> "  \
+                            "w <weight>] [del]")                        \
+_(one_add_del_locator, "locator-set <locator_name> "                    \
+                        "iface <intf> | sw_if_index <sw_if_index> "     \
+                        "p <priority> w <weight> [del]")                \
+_(one_add_del_local_eid,"vni <vni> eid "                                \
+                         "<ipv4|ipv6>/<prefix> | <L2 address> "         \
+                         "locator-set <locator_name> [del]"             \
+                         "[key-id sha1|sha256 secret-key <secret-key>]")\
+_(one_add_del_map_resolver, "<ip4|6-addr> [del]")                       \
+_(one_add_del_map_server, "<ip4|6-addr> [del]")                         \
+_(one_enable_disable, "enable|disable")                                 \
+_(one_map_register_enable_disable, "enable|disable")                    \
+_(one_rloc_probe_enable_disable, "enable|disable")                      \
+_(one_add_del_remote_mapping, "add|del vni <vni> eid <dest-eid> "       \
+                               "[seid <seid>] "                         \
+                               "rloc <locator> p <prio> "               \
+                               "w <weight> [rloc <loc> ... ] "          \
+                               "action <action> [del-all]")             \
+_(one_add_del_adjacency, "add|del vni <vni> reid <remote-eid> leid "    \
+                          "<local-eid>")                                \
+_(one_pitr_set_locator_set, "locator-set <loc-set-name> | del")         \
+_(one_map_request_mode, "src-dst|dst-only")                             \
+_(one_add_del_map_request_itr_rlocs, "<loc-set-name> [del]")            \
+_(one_eid_table_add_del_map, "[del] vni <vni> vrf <vrf>")               \
+_(one_locator_set_dump, "[local | remote]")                             \
+_(one_locator_dump, "ls_index <index> | ls_name <name>")                \
+_(one_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] "       \
+                       "[local] | [remote]")                            \
+_(one_eid_table_vni_dump, "")                                           \
+_(one_eid_table_map_dump, "l2|l3")                                      \
+_(one_map_resolver_dump, "")                                            \
+_(one_map_server_dump, "")                                              \
+_(one_adjacencies_get, "vni <vni>")                                     \
+_(show_one_rloc_probe_state, "")                                        \
+_(show_one_map_register_state, "")                                      \
+_(show_one_status, "")                                                  \
+_(one_get_map_request_itr_rlocs, "")                                    \
+_(show_one_pitr, "")                                                    \
+_(show_one_map_request_mode, "")                                        \
+_(lisp_add_del_locator_set, "locator-set <locator_name> [iface <intf> |"\
                             " sw_if_index <sw_if_index> p <priority> "  \
                             "w <weight>] [del]")                        \
 _(lisp_add_del_locator, "locator-set <locator_name> "                   \
index a8cc696..70f1e7e 100644 (file)
@@ -578,7 +578,9 @@ libvnet_la_SOURCES +=                               \
  vnet/lisp-cp/gid_dictionary.c                 \
  vnet/lisp-cp/lisp_msg_serdes.c                        \
  vnet/lisp-cp/packets.c                                \
+ vnet/lisp-cp/one_cli.c                                \
  vnet/lisp-cp/lisp_cli.c                       \
+ vnet/lisp-cp/one_api.c                                \
  vnet/lisp-cp/lisp_api.c
 
 nobase_include_HEADERS +=                      \
@@ -588,9 +590,11 @@ nobase_include_HEADERS +=                  \
  vnet/lisp-cp/lisp_cp_messages.h               \
  vnet/lisp-cp/lisp_msg_serdes.h                        \
  vnet/lisp-cp/control.h                                \
+ vnet/lisp-cp/one.api.h                                \
  vnet/lisp-cp/lisp.api.h
 
 API_FILES += vnet/lisp-cp/lisp.api
+API_FILES += vnet/lisp-cp/one.api
 
 if ENABLE_TESTS
 LDS = \
index b2b31f0..6a8b4cc 100644 (file)
 #define vl_api_lisp_add_del_remote_mapping_t_endian vl_noop_handler
 #define vl_api_lisp_add_del_remote_mapping_t_print vl_noop_handler
 
+#define vl_api_one_add_del_locator_set_t_endian vl_noop_handler
+#define vl_api_one_add_del_locator_set_t_print vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler
+
 #define vl_typedefs            /* define message structures */
 #include <vnet/vnet_all_api_h.h>
 #undef vl_typedefs
@@ -1273,7 +1278,7 @@ static void
 setup_message_id_table (api_main_t * am)
 {
 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
-  foreach_vl_msg_name_crc_lisp;
+  foreach_vl_msg_name_crc_one;
 #undef _
 }
 
index a2088dd..25d11c6 100644 (file)
@@ -1515,10 +1515,8 @@ VLIB_CLI_COMMAND (lisp_show_petr_command) = {
     .short_help = "Show petr",
     .function = lisp_show_petr_command_fn,
 };
-
 /* *INDENT-ON* */
 
-/* *INDENT-ON* */
 /*
  * fd.io coding-style-patch-verification: ON
  *
diff --git a/src/vnet/lisp-cp/one.api b/src/vnet/lisp-cp/one.api
new file mode 100644 (file)
index 0000000..38937a3
--- /dev/null
@@ -0,0 +1,864 @@
+/*
+ * Copyright (c) 2015-2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** \brief add or delete locator_set
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param locator_set_name - locator name
+    @param locator_num - number of locators
+    @param locators - locator records
+*/
+manual_endian manual_print define one_add_del_locator_set
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 locator_set_name[64];
+  u32 locator_num;
+  vl_api_local_locator_t locators[locator_num];
+};
+
+/** \brief Reply for locator_set add/del
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+    @param ls_index - locator set index
+*/
+define one_add_del_locator_set_reply
+{
+  u32 context;
+  i32 retval;
+  u32 ls_index;
+};
+
+/** \brief add or delete locator for locator set
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param locator_set_name - name of locator_set to add/del locator
+    @param sw_if_index - index of the interface
+    @param priority - priority of the locator
+    @param weight - weight of the locator
+*/
+define one_add_del_locator
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 locator_set_name[64];
+  u32 sw_if_index;
+  u8 priority;
+  u8 weight;
+};
+
+/** \brief Reply for locator add/del
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_locator_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief add or delete ONE eid-table
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param eid_type:
+      0 : ipv4
+      1 : ipv6
+      2 : mac
+    @param eid - EID can be ip4, ip6 or mac
+    @param prefix_len - prefix len
+    @param locator_set_name - name of locator_set to add/del eid-table
+    @param vni - virtual network instance
+    @param key_id
+      HMAC_NO_KEY           0
+      HMAC_SHA_1_96         1
+      HMAC_SHA_256_128      2
+    @param key - secret key
+*/
+define one_add_del_local_eid
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 eid_type;
+  u8 eid[16];
+  u8 prefix_len;
+  u8 locator_set_name[64];
+  u32 vni;
+  u16 key_id;
+  u8 key[64];
+};
+
+/** \brief Reply for local_eid add/del
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_local_eid_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief Add/delete map server
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero; delete otherwise
+    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+    @param ip_address - map server IP address
+*/
+define one_add_del_map_server
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 is_ipv6;
+  u8 ip_address[16];
+};
+
+/** \brief Reply for one_add_del_map_server
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_map_server_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief add or delete map-resolver
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+    @param ip_address - array of address bytes
+*/
+define one_add_del_map_resolver
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 is_ipv6;
+  u8 ip_address[16];
+};
+
+/** \brief Reply for map_resolver add/del
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_map_resolver_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief enable or disable ONE feature
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_en - enable protocol if non-zero, else disable
+*/
+define one_enable_disable
+{
+  u32 client_index;
+  u32 context;
+  u8 is_en;
+};
+
+/** \brief Reply for gpe enable/disable
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_enable_disable_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief configure or disable ONE PITR node
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param ls_name - locator set name
+    @param is_add - add locator set if non-zero, else disable pitr
+*/
+define one_pitr_set_locator_set
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 ls_name[64];
+};
+
+/** \brief Reply for one_pitr_set_locator_set
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_pitr_set_locator_set_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief configure or disable use of PETR
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_ip4 - Address is IPv4 if set and IPv6 otherwise
+    @param address - PETR IP address
+    @param is_add - add locator set if non-zero, else disable pitr
+*/
+define one_use_petr
+{
+  u32 client_index;
+  u32 context;
+  u8 is_ip4;
+  u8 address[16];
+  u8 is_add;
+};
+
+/** \brief Reply for one_pitr_set_locator_set
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_use_petr_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief Request for ONE PETR status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_use_petr
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief ONE PETR status, enable or disable
+    @param context - sender context, to match reply w/ request
+    @param status - ONE PETR enable if non-zero, else disable
+    @param is_ip4 - Address is IPv4 if non-zero, else IPv6
+    @param address - PETR IP address
+*/
+define show_one_use_petr_reply
+{
+  u32 context;
+  i32 retval;
+  u8 status;
+  u8 is_ip4;
+  u8 address[16];
+};
+
+/** \brief Get state of ONE RLOC probing
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_rloc_probe_state
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Reply for show_one_rloc_probe_state
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+    @param is_enabled - state of RLOC probing
+*/
+define show_one_rloc_probe_state_reply
+{
+  u32 context;
+  i32 retval;
+  u8 is_enabled;
+};
+
+/** \brief enable/disable ONE RLOC probing
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_enable - enable if non-zero; disable otherwise
+*/
+define one_rloc_probe_enable_disable
+{
+  u32 client_index;
+  u32 context;
+  u8 is_enabled;
+};
+
+/** \brief Reply for one_rloc_probe_enable_disable
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_rloc_probe_enable_disable_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief enable/disable ONE map-register
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_enable - enable if non-zero; disable otherwise
+*/
+define one_map_register_enable_disable
+{
+  u32 client_index;
+  u32 context;
+  u8 is_enabled;
+};
+
+/** \brief Reply for one_map_register_enable_disable
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_map_register_enable_disable_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief Get state of ONE map-register
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_map_register_state
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Reply for show_one_map_register_state
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define show_one_map_register_state_reply
+{
+  u32 context;
+  i32 retval;
+  u8 is_enabled;
+};
+
+/** \brief set ONE map-request mode. Based on configuration VPP will send
+      src/dest or just normal destination map requests.
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param mode - new map-request mode. Supported values are:
+      0 - destination only
+      1 - source/destaination
+*/
+define one_map_request_mode
+{
+  u32 client_index;
+  u32 context;
+  u8 mode;
+};
+
+/** \brief Reply for one_map_request_mode
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_map_request_mode_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief Request for ONE map-request mode
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_map_request_mode
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Reply for show_one_map_request_mode
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+    @param mode - map-request mode
+*/
+define show_one_map_request_mode_reply
+{
+  u32 context;
+  i32 retval;
+  u8 mode;
+};
+
+/** \brief add or delete remote static mapping
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param is_src_dst - flag indicating src/dst based routing policy
+    @param del_all - if set, delete all remote mappings
+    @param vni - virtual network instance
+    @param action - negative map-reply action
+    @param eid_type -
+      0 : ipv4
+      1 : ipv6
+      2 : mac
+    @param deid - dst EID
+    @param seid - src EID, valid only if is_src_dst is enabled
+    @param rloc_num - number of remote locators
+    @param rlocs - remote locator records
+*/
+manual_print manual_endian define one_add_del_remote_mapping
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 is_src_dst;
+  u8 del_all;
+  u32 vni;
+  u8 action;
+  u8 eid_type;
+  u8 eid[16];
+  u8 eid_len;
+  u8 seid[16];
+  u8 seid_len;
+  u32 rloc_num;
+  vl_api_remote_locator_t rlocs[rloc_num];
+};
+
+/** \brief Reply for one_add_del_remote_mapping
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_remote_mapping_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief add or delete ONE adjacency adjacency
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param vni - virtual network instance
+    @param eid_type -
+      0 : ipv4
+      1 : ipv6
+      2 : mac
+    @param reid - remote EID
+    @param leid - local EID
+*/
+define one_add_del_adjacency
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u32 vni;
+  u8 eid_type;
+  u8 reid[16];
+  u8 leid[16];
+  u8 reid_len;
+  u8 leid_len;
+};
+
+/** \brief Reply for one_add_del_adjacency
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_add_del_adjacency_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief add or delete map request itr rlocs
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add address if non-zero, else delete
+    @param locator_set_name - locator set name
+*/
+define one_add_del_map_request_itr_rlocs
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u8 locator_set_name[64];
+};
+
+/** \brief Reply for one_add_del_map_request_itr_rlocs
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+
+define one_add_del_map_request_itr_rlocs_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief map/unmap vni/bd_index to vrf
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_add - add or delete mapping
+    @param dp_table - virtual network id/bridge domain index
+    @param vrf - vrf
+*/
+define one_eid_table_add_del_map
+{
+  u32 client_index;
+  u32 context;
+  u8 is_add;
+  u32 vni;
+  u32 dp_table;
+  u8 is_l2;
+};
+
+/** \brief Reply for one_eid_table_add_del_map
+    @param context - returned sender context, to match reply w/ request
+    @param retval - return code
+*/
+define one_eid_table_add_del_map_reply
+{
+  u32 context;
+  i32 retval;
+};
+
+/** \brief Request for map one locator status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param locator_set_index - index of locator_set
+    @param ls_name - locator set name
+    @param is_index_set - flag indicating whether ls_name or ls_index is set
+ */
+define one_locator_dump
+{
+  u32 client_index;
+  u32 context;
+  u32 ls_index;
+  u8 ls_name[64];
+  u8 is_index_set;
+};
+
+/** \brief ONE locator_set status
+    @param local - if is set, then locator is local
+    @param locator_set_name - name of the locator_set
+    @param sw_if_index - sw_if_index of the locator
+    @param priority - locator priority
+    @param weight - locator weight
+  */
+define one_locator_details
+{
+  u32 context;
+  u8 local;
+  u32 sw_if_index;
+  u8 is_ipv6;
+  u8 ip_address[16];
+  u8 priority;
+  u8 weight;
+};
+
+/** \brief ONE locator_set status
+    @param context - sender context, to match reply w/ request
+    @param ls_index - locator set index
+    @param ls_name - name of the locator set
+ */
+define one_locator_set_details
+{
+  u32 context;
+  u32 ls_index;
+  u8 ls_name[64];
+};
+
+/** \brief Request for locator_set summary status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param filter - filter type
+      Supported values:
+        0: all locator sets
+        1: local locator sets
+        2: remote locator sets
+ */
+define one_locator_set_dump
+{
+  u32 client_index;
+  u32 context;
+  u8 filter;
+};
+
+/** \brief Dump ONE eid-table
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param locator_set_index - index of locator_set, if ~0 then the mapping
+                                is negative
+    @param action - negative map request action
+    @param is_local - local if non-zero, else remote
+    @param eid_type:
+      0 : ipv4
+      1 : ipv6
+      2 : mac
+    @param is_src_dst - EID is type of source/destination
+    @param eid - EID can be ip4, ip6 or mac
+    @param eid_prefix_len - prefix length
+    @param seid - source EID can be ip4, ip6 or mac
+    @param seid_prefix_len - source prefix length
+    @param vni - virtual network instance
+    @param ttl - time to live
+    @param authoritative - authoritative
+    @param key_id
+      HMAC_NO_KEY           0
+      HMAC_SHA_1_96         1
+      HMAC_SHA_256_128      2
+    @param key - secret key
+*/
+
+define one_eid_table_details
+{
+  u32 context;
+  u32 locator_set_index;
+  u8 action;
+  u8 is_local;
+  u8 eid_type;
+  u8 is_src_dst;
+  u32 vni;
+  u8 eid[16];
+  u8 eid_prefix_len;
+  u8 seid[16];
+  u8 seid_prefix_len;
+  u32 ttl;
+  u8 authoritative;
+  u16 key_id;
+  u8 key[64];
+};
+
+/** \brief Request for eid table summary status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param eid_set - if non-zero request info about specific mapping
+    @param vni - virtual network instance; valid only if eid_set != 0
+    @param prefix_length - prefix length if EID is IP address;
+      valid only if eid_set != 0
+    @param eid_type - EID type; valid only if eid_set != 0
+      Supported values:
+        0: EID is IPv4
+        1: EID is IPv6
+        2: EID is ethernet address
+    @param eid - endpoint identifier
+    @param filter - filter type;
+      Support values:
+        0: all eid
+        1: local eid
+        2: remote eid
+ */
+define one_eid_table_dump
+{
+  u32 client_index;
+  u32 context;
+  u8 eid_set;
+  u8 prefix_length;
+  u32 vni;
+  u8 eid_type;
+  u8 eid[16];
+  u8 filter;
+};
+
+/** \brief ONE adjacency
+    @param eid_type -
+      0 : ipv4
+      1 : ipv6
+      2 : mac
+    @param reid - remote EID
+    @param leid - local EID
+    @param reid_prefix_len - remote EID IP prefix length
+    @param leid_prefix_len - local EID IP prefix length
+  */
+typeonly manual_print manual_endian define one_adjacency
+{
+  u8 eid_type;
+  u8 reid[16];
+  u8 leid[16];
+  u8 reid_prefix_len;
+  u8 leid_prefix_len;
+};
+
+/** \brief ONE adjacency reply
+    @param count - number of adjacencies
+    @param adjacencies - array of adjacencies
+  */
+manual_endian manual_print define one_adjacencies_get_reply
+{
+  u32 context;
+  i32 retval;
+  u32 count;
+  vl_api_one_adjacency_t adjacencies[count];
+};
+
+/** \brief Request for ONE adjacencies
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param vni - filter adjacencies by VNI
+ */
+define one_adjacencies_get
+{
+  u32 client_index;
+  u32 context;
+  u32 vni;
+};
+
+/** \brief Shows relationship between vni and vrf/bd
+    @param dp_table - VRF index or bridge domain index
+    @param vni - vitual network instance
+  */
+define one_eid_table_map_details
+{
+  u32 context;
+  u32 vni;
+  u32 dp_table;
+};
+
+/** \brief Request for one_eid_table_map_details
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param is_l2 - if set dump vni/bd mappings else vni/vrf
+ */
+define one_eid_table_map_dump
+{
+  u32 client_index;
+  u32 context;
+  u8 is_l2;
+};
+
+/** \brief Dumps all VNIs used in mappings
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+  */
+define one_eid_table_vni_dump
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief reply to one_eid_table_vni_dump
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+    @param vni - virtual network instance
+ */
+define one_eid_table_vni_details
+{
+  u32 client_index;
+  u32 context;
+  u32 vni;
+};
+
+/** \brief ONE map resolver status
+    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+    @param ip_address - array of address bytes
+ */
+define one_map_resolver_details
+{
+  u32 context;
+  u8 is_ipv6;
+  u8 ip_address[16];
+};
+
+/** \brief Request for map resolver summary status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+ */
+define one_map_resolver_dump
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief ONE map server details
+    @param is_ipv6 - if non-zero the address is ipv6, else ipv4
+    @param ip_address - array of address bytes
+ */
+define one_map_server_details
+{
+  u32 context;
+  u8 is_ipv6;
+  u8 ip_address[16];
+};
+
+/** \brief Request for map server summary status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+ */
+define one_map_server_dump
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Request for ONE status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_status
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief ONE status
+    @param context - sender context, to match reply w/ request
+    @param feature_status - enabled if non-zero, else disabled
+    @param gpe_status - enabled if non-zero, else disabled
+*/
+define show_one_status_reply
+{
+  u32 context;
+  i32 retval;
+  u8 feature_status;
+  u8 gpe_status;
+};
+
+/** \brief Get ONE map request itr rlocs status
+    @param context - sender context, to match reply w/ request
+    @param locator_set_name - name of the locator_set
+ */
+define one_get_map_request_itr_rlocs
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Request for map request itr rlocs summary status
+ */
+define one_get_map_request_itr_rlocs_reply
+{
+  u32 context;
+  i32 retval;
+  u8 locator_set_name[64];
+};
+
+/** \brief Request for ONE PITR status
+    @param client_index - opaque cookie to identify the sender
+    @param context - sender context, to match reply w/ request
+*/
+define show_one_pitr
+{
+  u32 client_index;
+  u32 context;
+};
+
+/** \brief Status of ONE PITR, enable or disable
+    @param context - sender context, to match reply w/ request
+    @param status - ONE PITR enable if non-zero, else disable
+    @param locator_set_name -  name of the locator_set
+*/
+define show_one_pitr_reply
+{
+  u32 context;
+  i32 retval;
+  u8 status;
+  u8 locator_set_name[64];
+};
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
new file mode 100644 (file)
index 0000000..8fdf082
--- /dev/null
@@ -0,0 +1,1309 @@
+/*
+ *------------------------------------------------------------------
+ * one_api.c - Overlay Network Engine API
+ *
+ * Copyright (c) 2016-2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *------------------------------------------------------------------
+ */
+
+#include <vnet/vnet.h>
+#include <vlibmemory/api.h>
+
+#include <vnet/interface.h>
+#include <vnet/api_errno.h>
+#include <vnet/lisp-cp/control.h>
+#include <vnet/lisp-gpe/lisp_gpe.h>
+
+#include <vnet/vnet_msg_enum.h>
+
+#define vl_api_remote_locator_t_endian vl_noop_handler
+#define vl_api_remote_locator_t_print vl_noop_handler
+#define vl_api_local_locator_t_endian vl_noop_handler
+#define vl_api_local_locator_t_print vl_noop_handler
+
+#define vl_api_one_add_del_locator_set_t_endian vl_noop_handler
+#define vl_api_one_add_del_locator_set_t_print vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler
+
+#define vl_api_one_add_del_locator_set_t_endian vl_noop_handler
+#define vl_api_one_add_del_locator_set_t_print vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
+#define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler
+
+#define vl_typedefs            /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_typedefs
+
+#define vl_endianfun           /* define message structures */
+#include <vnet/vnet_all_api_h.h>
+#undef vl_endianfun
+
+/* instantiate all the print functions we know about */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define vl_printfun
+#include <vnet/vnet_all_api_h.h>
+#undef vl_printfun
+
+#include <vlibapi/api_helper_macros.h>
+
+#define foreach_vpe_api_msg                             \
+_(ONE_ADD_DEL_LOCATOR_SET, one_add_del_locator_set)                     \
+_(ONE_ADD_DEL_LOCATOR, one_add_del_locator)                             \
+_(ONE_ADD_DEL_LOCAL_EID, one_add_del_local_eid)                         \
+_(ONE_ADD_DEL_MAP_RESOLVER, one_add_del_map_resolver)                   \
+_(ONE_ADD_DEL_MAP_SERVER, one_add_del_map_server)                       \
+_(ONE_ENABLE_DISABLE, one_enable_disable)                               \
+_(ONE_RLOC_PROBE_ENABLE_DISABLE, one_rloc_probe_enable_disable)         \
+_(ONE_MAP_REGISTER_ENABLE_DISABLE, one_map_register_enable_disable)     \
+_(ONE_ADD_DEL_REMOTE_MAPPING, one_add_del_remote_mapping)               \
+_(ONE_ADD_DEL_ADJACENCY, one_add_del_adjacency)                         \
+_(ONE_PITR_SET_LOCATOR_SET, one_pitr_set_locator_set)                   \
+_(ONE_MAP_REQUEST_MODE, one_map_request_mode)                           \
+_(ONE_EID_TABLE_ADD_DEL_MAP, one_eid_table_add_del_map)                 \
+_(ONE_LOCATOR_SET_DUMP, one_locator_set_dump)                           \
+_(ONE_LOCATOR_DUMP, one_locator_dump)                                   \
+_(ONE_EID_TABLE_DUMP, one_eid_table_dump)                               \
+_(ONE_MAP_RESOLVER_DUMP, one_map_resolver_dump)                         \
+_(ONE_MAP_SERVER_DUMP, one_map_server_dump)                             \
+_(ONE_EID_TABLE_MAP_DUMP, one_eid_table_map_dump)                       \
+_(ONE_EID_TABLE_VNI_DUMP, one_eid_table_vni_dump)                       \
+_(ONE_ADJACENCIES_GET, one_adjacencies_get)                             \
+_(SHOW_ONE_RLOC_PROBE_STATE, show_one_rloc_probe_state)                 \
+_(SHOW_ONE_MAP_REGISTER_STATE, show_one_map_register_state)             \
+_(SHOW_ONE_STATUS, show_one_status)                                     \
+_(ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS,                                    \
+  one_add_del_map_request_itr_rlocs)                                    \
+_(ONE_GET_MAP_REQUEST_ITR_RLOCS, one_get_map_request_itr_rlocs)         \
+_(SHOW_ONE_PITR, show_one_pitr)                                         \
+_(SHOW_ONE_MAP_REQUEST_MODE, show_one_map_request_mode)                 \
+_(ONE_USE_PETR, one_use_petr)                                           \
+_(SHOW_ONE_USE_PETR, show_one_use_petr)                                 \
+
+static locator_t *
+unformat_one_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num)
+{
+  u32 i;
+  locator_t *locs = 0, loc;
+  vl_api_remote_locator_t *r;
+
+  for (i = 0; i < rloc_num; i++)
+    {
+      /* remote locators */
+      r = &rmt_locs[i];
+      memset (&loc, 0, sizeof (loc));
+      gid_address_ip_set (&loc.address, &r->addr, r->is_ip4 ? IP4 : IP6);
+
+      loc.priority = r->priority;
+      loc.weight = r->weight;
+
+      vec_add1 (locs, loc);
+    }
+  return locs;
+}
+
+static void
+vl_api_one_add_del_locator_set_t_handler (vl_api_one_add_del_locator_set_t *
+                                         mp)
+{
+  vl_api_one_add_del_locator_set_reply_t *rmp;
+  int rv = 0;
+  vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+  locator_t locator;
+  vl_api_local_locator_t *ls_loc;
+  u32 ls_index = ~0, locator_num;
+  u8 *locator_name = NULL;
+  int i;
+
+  memset (a, 0, sizeof (a[0]));
+
+  locator_name = format (0, "%s", mp->locator_set_name);
+
+  a->name = locator_name;
+  a->is_add = mp->is_add;
+  a->local = 1;
+  locator_num = clib_net_to_host_u32 (mp->locator_num);
+
+  memset (&locator, 0, sizeof (locator));
+  for (i = 0; i < locator_num; i++)
+    {
+      ls_loc = &mp->locators[i];
+      VALIDATE_SW_IF_INDEX (ls_loc);
+
+      locator.sw_if_index = htonl (ls_loc->sw_if_index);
+      locator.priority = ls_loc->priority;
+      locator.weight = ls_loc->weight;
+      locator.local = 1;
+      vec_add1 (a->locators, locator);
+    }
+
+  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
+
+  BAD_SW_IF_INDEX_LABEL;
+
+  vec_free (locator_name);
+  vec_free (a->locators);
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2 (VL_API_ONE_ADD_DEL_LOCATOR_SET_REPLY,
+  ({
+    rmp->ls_index = clib_host_to_net_u32 (ls_index);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+vl_api_one_add_del_locator_t_handler (vl_api_one_add_del_locator_t * mp)
+{
+  vl_api_one_add_del_locator_reply_t *rmp;
+  int rv = 0;
+  locator_t locator, *locators = NULL;
+  vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+  u32 ls_index = ~0;
+  u8 *locator_name = NULL;
+
+  memset (&locator, 0, sizeof (locator));
+  memset (a, 0, sizeof (a[0]));
+
+  locator.sw_if_index = ntohl (mp->sw_if_index);
+  locator.priority = mp->priority;
+  locator.weight = mp->weight;
+  locator.local = 1;
+  vec_add1 (locators, locator);
+
+  locator_name = format (0, "%s", mp->locator_set_name);
+
+  a->name = locator_name;
+  a->locators = locators;
+  a->is_add = mp->is_add;
+  a->local = 1;
+
+  rv = vnet_lisp_add_del_locator (a, NULL, &ls_index);
+
+  vec_free (locators);
+  vec_free (locator_name);
+
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCATOR_REPLY);
+}
+
+static int
+unformat_one_eid_api (gid_address_t * dst, u32 vni, u8 type, void *src,
+                     u8 len)
+{
+  switch (type)
+    {
+    case 0:                    /* ipv4 */
+      gid_address_type (dst) = GID_ADDR_IP_PREFIX;
+      gid_address_ip_set (dst, src, IP4);
+      gid_address_ippref_len (dst) = len;
+      ip_prefix_normalize (&gid_address_ippref (dst));
+      break;
+    case 1:                    /* ipv6 */
+      gid_address_type (dst) = GID_ADDR_IP_PREFIX;
+      gid_address_ip_set (dst, src, IP6);
+      gid_address_ippref_len (dst) = len;
+      ip_prefix_normalize (&gid_address_ippref (dst));
+      break;
+    case 2:                    /* l2 mac */
+      gid_address_type (dst) = GID_ADDR_MAC;
+      clib_memcpy (&gid_address_mac (dst), src, 6);
+      break;
+    default:
+      /* unknown type */
+      return VNET_API_ERROR_INVALID_VALUE;
+    }
+
+  gid_address_vni (dst) = vni;
+
+  return 0;
+}
+
+static void
+vl_api_one_add_del_local_eid_t_handler (vl_api_one_add_del_local_eid_t * mp)
+{
+  vl_api_one_add_del_local_eid_reply_t *rmp;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  int rv = 0;
+  gid_address_t _eid, *eid = &_eid;
+  uword *p = NULL;
+  u32 locator_set_index = ~0, map_index = ~0;
+  vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
+  u8 *name = NULL, *key = NULL;
+  memset (a, 0, sizeof (a[0]));
+  memset (eid, 0, sizeof (eid[0]));
+
+  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+                            mp->eid_type, mp->eid, mp->prefix_len);
+  if (rv)
+    goto out;
+
+  name = format (0, "%s", mp->locator_set_name);
+  p = hash_get_mem (lcm->locator_set_index_by_name, name);
+  if (!p)
+    {
+      rv = VNET_API_ERROR_INVALID_VALUE;
+      goto out;
+    }
+  locator_set_index = p[0];
+
+  if (*mp->key)
+    key = format (0, "%s", mp->key);
+
+  /* XXX treat batch configuration */
+  a->is_add = mp->is_add;
+  gid_address_copy (&a->eid, eid);
+  a->locator_set_index = locator_set_index;
+  a->local = 1;
+  a->key = key;
+  a->key_id = clib_net_to_host_u16 (mp->key_id);
+
+  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
+
+out:
+  vec_free (name);
+  vec_free (key);
+  gid_address_free (&a->eid);
+
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_LOCAL_EID_REPLY);
+}
+
+static void
+  vl_api_one_eid_table_add_del_map_t_handler
+  (vl_api_one_eid_table_add_del_map_t * mp)
+{
+  vl_api_one_eid_table_add_del_map_reply_t *rmp;
+  int rv = 0;
+  rv = vnet_lisp_eid_table_map (clib_net_to_host_u32 (mp->vni),
+                               clib_net_to_host_u32 (mp->dp_table),
+                               mp->is_l2, mp->is_add);
+REPLY_MACRO (VL_API_ONE_EID_TABLE_ADD_DEL_MAP_REPLY)}
+
+static void
+vl_api_one_add_del_map_server_t_handler (vl_api_one_add_del_map_server_t * mp)
+{
+  vl_api_one_add_del_map_server_reply_t *rmp;
+  int rv = 0;
+  ip_address_t addr;
+
+  memset (&addr, 0, sizeof (addr));
+
+  ip_address_set (&addr, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+  rv = vnet_lisp_add_del_map_server (&addr, mp->is_add);
+
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_SERVER_REPLY);
+}
+
+static void
+vl_api_one_add_del_map_resolver_t_handler (vl_api_one_add_del_map_resolver_t
+                                          * mp)
+{
+  vl_api_one_add_del_map_resolver_reply_t *rmp;
+  int rv = 0;
+  vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
+
+  memset (a, 0, sizeof (a[0]));
+
+  a->is_add = mp->is_add;
+  ip_address_set (&a->address, mp->ip_address, mp->is_ipv6 ? IP6 : IP4);
+
+  rv = vnet_lisp_add_del_map_resolver (a);
+
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_RESOLVER_REPLY);
+}
+
+static void
+  vl_api_one_map_register_enable_disable_t_handler
+  (vl_api_one_map_register_enable_disable_t * mp)
+{
+  vl_api_one_map_register_enable_disable_reply_t *rmp;
+  int rv = 0;
+
+  vnet_lisp_map_register_enable_disable (mp->is_enabled);
+  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
+}
+
+static void
+  vl_api_one_rloc_probe_enable_disable_t_handler
+  (vl_api_one_rloc_probe_enable_disable_t * mp)
+{
+  vl_api_one_rloc_probe_enable_disable_reply_t *rmp;
+  int rv = 0;
+
+  vnet_lisp_rloc_probe_enable_disable (mp->is_enabled);
+  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
+}
+
+static void
+vl_api_one_enable_disable_t_handler (vl_api_one_enable_disable_t * mp)
+{
+  vl_api_one_enable_disable_reply_t *rmp;
+  int rv = 0;
+
+  vnet_lisp_enable_disable (mp->is_en);
+  REPLY_MACRO (VL_API_ONE_ENABLE_DISABLE_REPLY);
+}
+
+static void
+  vl_api_show_one_map_request_mode_t_handler
+  (vl_api_show_one_map_request_mode_t * mp)
+{
+  int rv = 0;
+  vl_api_show_one_map_request_mode_reply_t *rmp;
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2(VL_API_SHOW_ONE_MAP_REQUEST_MODE_REPLY,
+  ({
+    rmp->mode = vnet_lisp_get_map_request_mode ();
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+vl_api_one_map_request_mode_t_handler (vl_api_one_map_request_mode_t * mp)
+{
+  vl_api_one_map_request_mode_reply_t *rmp;
+  int rv = 0;
+
+  rv = vnet_lisp_set_map_request_mode (mp->mode);
+
+  REPLY_MACRO (VL_API_ONE_MAP_REQUEST_MODE_REPLY);
+}
+
+static void
+vl_api_one_pitr_set_locator_set_t_handler (vl_api_one_pitr_set_locator_set_t
+                                          * mp)
+{
+  vl_api_one_pitr_set_locator_set_reply_t *rmp;
+  int rv = 0;
+  u8 *ls_name = 0;
+
+  ls_name = format (0, "%s", mp->ls_name);
+  rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
+  vec_free (ls_name);
+
+  REPLY_MACRO (VL_API_ONE_PITR_SET_LOCATOR_SET_REPLY);
+}
+
+static void
+vl_api_one_use_petr_t_handler (vl_api_one_use_petr_t * mp)
+{
+  vl_api_one_use_petr_reply_t *rmp;
+  int rv = 0;
+  ip_address_t addr;
+
+  ip_address_set (&addr, &mp->address, mp->is_ip4 ? IP4 : IP6);
+  rv = vnet_lisp_use_petr (&addr, mp->is_add);
+
+  REPLY_MACRO (VL_API_ONE_USE_PETR_REPLY);
+}
+
+static void
+vl_api_show_one_use_petr_t_handler (vl_api_show_one_use_petr_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  vl_api_show_one_use_petr_reply_t *rmp = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *m;
+  locator_set_t *ls = 0;
+  int rv = 0;
+  locator_t *loc = 0;
+  u8 status = 0;
+  gid_address_t addr;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  memset (&addr, 0, sizeof (addr));
+  status = lcm->flags & LISP_FLAG_USE_PETR;
+  if (status)
+    {
+      m = pool_elt_at_index (lcm->mapping_pool, lcm->petr_map_index);
+      if (~0 != m->locator_set_index)
+       {
+         ls =
+           pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
+         loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
+         gid_address_copy (&addr, &loc->address);
+       }
+    }
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2 (VL_API_SHOW_ONE_USE_PETR_REPLY,
+  {
+      rmp->status = status;
+      gid_address_put (rmp->address, &addr);
+      rmp->is_ip4 = (gid_address_ip_version (&addr) == IP4);
+  });
+  /* *INDENT-ON* */
+}
+
+static void
+  vl_api_one_add_del_map_request_itr_rlocs_t_handler
+  (vl_api_one_add_del_map_request_itr_rlocs_t * mp)
+{
+  vl_api_one_add_del_map_request_itr_rlocs_reply_t *rmp;
+  int rv = 0;
+  u8 *locator_set_name = NULL;
+  vnet_lisp_add_del_mreq_itr_rloc_args_t _a, *a = &_a;
+
+  locator_set_name = format (0, "%s", mp->locator_set_name);
+
+  a->is_add = mp->is_add;
+  a->locator_set_name = locator_set_name;
+
+  rv = vnet_lisp_add_del_mreq_itr_rlocs (a);
+
+  vec_free (locator_set_name);
+
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS_REPLY);
+}
+
+static void
+  vl_api_one_add_del_remote_mapping_t_handler
+  (vl_api_one_add_del_remote_mapping_t * mp)
+{
+  locator_t *rlocs = 0;
+  vl_api_one_add_del_remote_mapping_reply_t *rmp;
+  int rv = 0;
+  gid_address_t _eid, *eid = &_eid;
+  u32 rloc_num = clib_net_to_host_u32 (mp->rloc_num);
+
+  memset (eid, 0, sizeof (eid[0]));
+
+  rv = unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+                            mp->eid_type, mp->eid, mp->eid_len);
+  if (rv)
+    goto send_reply;
+
+  rlocs = unformat_one_locs (mp->rlocs, rloc_num);
+
+  if (!mp->is_add)
+    {
+      vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+      gid_address_copy (&a->reid, eid);
+      a->is_add = 0;
+      rv = vnet_lisp_add_del_adjacency (a);
+      if (rv)
+       {
+         goto out;
+       }
+    }
+
+  /* NOTE: for now this works as a static remote mapping, i.e.,
+   * not authoritative and ttl infinite. */
+  rv = vnet_lisp_add_del_mapping (eid, rlocs, mp->action, 0, ~0,
+                                 mp->is_add, 1 /* is_static */ , 0);
+
+  if (mp->del_all)
+    vnet_lisp_clear_all_remote_adjacencies ();
+
+out:
+  vec_free (rlocs);
+send_reply:
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_REMOTE_MAPPING_REPLY);
+}
+
+static void
+vl_api_one_add_del_adjacency_t_handler (vl_api_one_add_del_adjacency_t * mp)
+{
+  vl_api_one_add_del_adjacency_reply_t *rmp;
+  vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+
+  int rv = 0;
+  memset (a, 0, sizeof (a[0]));
+
+  rv = unformat_one_eid_api (&a->leid, clib_net_to_host_u32 (mp->vni),
+                            mp->eid_type, mp->leid, mp->leid_len);
+  rv |= unformat_one_eid_api (&a->reid, clib_net_to_host_u32 (mp->vni),
+                             mp->eid_type, mp->reid, mp->reid_len);
+
+  if (rv)
+    goto send_reply;
+
+  a->is_add = mp->is_add;
+  rv = vnet_lisp_add_del_adjacency (a);
+
+send_reply:
+  REPLY_MACRO (VL_API_ONE_ADD_DEL_ADJACENCY_REPLY);
+}
+
+static void
+send_one_locator_details (lisp_cp_main_t * lcm,
+                         locator_t * loc,
+                         unix_shared_memory_queue_t * q, u32 context)
+{
+  vl_api_one_locator_details_t *rmp;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_DETAILS);
+  rmp->context = context;
+
+  rmp->local = loc->local;
+  if (loc->local)
+    {
+      rmp->sw_if_index = ntohl (loc->sw_if_index);
+    }
+  else
+    {
+      rmp->is_ipv6 = gid_address_ip_version (&loc->address);
+      ip_address_copy_addr (rmp->ip_address, &gid_address_ip (&loc->address));
+    }
+  rmp->priority = loc->priority;
+  rmp->weight = loc->weight;
+
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_locator_dump_t_handler (vl_api_one_locator_dump_t * mp)
+{
+  u8 *ls_name = 0;
+  unix_shared_memory_queue_t *q = 0;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  locator_set_t *lsit = 0;
+  locator_t *loc = 0;
+  u32 ls_index = ~0, *locit = 0;
+  uword *p = 0;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  if (mp->is_index_set)
+    ls_index = htonl (mp->ls_index);
+  else
+    {
+      /* make sure we get a proper C-string */
+      mp->ls_name[sizeof (mp->ls_name) - 1] = 0;
+      ls_name = format (0, "%s", mp->ls_name);
+      p = hash_get_mem (lcm->locator_set_index_by_name, ls_name);
+      if (!p)
+       goto out;
+      ls_index = p[0];
+    }
+
+  if (pool_is_free_index (lcm->locator_set_pool, ls_index))
+    return;
+
+  lsit = pool_elt_at_index (lcm->locator_set_pool, ls_index);
+
+  vec_foreach (locit, lsit->locator_indices)
+  {
+    loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
+    send_one_locator_details (lcm, loc, q, mp->context);
+  };
+out:
+  vec_free (ls_name);
+}
+
+static void
+send_one_locator_set_details (lisp_cp_main_t * lcm,
+                             locator_set_t * lsit,
+                             unix_shared_memory_queue_t * q,
+                             u32 context, u32 ls_index)
+{
+  vl_api_one_locator_set_details_t *rmp;
+  u8 *str = 0;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_LOCATOR_SET_DETAILS);
+  rmp->context = context;
+
+  rmp->ls_index = htonl (ls_index);
+  if (lsit->local)
+    {
+      ASSERT (lsit->name != NULL);
+      strncpy ((char *) rmp->ls_name, (char *) lsit->name,
+              vec_len (lsit->name));
+    }
+  else
+    {
+      str = format (0, "<remote-%d>", ls_index);
+      strncpy ((char *) rmp->ls_name, (char *) str, vec_len (str));
+      vec_free (str);
+    }
+
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_locator_set_dump_t_handler (vl_api_one_locator_set_dump_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  locator_set_t *lsit = NULL;
+  u8 filter;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  filter = mp->filter;
+  /* *INDENT-OFF* */
+  pool_foreach (lsit, lcm->locator_set_pool,
+  ({
+    if (filter && !((1 == filter && lsit->local) ||
+                    (2 == filter && !lsit->local)))
+      {
+        continue;
+      }
+    send_one_locator_set_details (lcm, lsit, q, mp->context,
+                                   lsit - lcm->locator_set_pool);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+one_fid_put_api (u8 * dst, fid_address_t * src, u8 * prefix_length)
+{
+  ASSERT (prefix_length);
+  ip_prefix_t *ippref = &fid_addr_ippref (src);
+
+  switch (fid_addr_type (src))
+    {
+    case FID_ADDR_IP_PREF:
+      if (ip_prefix_version (ippref) == IP4)
+       clib_memcpy (dst, &ip_prefix_v4 (ippref), 4);
+      else
+       clib_memcpy (dst, &ip_prefix_v6 (ippref), 16);
+      prefix_length[0] = ip_prefix_len (ippref);
+      break;
+
+    case FID_ADDR_MAC:
+      prefix_length[0] = 0;
+      clib_memcpy (dst, fid_addr_mac (src), 6);
+      break;
+
+    default:
+      clib_warning ("Unknown FID type %d!", fid_addr_type (src));
+      break;
+    }
+}
+
+static u8
+fid_type_to_api_type (fid_address_t * fid)
+{
+  ip_prefix_t *ippref;
+
+  switch (fid_addr_type (fid))
+    {
+    case FID_ADDR_IP_PREF:
+      ippref = &fid_addr_ippref (fid);
+      if (ip_prefix_version (ippref) == IP4)
+       return 0;
+      else if (ip_prefix_version (ippref) == IP6)
+       return 1;
+      else
+       return ~0;
+
+    case FID_ADDR_MAC:
+      return 2;
+    case FID_ADDR_NSH:
+      return 3;
+    }
+
+  return ~0;
+}
+
+static void
+send_one_eid_table_details (mapping_t * mapit,
+                           unix_shared_memory_queue_t * q,
+                           u32 context, u8 filter)
+{
+  fid_address_t *fid;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  locator_set_t *ls = 0;
+  vl_api_one_eid_table_details_t *rmp = NULL;
+  gid_address_t *gid = NULL;
+  u8 *mac = 0;
+  ip_prefix_t *ip_prefix = NULL;
+
+  switch (filter)
+    {
+    case 0:                    /* all mappings */
+      break;
+
+    case 1:                    /* local only */
+      if (!mapit->local)
+       return;
+      break;
+    case 2:                    /* remote only */
+      if (mapit->local)
+       return;
+      break;
+    default:
+      clib_warning ("Filter error, unknown filter: %d", filter);
+      return;
+    }
+
+  gid = &mapit->eid;
+  ip_prefix = &gid_address_ippref (gid);
+  mac = gid_address_mac (gid);
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_DETAILS);
+
+  ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
+  if (vec_len (ls->locator_indices) == 0)
+    rmp->locator_set_index = ~0;
+  else
+    rmp->locator_set_index = clib_host_to_net_u32 (mapit->locator_set_index);
+
+  rmp->is_local = mapit->local;
+  rmp->ttl = clib_host_to_net_u32 (mapit->ttl);
+  rmp->action = mapit->action;
+  rmp->authoritative = mapit->authoritative;
+
+  switch (gid_address_type (gid))
+    {
+    case GID_ADDR_SRC_DST:
+      rmp->is_src_dst = 1;
+      fid = &gid_address_sd_src (gid);
+      rmp->eid_type = fid_type_to_api_type (fid);
+      one_fid_put_api (rmp->seid, &gid_address_sd_src (gid),
+                      &rmp->seid_prefix_len);
+      one_fid_put_api (rmp->eid, &gid_address_sd_dst (gid),
+                      &rmp->eid_prefix_len);
+      break;
+    case GID_ADDR_IP_PREFIX:
+      rmp->eid_prefix_len = ip_prefix_len (ip_prefix);
+      if (ip_prefix_version (ip_prefix) == IP4)
+       {
+         rmp->eid_type = 0;    /* ipv4 type */
+         clib_memcpy (rmp->eid, &ip_prefix_v4 (ip_prefix),
+                      sizeof (ip_prefix_v4 (ip_prefix)));
+       }
+      else
+       {
+         rmp->eid_type = 1;    /* ipv6 type */
+         clib_memcpy (rmp->eid, &ip_prefix_v6 (ip_prefix),
+                      sizeof (ip_prefix_v6 (ip_prefix)));
+       }
+      break;
+    case GID_ADDR_MAC:
+      rmp->eid_type = 2;       /* l2 mac type */
+      clib_memcpy (rmp->eid, mac, 6);
+      break;
+    default:
+      ASSERT (0);
+    }
+  rmp->context = context;
+  rmp->vni = clib_host_to_net_u32 (gid_address_vni (gid));
+  rmp->key_id = clib_host_to_net_u16 (mapit->key_id);
+  memcpy (rmp->key, mapit->key, vec_len (mapit->key));
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_eid_table_dump_t_handler (vl_api_one_eid_table_dump_t * mp)
+{
+  u32 mi;
+  unix_shared_memory_queue_t *q = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *mapit = NULL;
+  gid_address_t _eid, *eid = &_eid;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  if (mp->eid_set)
+    {
+      memset (eid, 0, sizeof (*eid));
+
+      unformat_one_eid_api (eid, clib_net_to_host_u32 (mp->vni),
+                           mp->eid_type, mp->eid, mp->prefix_length);
+
+      mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, eid);
+      if ((u32) ~ 0 == mi)
+       return;
+
+      mapit = pool_elt_at_index (lcm->mapping_pool, mi);
+      send_one_eid_table_details (mapit, q, mp->context,
+                                 0 /* ignore filter */ );
+    }
+  else
+    {
+      /* *INDENT-OFF* */
+      pool_foreach (mapit, lcm->mapping_pool,
+      ({
+        send_one_eid_table_details(mapit, q, mp->context,
+                                    mp->filter);
+      }));
+      /* *INDENT-ON* */
+    }
+}
+
+static void
+send_one_map_server_details (ip_address_t * ip,
+                            unix_shared_memory_queue_t * q, u32 context)
+{
+  vl_api_one_map_server_details_t *rmp = NULL;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_SERVER_DETAILS);
+
+  switch (ip_addr_version (ip))
+    {
+    case IP4:
+      rmp->is_ipv6 = 0;
+      clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
+                  sizeof (ip_addr_v4 (ip)));
+      break;
+
+    case IP6:
+      rmp->is_ipv6 = 1;
+      clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
+                  sizeof (ip_addr_v6 (ip)));
+      break;
+
+    default:
+      ASSERT (0);
+    }
+  rmp->context = context;
+
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_map_server_dump_t_handler (vl_api_one_map_server_dump_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  lisp_msmr_t *mr;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  vec_foreach (mr, lcm->map_servers)
+  {
+    send_one_map_server_details (&mr->address, q, mp->context);
+  }
+}
+
+static void
+send_one_map_resolver_details (ip_address_t * ip,
+                              unix_shared_memory_queue_t * q, u32 context)
+{
+  vl_api_one_map_resolver_details_t *rmp = NULL;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_MAP_RESOLVER_DETAILS);
+
+  switch (ip_addr_version (ip))
+    {
+    case IP4:
+      rmp->is_ipv6 = 0;
+      clib_memcpy (rmp->ip_address, &ip_addr_v4 (ip),
+                  sizeof (ip_addr_v4 (ip)));
+      break;
+
+    case IP6:
+      rmp->is_ipv6 = 1;
+      clib_memcpy (rmp->ip_address, &ip_addr_v6 (ip),
+                  sizeof (ip_addr_v6 (ip)));
+      break;
+
+    default:
+      ASSERT (0);
+    }
+  rmp->context = context;
+
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_map_resolver_dump_t_handler (vl_api_one_map_resolver_dump_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  lisp_msmr_t *mr;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  vec_foreach (mr, lcm->map_resolvers)
+  {
+    send_one_map_resolver_details (&mr->address, q, mp->context);
+  }
+}
+
+static void
+send_eid_table_map_pair (hash_pair_t * p,
+                        unix_shared_memory_queue_t * q, u32 context)
+{
+  vl_api_one_eid_table_map_details_t *rmp = NULL;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_MAP_DETAILS);
+
+  rmp->vni = clib_host_to_net_u32 (p->key);
+  rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
+  rmp->context = context;
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+vl_api_one_eid_table_map_dump_t_handler (vl_api_one_eid_table_map_dump_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  hash_pair_t *p;
+  uword *vni_table = 0;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  if (mp->is_l2)
+    {
+      vni_table = lcm->bd_id_by_vni;
+    }
+  else
+    {
+      vni_table = lcm->table_id_by_vni;
+    }
+
+  /* *INDENT-OFF* */
+  hash_foreach_pair (p, vni_table,
+  ({
+    send_eid_table_map_pair (p, q, mp->context);
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+send_eid_table_vni (u32 vni, unix_shared_memory_queue_t * q, u32 context)
+{
+  vl_api_one_eid_table_vni_details_t *rmp = 0;
+
+  rmp = vl_msg_api_alloc (sizeof (*rmp));
+  memset (rmp, 0, sizeof (*rmp));
+  rmp->_vl_msg_id = ntohs (VL_API_ONE_EID_TABLE_VNI_DETAILS);
+  rmp->context = context;
+  rmp->vni = clib_host_to_net_u32 (vni);
+  vl_msg_api_send_shmem (q, (u8 *) & rmp);
+}
+
+static void
+one_adjacency_copy (vl_api_one_adjacency_t * dst, lisp_adjacency_t * adjs)
+{
+  lisp_adjacency_t *adj;
+  vl_api_one_adjacency_t a;
+  u32 i, n = vec_len (adjs);
+
+  for (i = 0; i < n; i++)
+    {
+      adj = vec_elt_at_index (adjs, i);
+      memset (&a, 0, sizeof (a));
+
+      switch (gid_address_type (&adj->reid))
+       {
+       case GID_ADDR_IP_PREFIX:
+         a.reid_prefix_len = gid_address_ippref_len (&adj->reid);
+         a.leid_prefix_len = gid_address_ippref_len (&adj->leid);
+         if (gid_address_ip_version (&adj->reid) == IP4)
+           {
+             a.eid_type = 0;   /* ipv4 type */
+             clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 4);
+             clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 4);
+           }
+         else
+           {
+             a.eid_type = 1;   /* ipv6 type */
+             clib_memcpy (a.reid, &gid_address_ip (&adj->reid), 16);
+             clib_memcpy (a.leid, &gid_address_ip (&adj->leid), 16);
+           }
+         break;
+       case GID_ADDR_MAC:
+         a.eid_type = 2;       /* l2 mac type */
+         mac_copy (a.reid, gid_address_mac (&adj->reid));
+         mac_copy (a.leid, gid_address_mac (&adj->leid));
+         break;
+       default:
+         ASSERT (0);
+       }
+      dst[i] = a;
+    }
+}
+
+static void
+  vl_api_show_one_rloc_probe_state_t_handler
+  (vl_api_show_one_rloc_probe_state_t * mp)
+{
+  vl_api_show_one_rloc_probe_state_reply_t *rmp = 0;
+  int rv = 0;
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2 (VL_API_SHOW_ONE_RLOC_PROBE_STATE_REPLY,
+  {
+    rmp->is_enabled = vnet_lisp_rloc_probe_state_get ();
+  });
+  /* *INDENT-ON* */
+}
+
+static void
+  vl_api_show_one_map_register_state_t_handler
+  (vl_api_show_one_map_register_state_t * mp)
+{
+  vl_api_show_one_map_register_state_reply_t *rmp = 0;
+  int rv = 0;
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2 (VL_API_SHOW_ONE_MAP_REGISTER_STATE_REPLY,
+  {
+    rmp->is_enabled = vnet_lisp_map_register_state_get ();
+  });
+  /* *INDENT-ON* */
+}
+
+static void
+vl_api_one_adjacencies_get_t_handler (vl_api_one_adjacencies_get_t * mp)
+{
+  vl_api_one_adjacencies_get_reply_t *rmp = 0;
+  lisp_adjacency_t *adjs = 0;
+  int rv = 0;
+  u32 size = ~0;
+  u32 vni = clib_net_to_host_u32 (mp->vni);
+
+  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
+  size = vec_len (adjs) * sizeof (vl_api_one_adjacency_t);
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO4 (VL_API_ONE_ADJACENCIES_GET_REPLY, size,
+  {
+    rmp->count = clib_host_to_net_u32 (vec_len (adjs));
+    one_adjacency_copy (rmp->adjacencies, adjs);
+  });
+  /* *INDENT-ON* */
+
+  vec_free (adjs);
+}
+
+static void
+vl_api_one_eid_table_vni_dump_t_handler (vl_api_one_eid_table_vni_dump_t * mp)
+{
+  hash_pair_t *p;
+  u32 *vnis = 0;
+  unix_shared_memory_queue_t *q = 0;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  hash_foreach_pair (p, lcm->table_id_by_vni,
+  ({
+    hash_set (vnis, p->key, 0);
+  }));
+
+  hash_foreach_pair (p, lcm->bd_id_by_vni,
+  ({
+    hash_set (vnis, p->key, 0);
+  }));
+
+  hash_foreach_pair (p, vnis,
+  ({
+    send_eid_table_vni (p->key, q, mp->context);
+  }));
+  /* *INDENT-ON* */
+
+  hash_free (vnis);
+}
+
+static void
+vl_api_show_one_status_t_handler (vl_api_show_one_status_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  vl_api_show_one_status_reply_t *rmp = NULL;
+  int rv = 0;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2(VL_API_SHOW_ONE_STATUS_REPLY,
+  ({
+    rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
+    rmp->feature_status = vnet_lisp_enable_disable_status ();
+  }));
+  /* *INDENT-ON* */
+}
+
+static void
+  vl_api_one_get_map_request_itr_rlocs_t_handler
+  (vl_api_one_get_map_request_itr_rlocs_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  vl_api_one_get_map_request_itr_rlocs_reply_t *rmp = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  locator_set_t *loc_set = 0;
+  u8 *tmp_str = 0;
+  int rv = 0;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  if (~0 == lcm->mreq_itr_rlocs)
+    {
+      tmp_str = format (0, " ");
+    }
+  else
+    {
+      loc_set =
+       pool_elt_at_index (lcm->locator_set_pool, lcm->mreq_itr_rlocs);
+      tmp_str = format (0, "%s", loc_set->name);
+    }
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2(VL_API_ONE_GET_MAP_REQUEST_ITR_RLOCS_REPLY,
+  ({
+    strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
+            ARRAY_LEN(rmp->locator_set_name) - 1);
+  }));
+  /* *INDENT-ON* */
+
+  vec_free (tmp_str);
+}
+
+static void
+vl_api_show_one_pitr_t_handler (vl_api_show_one_pitr_t * mp)
+{
+  unix_shared_memory_queue_t *q = NULL;
+  vl_api_show_one_pitr_reply_t *rmp = NULL;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *m;
+  locator_set_t *ls = 0;
+  u8 *tmp_str = 0;
+  int rv = 0;
+
+  q = vl_api_client_index_to_input_queue (mp->client_index);
+  if (q == 0)
+    {
+      return;
+    }
+
+  if (!lcm->lisp_pitr)
+    {
+      tmp_str = format (0, "N/A");
+    }
+  else
+    {
+      m = pool_elt_at_index (lcm->mapping_pool, lcm->pitr_map_index);
+      if (~0 != m->locator_set_index)
+       {
+         ls =
+           pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
+         tmp_str = format (0, "%s", ls->name);
+       }
+      else
+       {
+         tmp_str = format (0, "N/A");
+       }
+    }
+  vec_add1 (tmp_str, 0);
+
+  /* *INDENT-OFF* */
+  REPLY_MACRO2(VL_API_SHOW_ONE_PITR_REPLY,
+  ({
+    rmp->status = lcm->lisp_pitr;
+    strncpy((char *) rmp->locator_set_name, (char *) tmp_str,
+            ARRAY_LEN(rmp->locator_set_name) - 1);
+  }));
+  /* *INDENT-ON* */
+}
+
+/*
+ * one_api_hookup
+ * Add vpe's API message handlers to the table.
+ * vlib has alread mapped shared memory and
+ * added the client registration handlers.
+ * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process()
+ */
+#define vl_msg_name_crc_list
+#include <vnet/vnet_all_api_h.h>
+#undef vl_msg_name_crc_list
+
+static void
+setup_message_id_table (api_main_t * am)
+{
+#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id);
+  foreach_vl_msg_name_crc_lisp;
+#undef _
+}
+
+static clib_error_t *
+one_api_hookup (vlib_main_t * vm)
+{
+  api_main_t *am = &api_main;
+
+#define _(N,n)                                                  \
+    vl_msg_api_set_handlers(VL_API_##N, #n,                     \
+                           vl_api_##n##_t_handler,              \
+                           vl_noop_handler,                     \
+                           vl_api_##n##_t_endian,               \
+                           vl_api_##n##_t_print,                \
+                           sizeof(vl_api_##n##_t), 1);
+  foreach_vpe_api_msg;
+#undef _
+
+  /*
+   * Set up the (msg_name, crc, message-id) table
+   */
+  setup_message_id_table (am);
+
+  return 0;
+}
+
+VLIB_API_INIT_FUNCTION (one_api_hookup);
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/vnet/lisp-cp/one_cli.c
new file mode 100644 (file)
index 0000000..0701070
--- /dev/null
@@ -0,0 +1,1593 @@
+/*
+ * Copyright (c) 2017 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vnet/lisp-cp/control.h>
+#include <vnet/lisp-gpe/lisp_gpe.h>
+
+static clib_error_t *
+lisp_show_adjacencies_command_fn (vlib_main_t * vm,
+                                 unformat_input_t * input,
+                                 vlib_cli_command_t * cmd)
+{
+  lisp_adjacency_t *adjs, *adj;
+  vlib_cli_output (vm, "%s %40s\n", "leid", "reid");
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u32 vni = ~0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "vni %d", &vni))
+       ;
+      else
+       {
+         vlib_cli_output (vm, "parse error: '%U'",
+                          format_unformat_error, line_input);
+         return 0;
+       }
+    }
+
+  if (~0 == vni)
+    {
+      vlib_cli_output (vm, "error: no vni specified!");
+      return 0;
+    }
+
+  adjs = vnet_lisp_adjacencies_get_by_vni (vni);
+
+  vec_foreach (adj, adjs)
+  {
+    vlib_cli_output (vm, "%U %40U\n", format_gid_address, &adj->leid,
+                    format_gid_address, &adj->reid);
+  }
+  vec_free (adjs);
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_adjacencies_command) = {
+    .path = "show one adjacencies",
+    .short_help = "show one adjacencies",
+    .function = lisp_show_adjacencies_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_add_del_map_server_command_fn (vlib_main_t * vm,
+                                   unformat_input_t * input,
+                                   vlib_cli_command_t * cmd)
+{
+  int rv = 0;
+  u8 is_add = 1, ip_set = 0;
+  ip_address_t ip;
+  unformat_input_t _line_input, *line_input = &_line_input;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "add"))
+       is_add = 1;
+      else if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "%U", unformat_ip_address, &ip))
+       ip_set = 1;
+      else
+       {
+         vlib_cli_output (vm, "parse error: '%U'",
+                          format_unformat_error, line_input);
+         return 0;
+       }
+    }
+
+  if (!ip_set)
+    {
+      vlib_cli_output (vm, "map-server ip address not set!");
+      return 0;
+    }
+
+  rv = vnet_lisp_add_del_map_server (&ip, is_add);
+  if (!rv)
+    vlib_cli_output (vm, "failed to %s map-server!",
+                    is_add ? "add" : "delete");
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_map_server_command) = {
+    .path = "one map-server",
+    .short_help = "one map-server add|del <ip>",
+    .function = lisp_add_del_map_server_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_add_del_local_eid_command_fn (vlib_main_t * vm, unformat_input_t * input,
+                                  vlib_cli_command_t * cmd)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1;
+  gid_address_t eid;
+  gid_address_t *eids = 0;
+  clib_error_t *error = 0;
+  u8 *locator_set_name = 0;
+  u32 locator_set_index = 0, map_index = 0;
+  uword *p;
+  vnet_lisp_add_del_mapping_args_t _a, *a = &_a;
+  int rv = 0;
+  u32 vni = 0;
+  u8 *key = 0;
+  u32 key_id = 0;
+
+  memset (&eid, 0, sizeof (eid));
+  memset (a, 0, sizeof (*a));
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "add"))
+       is_add = 1;
+      else if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "eid %U", unformat_gid_address, &eid))
+       ;
+      else if (unformat (line_input, "vni %d", &vni))
+       gid_address_vni (&eid) = vni;
+      else if (unformat (line_input, "secret-key %_%v%_", &key))
+       ;
+      else if (unformat (line_input, "key-id %U", unformat_hmac_key_id,
+                        &key_id))
+       ;
+      else if (unformat (line_input, "locator-set %_%v%_", &locator_set_name))
+       {
+         p = hash_get_mem (lcm->locator_set_index_by_name, locator_set_name);
+         if (!p)
+           {
+             error = clib_error_return (0, "locator-set %s doesn't exist",
+                                        locator_set_name);
+             goto done;
+           }
+         locator_set_index = p[0];
+       }
+      else
+       {
+         error = unformat_parse_error (line_input);
+         goto done;
+       }
+    }
+  /* XXX treat batch configuration */
+
+  if (GID_ADDR_SRC_DST == gid_address_type (&eid))
+    {
+      error =
+       clib_error_return (0, "src/dst is not supported for local EIDs!");
+      goto done;
+    }
+
+  if (key && (0 == key_id))
+    {
+      vlib_cli_output (vm, "invalid key_id!");
+      return 0;
+    }
+
+  gid_address_copy (&a->eid, &eid);
+  a->is_add = is_add;
+  a->locator_set_index = locator_set_index;
+  a->local = 1;
+  a->key = key;
+  a->key_id = key_id;
+
+  rv = vnet_lisp_add_del_local_mapping (a, &map_index);
+  if (0 != rv)
+    {
+      error = clib_error_return (0, "failed to %s local mapping!",
+                                is_add ? "add" : "delete");
+    }
+done:
+  vec_free (eids);
+  if (locator_set_name)
+    vec_free (locator_set_name);
+  gid_address_free (&a->eid);
+  vec_free (a->key);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_local_eid_command) = {
+    .path = "one eid-table",
+    .short_help = "one eid-table add/del [vni <vni>] eid <eid> "
+      "locator-set <locator-set> [key <secret-key> key-id sha1|sha256 ]",
+    .function = lisp_add_del_local_eid_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_eid_table_map_command_fn (vlib_main_t * vm,
+                              unformat_input_t * input,
+                              vlib_cli_command_t * cmd)
+{
+  u8 is_add = 1, is_l2 = 0;
+  u32 vni = 0, dp_id = 0;
+  unformat_input_t _line_input, *line_input = &_line_input;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "vni %d", &vni))
+       ;
+      else if (unformat (line_input, "vrf %d", &dp_id))
+       ;
+      else if (unformat (line_input, "bd %d", &dp_id))
+       is_l2 = 1;
+      else
+       {
+         return unformat_parse_error (line_input);
+       }
+    }
+  vnet_lisp_eid_table_map (vni, dp_id, is_l2, is_add);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_eid_table_map_command) = {
+    .path = "one eid-table map",
+    .short_help = "one eid-table map [del] vni <vni> vrf <vrf> | bd <bdi>",
+    .function = lisp_eid_table_map_command_fn,
+};
+/* *INDENT-ON* */
+
+/**
+ * Handler for add/del remote mapping CLI.
+ *
+ * @param vm vlib context
+ * @param input input from user
+ * @param cmd cmd
+ * @return pointer to clib error structure
+ */
+static clib_error_t *
+lisp_add_del_remote_mapping_command_fn (vlib_main_t * vm,
+                                       unformat_input_t * input,
+                                       vlib_cli_command_t * cmd)
+{
+  clib_error_t *error = 0;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1, del_all = 0;
+  locator_t rloc, *rlocs = 0, *curr_rloc = 0;
+  gid_address_t eid;
+  u8 eid_set = 0;
+  u32 vni, action = ~0, p, w;
+  int rv;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  memset (&eid, 0, sizeof (eid));
+  memset (&rloc, 0, sizeof (rloc));
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "del-all"))
+       del_all = 1;
+      else if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "add"))
+       ;
+      else if (unformat (line_input, "eid %U", unformat_gid_address, &eid))
+       eid_set = 1;
+      else if (unformat (line_input, "vni %u", &vni))
+       {
+         gid_address_vni (&eid) = vni;
+       }
+      else if (unformat (line_input, "p %d w %d", &p, &w))
+       {
+         if (!curr_rloc)
+           {
+             clib_warning
+               ("No RLOC configured for setting priority/weight!");
+             goto done;
+           }
+         curr_rloc->priority = p;
+         curr_rloc->weight = w;
+       }
+      else if (unformat (line_input, "rloc %U", unformat_ip_address,
+                        &gid_address_ip (&rloc.address)))
+       {
+         /* since rloc is stored in ip prefix we need to set prefix length */
+         ip_prefix_t *pref = &gid_address_ippref (&rloc.address);
+
+         u8 version = gid_address_ip_version (&rloc.address);
+         ip_prefix_len (pref) = ip_address_max_len (version);
+
+         vec_add1 (rlocs, rloc);
+         curr_rloc = &rlocs[vec_len (rlocs) - 1];
+       }
+      else if (unformat (line_input, "action %U",
+                        unformat_negative_mapping_action, &action))
+       ;
+      else
+       {
+         clib_warning ("parse error");
+         goto done;
+       }
+    }
+
+  if (!eid_set)
+    {
+      clib_warning ("missing eid!");
+      goto done;
+    }
+
+  if (!del_all)
+    {
+      if (is_add && (~0 == action) && 0 == vec_len (rlocs))
+       {
+         clib_warning ("no action set for negative map-reply!");
+         goto done;
+       }
+    }
+  else
+    {
+      vnet_lisp_clear_all_remote_adjacencies ();
+      goto done;
+    }
+
+  /* TODO build src/dst with seid */
+
+  /* if it's a delete, clean forwarding */
+  if (!is_add)
+    {
+      vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+      memset (a, 0, sizeof (a[0]));
+      gid_address_copy (&a->reid, &eid);
+      if (vnet_lisp_add_del_adjacency (a))
+       {
+         clib_warning ("failed to delete adjacency!");
+         goto done;
+       }
+    }
+
+  /* add as static remote mapping, i.e., not authoritative and infinite
+   * ttl */
+  rv = vnet_lisp_add_del_mapping (&eid, rlocs, action, 0, ~0, is_add,
+                                 1 /* is_static */ , 0);
+
+  if (rv)
+    clib_warning ("failed to %s remote mapping!", is_add ? "add" : "delete");
+
+done:
+  vec_free (rlocs);
+  unformat_free (line_input);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_remote_mapping_command) = {
+  .path = "one remote-mapping",
+  .short_help =
+    "one remote-mapping add|del [del-all] vni <vni> "
+    "eid <est-eid> [action <no-action|natively-forward|"
+    "send-map-request|drop>] rloc <dst-locator> p <prio> w <weight> "
+    "[rloc <dst-locator> ... ]",
+  .function = lisp_add_del_remote_mapping_command_fn,
+};
+/* *INDENT-ON* */
+
+/**
+ * Handler for add/del adjacency CLI.
+ */
+static clib_error_t *
+lisp_add_del_adjacency_command_fn (vlib_main_t * vm, unformat_input_t * input,
+                                  vlib_cli_command_t * cmd)
+{
+  clib_error_t *error = 0;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  vnet_lisp_add_del_adjacency_args_t _a, *a = &_a;
+  u8 is_add = 1;
+  ip_prefix_t *reid_ippref, *leid_ippref;
+  gid_address_t leid, reid;
+  u8 *dmac = gid_address_mac (&reid);
+  u8 *smac = gid_address_mac (&leid);
+  u8 reid_set = 0, leid_set = 0;
+  u32 vni;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  memset (&reid, 0, sizeof (reid));
+  memset (&leid, 0, sizeof (leid));
+
+  leid_ippref = &gid_address_ippref (&leid);
+  reid_ippref = &gid_address_ippref (&reid);
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "add"))
+       ;
+      else if (unformat (line_input, "reid %U",
+                        unformat_ip_prefix, reid_ippref))
+       {
+         gid_address_type (&reid) = GID_ADDR_IP_PREFIX;
+         reid_set = 1;
+       }
+      else if (unformat (line_input, "reid %U", unformat_mac_address, dmac))
+       {
+         gid_address_type (&reid) = GID_ADDR_MAC;
+         reid_set = 1;
+       }
+      else if (unformat (line_input, "vni %u", &vni))
+       {
+         gid_address_vni (&leid) = vni;
+         gid_address_vni (&reid) = vni;
+       }
+      else if (unformat (line_input, "leid %U",
+                        unformat_ip_prefix, leid_ippref))
+       {
+         gid_address_type (&leid) = GID_ADDR_IP_PREFIX;
+         leid_set = 1;
+       }
+      else if (unformat (line_input, "leid %U", unformat_mac_address, smac))
+       {
+         gid_address_type (&leid) = GID_ADDR_MAC;
+         leid_set = 1;
+       }
+      else
+       {
+         clib_warning ("parse error");
+         goto done;
+       }
+    }
+
+  if (!reid_set || !leid_set)
+    {
+      clib_warning ("missing remote or local eid!");
+      goto done;
+    }
+
+  if ((gid_address_type (&leid) != gid_address_type (&reid))
+      || (gid_address_type (&reid) == GID_ADDR_IP_PREFIX
+         && ip_prefix_version (reid_ippref)
+         != ip_prefix_version (leid_ippref)))
+    {
+      clib_warning ("remote and local EIDs are of different types!");
+      return error;
+    }
+
+  memset (a, 0, sizeof (a[0]));
+  gid_address_copy (&a->leid, &leid);
+  gid_address_copy (&a->reid, &reid);
+  a->is_add = is_add;
+
+  if (vnet_lisp_add_del_adjacency (a))
+    clib_warning ("failed to %s adjacency!", is_add ? "add" : "delete");
+
+done:
+  unformat_free (line_input);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_adjacency_command) = {
+    .path = "one adjacency",
+    .short_help = "one adjacency add|del vni <vni> reid <remote-eid> "
+      "leid <local-eid>",
+    .function = lisp_add_del_adjacency_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_map_request_mode_command_fn (vlib_main_t * vm,
+                                 unformat_input_t * input,
+                                 vlib_cli_command_t * cmd)
+{
+  unformat_input_t _i, *i = &_i;
+  map_request_mode_t mr_mode = _MR_MODE_MAX;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, i))
+    return 0;
+
+  while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (i, "dst-only"))
+       mr_mode = MR_MODE_DST_ONLY;
+      else if (unformat (i, "src-dst"))
+       mr_mode = MR_MODE_SRC_DST;
+      else
+       {
+         clib_warning ("parse error '%U'", format_unformat_error, i);
+         goto done;
+       }
+    }
+
+  if (_MR_MODE_MAX == mr_mode)
+    {
+      clib_warning ("No map request mode entered!");
+      return 0;
+    }
+
+  vnet_lisp_set_map_request_mode (mr_mode);
+done:
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_map_request_mode_command) = {
+    .path = "one map-request mode",
+    .short_help = "one map-request mode dst-only|src-dst",
+    .function = lisp_map_request_mode_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static u8 *
+format_lisp_map_request_mode (u8 * s, va_list * args)
+{
+  u32 mode = va_arg (*args, u32);
+
+  switch (mode)
+    {
+    case 0:
+      return format (0, "dst-only");
+    case 1:
+      return format (0, "src-dst");
+    }
+  return 0;
+}
+
+static clib_error_t *
+lisp_show_map_request_mode_command_fn (vlib_main_t * vm,
+                                      unformat_input_t * input,
+                                      vlib_cli_command_t * cmd)
+{
+  vlib_cli_output (vm, "map-request mode: %U", format_lisp_map_request_mode,
+                  vnet_lisp_get_map_request_mode ());
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_map_request_mode_command) = {
+    .path = "show one map-request mode",
+    .short_help = "show one map-request mode",
+    .function = lisp_show_map_request_mode_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_map_resolvers_command_fn (vlib_main_t * vm,
+                                   unformat_input_t * input,
+                                   vlib_cli_command_t * cmd)
+{
+  lisp_msmr_t *mr;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+  vec_foreach (mr, lcm->map_resolvers)
+  {
+    vlib_cli_output (vm, "%U", format_ip_address, &mr->address);
+  }
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_map_resolvers_command) = {
+    .path = "show one map-resolvers",
+    .short_help = "show one map-resolvers",
+    .function = lisp_show_map_resolvers_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_pitr_set_locator_set_command_fn (vlib_main_t * vm,
+                                     unformat_input_t * input,
+                                     vlib_cli_command_t * cmd)
+{
+  u8 locator_name_set = 0;
+  u8 *locator_set_name = 0;
+  u8 is_add = 1;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  clib_error_t *error = 0;
+  int rv = 0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "ls %_%v%_", &locator_set_name))
+       locator_name_set = 1;
+      else if (unformat (line_input, "disable"))
+       is_add = 0;
+      else
+       return clib_error_return (0, "parse error");
+    }
+
+  if (!locator_name_set)
+    {
+      clib_warning ("No locator set specified!");
+      goto done;
+    }
+  rv = vnet_lisp_pitr_set_locator_set (locator_set_name, is_add);
+  if (0 != rv)
+    {
+      error = clib_error_return (0, "failed to %s pitr!",
+                                is_add ? "add" : "delete");
+    }
+
+done:
+  if (locator_set_name)
+    vec_free (locator_set_name);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_pitr_set_locator_set_command) = {
+    .path = "one pitr",
+    .short_help = "one pitr [disable] ls <locator-set-name>",
+    .function = lisp_pitr_set_locator_set_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_pitr_command_fn (vlib_main_t * vm,
+                          unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *m;
+  locator_set_t *ls;
+  u8 *tmp_str = 0;
+
+  vlib_cli_output (vm, "%=20s%=16s",
+                  "pitr", lcm->lisp_pitr ? "locator-set" : "");
+
+  if (!lcm->lisp_pitr)
+    {
+      vlib_cli_output (vm, "%=20s", "disable");
+      return 0;
+    }
+
+  if (~0 == lcm->pitr_map_index)
+    {
+      tmp_str = format (0, "N/A");
+    }
+  else
+    {
+      m = pool_elt_at_index (lcm->mapping_pool, lcm->pitr_map_index);
+      if (~0 != m->locator_set_index)
+       {
+         ls =
+           pool_elt_at_index (lcm->locator_set_pool, m->locator_set_index);
+         tmp_str = format (0, "%s", ls->name);
+       }
+      else
+       {
+         tmp_str = format (0, "N/A");
+       }
+    }
+  vec_add1 (tmp_str, 0);
+
+  vlib_cli_output (vm, "%=20s%=16s", "enable", tmp_str);
+
+  vec_free (tmp_str);
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_pitr_command) = {
+    .path = "show one pitr",
+    .short_help = "Show pitr",
+    .function = lisp_show_pitr_command_fn,
+};
+/* *INDENT-ON* */
+
+static u8 *
+format_eid_entry (u8 * s, va_list * args)
+{
+  vnet_main_t *vnm = va_arg (*args, vnet_main_t *);
+  lisp_cp_main_t *lcm = va_arg (*args, lisp_cp_main_t *);
+  mapping_t *mapit = va_arg (*args, mapping_t *);
+  locator_set_t *ls = va_arg (*args, locator_set_t *);
+  gid_address_t *gid = &mapit->eid;
+  u32 ttl = mapit->ttl;
+  u8 aut = mapit->authoritative;
+  u32 *loc_index;
+  u8 first_line = 1;
+  u8 *loc;
+
+  u8 *type = ls->local ? format (0, "local(%s)", ls->name)
+    : format (0, "remote");
+
+  if (vec_len (ls->locator_indices) == 0)
+    {
+      s = format (s, "%-35U%-30s%-20u%-u", format_gid_address, gid,
+                 type, ttl, aut);
+    }
+  else
+    {
+      vec_foreach (loc_index, ls->locator_indices)
+      {
+       locator_t *l = pool_elt_at_index (lcm->locator_pool, loc_index[0]);
+       if (l->local)
+         loc = format (0, "%U", format_vnet_sw_if_index_name, vnm,
+                       l->sw_if_index);
+       else
+         loc = format (0, "%U", format_ip_address,
+                       &gid_address_ip (&l->address));
+
+       if (first_line)
+         {
+           s = format (s, "%-35U%-20s%-30v%-20u%-u\n", format_gid_address,
+                       gid, type, loc, ttl, aut);
+           first_line = 0;
+         }
+       else
+         s = format (s, "%55s%v\n", "", loc);
+      }
+    }
+  return s;
+}
+
+static clib_error_t *
+lisp_show_eid_table_command_fn (vlib_main_t * vm,
+                               unformat_input_t * input,
+                               vlib_cli_command_t * cmd)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *mapit;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u32 mi;
+  gid_address_t eid;
+  u8 print_all = 1;
+  u8 filter = 0;
+
+  memset (&eid, 0, sizeof (eid));
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "eid %U", unformat_gid_address, &eid))
+       print_all = 0;
+      else if (unformat (line_input, "local"))
+       filter = 1;
+      else if (unformat (line_input, "remote"))
+       filter = 2;
+      else
+       return clib_error_return (0, "parse error: '%U'",
+                                 format_unformat_error, line_input);
+    }
+
+  vlib_cli_output (vm, "%-35s%-20s%-30s%-20s%-s",
+                  "EID", "type", "locators", "ttl", "autoritative");
+
+  if (print_all)
+    {
+      /* *INDENT-OFF* */
+      pool_foreach (mapit, lcm->mapping_pool,
+      ({
+        locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
+                                                mapit->locator_set_index);
+        if (filter && !((1 == filter && ls->local) ||
+          (2 == filter && !ls->local)))
+          {
+            continue;
+          }
+        vlib_cli_output (vm, "%U", format_eid_entry, lcm->vnet_main,
+                         lcm, mapit, ls);
+      }));
+      /* *INDENT-ON* */
+    }
+  else
+    {
+      mi = gid_dictionary_lookup (&lcm->mapping_index_by_gid, &eid);
+      if ((u32) ~ 0 == mi)
+       return 0;
+
+      mapit = pool_elt_at_index (lcm->mapping_pool, mi);
+      locator_set_t *ls = pool_elt_at_index (lcm->locator_set_pool,
+                                            mapit->locator_set_index);
+
+      if (filter && !((1 == filter && ls->local) ||
+                     (2 == filter && !ls->local)))
+       {
+         return 0;
+       }
+
+      vlib_cli_output (vm, "%U,", format_eid_entry, lcm->vnet_main,
+                      lcm, mapit, ls);
+    }
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_show_eid_table_command) = {
+    .path = "show one eid-table",
+    .short_help = "Shows EID table",
+    .function = lisp_show_eid_table_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_enable_disable_command_fn (vlib_main_t * vm, unformat_input_t * input,
+                               vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_enabled = 0;
+  u8 is_set = 0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "enable"))
+       {
+         is_set = 1;
+         is_enabled = 1;
+       }
+      else if (unformat (line_input, "disable"))
+       is_set = 1;
+      else
+       {
+         return clib_error_return (0, "parse error: '%U'",
+                                   format_unformat_error, line_input);
+       }
+    }
+
+  if (!is_set)
+    return clib_error_return (0, "state not set");
+
+  vnet_lisp_enable_disable (is_enabled);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_enable_disable_command) = {
+    .path = "one",
+    .short_help = "one [enable|disable]",
+    .function = lisp_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_map_register_enable_disable_command_fn (vlib_main_t * vm,
+                                            unformat_input_t * input,
+                                            vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_enabled = 0;
+  u8 is_set = 0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "enable"))
+       {
+         is_set = 1;
+         is_enabled = 1;
+       }
+      else if (unformat (line_input, "disable"))
+       is_set = 1;
+      else
+       {
+         vlib_cli_output (vm, "parse error: '%U'", format_unformat_error,
+                          line_input);
+         return 0;
+       }
+    }
+
+  if (!is_set)
+    {
+      vlib_cli_output (vm, "state not set!");
+      return 0;
+    }
+
+  vnet_lisp_map_register_enable_disable (is_enabled);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_map_register_enable_disable_command) = {
+    .path = "one map-register",
+    .short_help = "one map-register [enable|disable]",
+    .function = lisp_map_register_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_rloc_probe_enable_disable_command_fn (vlib_main_t * vm,
+                                          unformat_input_t * input,
+                                          vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_enabled = 0;
+  u8 is_set = 0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "enable"))
+       {
+         is_set = 1;
+         is_enabled = 1;
+       }
+      else if (unformat (line_input, "disable"))
+       is_set = 1;
+      else
+       {
+         vlib_cli_output (vm, "parse error: '%U'", format_unformat_error,
+                          line_input);
+         return 0;
+       }
+    }
+
+  if (!is_set)
+    {
+      vlib_cli_output (vm, "state not set!");
+      return 0;
+    }
+
+  vnet_lisp_rloc_probe_enable_disable (is_enabled);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_rloc_probe_enable_disable_command) = {
+    .path = "one rloc-probe",
+    .short_help = "one rloc-probe [enable|disable]",
+    .function = lisp_rloc_probe_enable_disable_command_fn,
+};
+/* *INDENT-ON* */
+
+static u8 *
+format_lisp_status (u8 * s, va_list * args)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  return format (s, "%s", lcm->is_enabled ? "enabled" : "disabled");
+}
+
+static clib_error_t *
+lisp_show_status_command_fn (vlib_main_t * vm, unformat_input_t * input,
+                            vlib_cli_command_t * cmd)
+{
+  u8 *msg = 0;
+  msg = format (msg, "feature: %U\ngpe: %U\n",
+               format_lisp_status, format_vnet_lisp_gpe_status);
+  vlib_cli_output (vm, "%v", msg);
+  vec_free (msg);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_status_command) = {
+    .path = "show one status",
+    .short_help = "show one status",
+    .function = lisp_show_status_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_eid_table_map_command_fn (vlib_main_t * vm,
+                                   unformat_input_t * input,
+                                   vlib_cli_command_t * cmd)
+{
+  hash_pair_t *p;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  uword *vni_table = 0;
+  u8 is_l2 = 0;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "l2"))
+       {
+         vni_table = lcm->bd_id_by_vni;
+         is_l2 = 1;
+       }
+      else if (unformat (line_input, "l3"))
+       {
+         vni_table = lcm->table_id_by_vni;
+         is_l2 = 0;
+       }
+      else
+       return clib_error_return (0, "parse error: '%U'",
+                                 format_unformat_error, line_input);
+    }
+
+  if (!vni_table)
+    {
+      vlib_cli_output (vm, "Error: expected l2|l3 param!\n");
+      return 0;
+    }
+
+  vlib_cli_output (vm, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF");
+
+  /* *INDENT-OFF* */
+  hash_foreach_pair (p, vni_table,
+  ({
+    vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]);
+  }));
+  /* *INDENT-ON* */
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_eid_table_map_command) = {
+    .path = "show one eid-table map",
+    .short_help = "show one eid-table l2|l3",
+    .function = lisp_show_eid_table_map_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_add_del_locator_set_command_fn (vlib_main_t * vm,
+                                    unformat_input_t * input,
+                                    vlib_cli_command_t * cmd)
+{
+  lisp_gpe_main_t *lgm = &lisp_gpe_main;
+  vnet_main_t *vnm = lgm->vnet_main;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1;
+  clib_error_t *error = 0;
+  u8 *locator_set_name = 0;
+  locator_t locator, *locators = 0;
+  vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+  u32 ls_index = 0;
+  int rv = 0;
+
+  memset (&locator, 0, sizeof (locator));
+  memset (a, 0, sizeof (a[0]));
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "add %_%v%_", &locator_set_name))
+       is_add = 1;
+      else if (unformat (line_input, "del %_%v%_", &locator_set_name))
+       is_add = 0;
+      else if (unformat (line_input, "iface %U p %d w %d",
+                        unformat_vnet_sw_interface, vnm,
+                        &locator.sw_if_index, &locator.priority,
+                        &locator.weight))
+       {
+         locator.local = 1;
+         vec_add1 (locators, locator);
+       }
+      else
+       {
+         error = unformat_parse_error (line_input);
+         goto done;
+       }
+    }
+
+  a->name = locator_set_name;
+  a->locators = locators;
+  a->is_add = is_add;
+  a->local = 1;
+
+  rv = vnet_lisp_add_del_locator_set (a, &ls_index);
+  if (0 != rv)
+    {
+      error = clib_error_return (0, "failed to %s locator-set!",
+                                is_add ? "add" : "delete");
+    }
+
+done:
+  vec_free (locators);
+  if (locator_set_name)
+    vec_free (locator_set_name);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_add_del_locator_set_command) = {
+    .path = "one locator-set",
+    .short_help = "one locator-set add/del <name> [iface <iface-name> "
+        "p <priority> w <weight>]",
+    .function = lisp_add_del_locator_set_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_add_del_locator_in_set_command_fn (vlib_main_t * vm,
+                                       unformat_input_t * input,
+                                       vlib_cli_command_t * cmd)
+{
+  lisp_gpe_main_t *lgm = &lisp_gpe_main;
+  vnet_main_t *vnm = lgm->vnet_main;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1;
+  clib_error_t *error = 0;
+  u8 *locator_set_name = 0;
+  u8 locator_set_name_set = 0;
+  locator_t locator, *locators = 0;
+  vnet_lisp_add_del_locator_set_args_t _a, *a = &_a;
+  u32 ls_index = 0;
+
+  memset (&locator, 0, sizeof (locator));
+  memset (a, 0, sizeof (a[0]));
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "add"))
+       is_add = 1;
+      else if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "locator-set %_%v%_", &locator_set_name))
+       locator_set_name_set = 1;
+      else if (unformat (line_input, "iface %U p %d w %d",
+                        unformat_vnet_sw_interface, vnm,
+                        &locator.sw_if_index, &locator.priority,
+                        &locator.weight))
+       {
+         locator.local = 1;
+         vec_add1 (locators, locator);
+       }
+      else
+       {
+         error = unformat_parse_error (line_input);
+         goto done;
+       }
+    }
+
+  if (!locator_set_name_set)
+    {
+      error = clib_error_return (0, "locator_set name not set!");
+      goto done;
+    }
+
+  a->name = locator_set_name;
+  a->locators = locators;
+  a->is_add = is_add;
+  a->local = 1;
+
+  vnet_lisp_add_del_locator (a, 0, &ls_index);
+
+done:
+  vec_free (locators);
+  vec_free (locator_set_name);
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_add_del_locator_in_set_command) = {
+    .path = "one locator",
+    .short_help = "one locator add/del locator-set <name> iface <iface-name> "
+                  "p <priority> w <weight>",
+    .function = lisp_add_del_locator_in_set_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_cp_show_locator_sets_command_fn (vlib_main_t * vm,
+                                     unformat_input_t * input,
+                                     vlib_cli_command_t * cmd)
+{
+  locator_set_t *lsit;
+  locator_t *loc;
+  u32 *locit;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+  vlib_cli_output (vm, "%s%=16s%=16s%=16s", "Locator-set", "Locator",
+                  "Priority", "Weight");
+
+  /* *INDENT-OFF* */
+  pool_foreach (lsit, lcm->locator_set_pool,
+  ({
+    u8 * msg = 0;
+    int next_line = 0;
+    if (lsit->local)
+      {
+        msg = format (msg, "%v", lsit->name);
+      }
+    else
+      {
+        msg = format (msg, "<%s-%d>", "remote", lsit - lcm->locator_set_pool);
+      }
+    vec_foreach (locit, lsit->locator_indices)
+      {
+        if (next_line)
+          {
+            msg = format (msg, "%16s", " ");
+          }
+        loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
+        if (loc->local)
+          msg = format (msg, "%16d%16d%16d\n", loc->sw_if_index, loc->priority,
+                        loc->weight);
+        else
+          msg = format (msg, "%16U%16d%16d\n", format_ip_address,
+                        &gid_address_ip(&loc->address), loc->priority,
+                        loc->weight);
+        next_line = 1;
+      }
+    vlib_cli_output (vm, "%v", msg);
+    vec_free (msg);
+  }));
+  /* *INDENT-ON* */
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_cp_show_locator_sets_command) = {
+    .path = "show one locator-set",
+    .short_help = "Shows locator-sets",
+    .function = lisp_cp_show_locator_sets_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_add_del_map_resolver_command_fn (vlib_main_t * vm,
+                                     unformat_input_t * input,
+                                     vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1, addr_set = 0;
+  ip_address_t ip_addr;
+  clib_error_t *error = 0;
+  int rv = 0;
+  vnet_lisp_add_del_map_resolver_args_t _a, *a = &_a;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "add"))
+       is_add = 1;
+      else if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "%U", unformat_ip_address, &ip_addr))
+       addr_set = 1;
+      else
+       {
+         error = unformat_parse_error (line_input);
+         goto done;
+       }
+    }
+
+  if (!addr_set)
+    {
+      error = clib_error_return (0, "Map-resolver address must be set!");
+      goto done;
+    }
+
+  a->is_add = is_add;
+  a->address = ip_addr;
+  rv = vnet_lisp_add_del_map_resolver (a);
+  if (0 != rv)
+    {
+      error = clib_error_return (0, "failed to %s map-resolver!",
+                                is_add ? "add" : "delete");
+    }
+
+done:
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_map_resolver_command) = {
+    .path = "one map-resolver",
+    .short_help = "one map-resolver add/del <ip_address>",
+    .function = lisp_add_del_map_resolver_command_fn,
+};
+/* *INDENT-ON* */
+
+
+static clib_error_t *
+lisp_add_del_mreq_itr_rlocs_command_fn (vlib_main_t * vm,
+                                       unformat_input_t * input,
+                                       vlib_cli_command_t * cmd)
+{
+  unformat_input_t _line_input, *line_input = &_line_input;
+  u8 is_add = 1;
+  u8 *locator_set_name = 0;
+  clib_error_t *error = 0;
+  int rv = 0;
+  vnet_lisp_add_del_mreq_itr_rloc_args_t _a, *a = &_a;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "del"))
+       is_add = 0;
+      else if (unformat (line_input, "add %_%v%_", &locator_set_name))
+       is_add = 1;
+      else
+       {
+         error = unformat_parse_error (line_input);
+         goto done;
+       }
+    }
+
+  a->is_add = is_add;
+  a->locator_set_name = locator_set_name;
+  rv = vnet_lisp_add_del_mreq_itr_rlocs (a);
+  if (0 != rv)
+    {
+      error = clib_error_return (0, "failed to %s map-request itr-rlocs!",
+                                is_add ? "add" : "delete");
+    }
+
+  vec_free (locator_set_name);
+
+done:
+  return error;
+
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_add_del_map_request_command) = {
+    .path = "one map-request itr-rlocs",
+    .short_help = "one map-request itr-rlocs add/del <locator_set_name>",
+    .function = lisp_add_del_mreq_itr_rlocs_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_mreq_itr_rlocs_command_fn (vlib_main_t * vm,
+                                    unformat_input_t * input,
+                                    vlib_cli_command_t * cmd)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  locator_set_t *loc_set;
+
+  vlib_cli_output (vm, "%=20s", "itr-rlocs");
+
+  if (~0 == lcm->mreq_itr_rlocs)
+    {
+      return 0;
+    }
+
+  loc_set = pool_elt_at_index (lcm->locator_set_pool, lcm->mreq_itr_rlocs);
+
+  vlib_cli_output (vm, "%=20s", loc_set->name);
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_map_request_command) = {
+    .path = "show one map-request itr-rlocs",
+    .short_help = "Shows map-request itr-rlocs",
+    .function = lisp_show_mreq_itr_rlocs_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_use_petr_set_locator_set_command_fn (vlib_main_t * vm,
+                                         unformat_input_t * input,
+                                         vlib_cli_command_t * cmd)
+{
+  u8 is_add = 1, ip_set = 0;
+  unformat_input_t _line_input, *line_input = &_line_input;
+  clib_error_t *error = 0;
+  ip_address_t ip;
+
+  /* Get a line of input. */
+  if (!unformat_user (input, unformat_line_input, line_input))
+    return 0;
+
+  while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
+    {
+      if (unformat (line_input, "%U", unformat_ip_address, &ip))
+       ip_set = 1;
+      else if (unformat (line_input, "disable"))
+       is_add = 0;
+      else
+       return clib_error_return (0, "parse error");
+    }
+
+  if (!ip_set)
+    {
+      clib_warning ("No petr IP specified!");
+      goto done;
+    }
+
+  if (vnet_lisp_use_petr (&ip, is_add))
+    {
+      error = clib_error_return (0, "failed to %s petr!",
+                                is_add ? "add" : "delete");
+    }
+
+done:
+  return error;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_use_petr_set_locator_set_command) = {
+    .path = "one use-petr",
+    .short_help = "one use-petr [disable] <petr-ip>",
+    .function = lisp_use_petr_set_locator_set_command_fn,
+};
+
+static clib_error_t *
+lisp_show_petr_command_fn (vlib_main_t * vm,
+                           unformat_input_t * input, vlib_cli_command_t * cmd)
+{
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+  mapping_t *m;
+  locator_set_t *ls;
+  locator_t *loc;
+  u8 *tmp_str = 0;
+  u8 use_petr = lcm->flags & LISP_FLAG_USE_PETR;
+  vlib_cli_output (vm, "%=20s%=16s", "petr", use_petr ? "ip" : "");
+
+  if (!use_petr)
+    {
+      vlib_cli_output (vm, "%=20s", "disable");
+      return 0;
+    }
+
+  if (~0 == lcm->petr_map_index)
+    {
+      tmp_str = format (0, "N/A");
+    }
+  else
+    {
+      m = pool_elt_at_index (lcm->mapping_pool, lcm->petr_map_index);
+      if (~0 != m->locator_set_index)
+        {
+          ls = pool_elt_at_index(lcm->locator_set_pool, m->locator_set_index);
+          loc = pool_elt_at_index (lcm->locator_pool, ls->locator_indices[0]);
+          tmp_str = format (0, "%U", format_ip_address, &loc->address);
+        }
+      else
+        {
+          tmp_str = format (0, "N/A");
+        }
+    }
+  vec_add1 (tmp_str, 0);
+
+  vlib_cli_output (vm, "%=20s%=16s", "enable", tmp_str);
+
+  vec_free (tmp_str);
+
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_petr_command) = {
+    .path = "show one petr",
+    .short_help = "Show petr",
+    .function = lisp_show_petr_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_map_servers_command_fn (vlib_main_t * vm,
+                                 unformat_input_t * input,
+                                 vlib_cli_command_t * cmd)
+{
+  lisp_msmr_t *ms;
+  lisp_cp_main_t *lcm = vnet_lisp_cp_get_main ();
+
+  vec_foreach (ms, lcm->map_servers)
+  {
+    vlib_cli_output (vm, "%U", format_ip_address, &ms->address);
+  }
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_map_servers_command) = {
+    .path = "show one map-servers",
+    .short_help = "show one map servers",
+    .function = lisp_show_map_servers_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_map_register_state_command_fn (vlib_main_t * vm,
+                                        unformat_input_t * input,
+                                        vlib_cli_command_t * cmd)
+{
+  u8 *msg = 0;
+  u8 is_enabled = vnet_lisp_map_register_state_get ();
+
+  msg = format (msg, "%s\n", is_enabled ? "enabled" : "disabled");
+  vlib_cli_output (vm, "%v", msg);
+  vec_free (msg);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_map_register_state_command) = {
+    .path = "show one map-register state",
+    .short_help = "show one map-register state",
+    .function = lisp_show_map_register_state_command_fn,
+};
+/* *INDENT-ON* */
+
+static clib_error_t *
+lisp_show_rloc_probe_state_command_fn (vlib_main_t * vm,
+                                      unformat_input_t * input,
+                                      vlib_cli_command_t * cmd)
+{
+  u8 *msg = 0;
+  u8 is_enabled = vnet_lisp_rloc_probe_state_get ();
+
+  msg = format (msg, "%s\n", is_enabled ? "enabled" : "disabled");
+  vlib_cli_output (vm, "%v", msg);
+  vec_free (msg);
+  return 0;
+}
+
+/* *INDENT-OFF* */
+VLIB_CLI_COMMAND (one_show_rloc_probe_state_command) = {
+    .path = "show one rloc state",
+    .short_help = "show one RLOC state",
+    .function = lisp_show_rloc_probe_state_command_fn,
+};
+/* *INDENT-ON* */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
index 801ec2d..142aced 100644 (file)
@@ -50,6 +50,7 @@
 #include <vnet/ipsec-gre/ipsec_gre.api.h>
 #include <vnet/lisp-cp/lisp.api.h>
 #include <vnet/lisp-gpe/lisp_gpe.api.h>
+#include <vnet/lisp-cp/one.api.h>
 #include <vnet/mpls/mpls.api.h>
 #include <vnet/sr/sr.api.h>
 #include <vnet/classify/classify.api.h>