summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2020-09-21 08:17:51 +0000
committerDamjan Marion <dmarion@me.com>2020-09-22 16:01:29 +0000
commit2b202bc4b2d870d76bfe6fb1906ae62e253cec72 (patch)
treeb05011f96b8d9d080647323e4609af0fac90b612
parentb468773aa4164bf52e0751fdf780f67248037cc0 (diff)
lisp: Move to plugin
Type: refactor Change-Id: I54df533a8f863c4e49742903cf2457f18b4fc506 Signed-off-by: Neale Ranns <nranns@cisco.com>
-rw-r--r--src/plugins/lisp/CMakeLists.txt79
-rw-r--r--src/plugins/lisp/lisp-cp/FEATURE.yaml (renamed from src/vnet/lisp-cp/FEATURE.yaml)0
-rw-r--r--src/plugins/lisp/lisp-cp/control.c (renamed from src/vnet/lisp-cp/control.c)14
-rw-r--r--src/plugins/lisp/lisp-cp/control.h (renamed from src/vnet/lisp-cp/control.h)4
-rw-r--r--src/plugins/lisp/lisp-cp/gid_dictionary.c (renamed from src/vnet/lisp-cp/gid_dictionary.c)2
-rw-r--r--src/plugins/lisp/lisp-cp/gid_dictionary.h (renamed from src/vnet/lisp-cp/gid_dictionary.h)2
-rw-r--r--src/plugins/lisp/lisp-cp/lisp.api (renamed from src/vnet/lisp-cp/lisp.api)8
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_api.c (renamed from src/vnet/lisp-cp/lisp_api.c)120
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_cli.c (renamed from src/vnet/lisp-cp/lisp_cli.c)4
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_cp_dpo.c (renamed from src/vnet/lisp-cp/lisp_cp_dpo.c)4
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_cp_dpo.h (renamed from src/vnet/lisp-cp/lisp_cp_dpo.h)0
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_cp_messages.h (renamed from src/vnet/lisp-cp/lisp_cp_messages.h)0
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_cp_test.c2052
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_msg_serdes.c (renamed from src/vnet/lisp-cp/lisp_msg_serdes.c)4
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_msg_serdes.h (renamed from src/vnet/lisp-cp/lisp_msg_serdes.h)4
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_test.c45
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types.api (renamed from src/vnet/lisp-cp/lisp_types.api)0
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types.c (renamed from src/vnet/lisp-cp/lisp_types.c)2
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types.h (renamed from src/vnet/lisp-cp/lisp_types.h)2
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types_api.c (renamed from src/vnet/lisp-cp/lisp_types_api.c)2
-rw-r--r--src/plugins/lisp/lisp-cp/lisp_types_api.h (renamed from src/vnet/lisp-cp/lisp_types_api.h)4
-rw-r--r--src/plugins/lisp/lisp-cp/one.api (renamed from src/vnet/lisp-cp/one.api)16
-rw-r--r--src/plugins/lisp/lisp-cp/one_api.c (renamed from src/vnet/lisp-cp/one_api.c)82
-rw-r--r--src/plugins/lisp/lisp-cp/one_cli.c (renamed from src/vnet/lisp-cp/one_cli.c)4
-rw-r--r--src/plugins/lisp/lisp-cp/one_test.c3101
-rw-r--r--src/plugins/lisp/lisp-cp/packets.c (renamed from src/vnet/lisp-cp/packets.c)4
-rw-r--r--src/plugins/lisp/lisp-cp/packets.h (renamed from src/vnet/lisp-cp/packets.h)2
-rw-r--r--src/plugins/lisp/lisp-gpe/FEATURE.yaml (renamed from src/vnet/lisp-gpe/FEATURE.yaml)0
-rw-r--r--src/plugins/lisp/lisp-gpe/decap.c (renamed from src/vnet/lisp-gpe/decap.c)4
-rw-r--r--src/plugins/lisp/lisp-gpe/dir.dox (renamed from src/vnet/lisp-gpe/dir.dox)0
-rw-r--r--src/plugins/lisp/lisp-gpe/interface.c (renamed from src/vnet/lisp-gpe/interface.c)10
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe.api (renamed from src/vnet/lisp-gpe/lisp_gpe.api)12
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe.c (renamed from src/vnet/lisp-gpe/lisp_gpe.c)8
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe.h (renamed from src/vnet/lisp-gpe/lisp_gpe.h)6
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.c (renamed from src/vnet/lisp-gpe/lisp_gpe_adjacency.c)10
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.h (renamed from src/vnet/lisp-gpe/lisp_gpe_adjacency.h)2
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_api.c (renamed from src/vnet/lisp-gpe/lisp_gpe_api.c)81
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_error.def (renamed from src/vnet/lisp-gpe/lisp_gpe_error.def)0
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.c (renamed from src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c)8
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.h (renamed from src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h)2
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_packet.h (renamed from src/vnet/lisp-gpe/lisp_gpe_packet.h)0
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c (renamed from src/vnet/lisp-gpe/lisp_gpe_sub_interface.c)4
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.h (renamed from src/vnet/lisp-gpe/lisp_gpe_sub_interface.h)2
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.c (renamed from src/vnet/lisp-gpe/lisp_gpe_tenant.c)2
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.h (renamed from src/vnet/lisp-gpe/lisp_gpe_tenant.h)2
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_test.c888
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.c (renamed from src/vnet/lisp-gpe/lisp_gpe_tunnel.c)6
-rw-r--r--src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.h (renamed from src/vnet/lisp-gpe/lisp_gpe_tunnel.h)4
l---------src/plugins/lisp/lisp-gpe/lisp_types_api.c (renamed from src/vnet/lisp-gpe/lisp_types_api.c)0
l---------src/plugins/lisp/lisp-gpe/lisp_types_api.h (renamed from src/vnet/lisp-gpe/lisp_types_api.h)0
-rw-r--r--src/plugins/lisp/lisp-gpe/rfc.txt (renamed from src/vnet/lisp-gpe/rfc.txt)0
-rw-r--r--src/plugins/lisp/test/lisp_cp_test.c (renamed from src/plugins/unittest/lisp_cp_test.c)18
-rw-r--r--src/plugins/lisp/test/test_lisp.py (renamed from test/test_lisp.py)0
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c3
-rw-r--r--src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h3
-rw-r--r--src/plugins/unittest/CMakeLists.txt1
-rw-r--r--src/vat/api_format.c5028
-rw-r--r--src/vnet/CMakeLists.txt58
-rw-r--r--src/vnet/session/session_api.c2
-rw-r--r--src/vnet/vnet_all_api_h.h3
-rw-r--r--src/vpp/api/custom_dump.c412
-rw-r--r--test/framework.py2
62 files changed, 6341 insertions, 5801 deletions
diff --git a/src/plugins/lisp/CMakeLists.txt b/src/plugins/lisp/CMakeLists.txt
new file mode 100644
index 00000000000..bf0d60aab0f
--- /dev/null
+++ b/src/plugins/lisp/CMakeLists.txt
@@ -0,0 +1,79 @@
+# Copyright (c) 2020 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.
+
+##############################################################################
+# LISP control plane: lisp-cp
+##############################################################################
+
+##############################################################################
+# Tunnel protocol: lisp-gpe
+##############################################################################
+
+add_vpp_plugin(lisp
+ SOURCES
+ lisp-cp/lisp_types.c
+ lisp-cp/lisp_cp_dpo.c
+ lisp-cp/control.c
+ lisp-cp/control_main.c
+ lisp-cp/gid_dictionary.c
+ lisp-cp/lisp_msg_serdes.c
+ lisp-cp/packets.c
+ lisp-cp/one_cli.c
+ lisp-cp/lisp_cli.c
+ lisp-cp/one_api.c
+ lisp-cp/lisp_api.c
+ lisp-cp/lisp_types_api.c
+ lisp-gpe/lisp_gpe.c
+ lisp-gpe/lisp_gpe_sub_interface.c
+ lisp-gpe/lisp_gpe_adjacency.c
+ lisp-gpe/lisp_gpe_tunnel.c
+ lisp-gpe/lisp_gpe_fwd_entry.c
+ lisp-gpe/lisp_gpe_tenant.c
+ lisp-gpe/interface.c
+ lisp-gpe/decap.c
+ lisp-gpe/lisp_gpe_api.c
+
+ API_FILES
+ lisp-cp/lisp_types.api
+ lisp-cp/lisp.api
+ lisp-cp/one.api
+ lisp-gpe/lisp_gpe.api
+
+ INSTALL_HEADERS
+ lisp-cp/lisp_types.h
+ lisp-cp/packets.h
+ lisp-cp/gid_dictionary.h
+ lisp-cp/lisp_cp_messages.h
+ lisp-cp/lisp_msg_serdes.h
+ lisp-cp/control.h
+ lisp-cp/lisp_types_api.h
+ lisp-gpe/lisp_gpe.h
+ lisp-gpe/lisp_gpe_fwd_entry.h
+ lisp-gpe/lisp_gpe_tenant.h
+ lisp-gpe/lisp_gpe_packet.h
+ lisp-gpe/lisp_gpe_error.def
+
+ API_TEST_SOURCES
+ lisp-cp/lisp_test.c
+ lisp-cp/lisp_cp_test.c
+ lisp-cp/one_test.c
+ lisp-gpe/lisp_gpe_test.c
+)
+
+add_vpp_plugin(lisp_unittest
+ SOURCES
+ lisp-cp/lisp_msg_serdes.c
+ lisp-cp/control_main.c
+ lisp-cp/lisp_types.c
+ test/lisp_cp_test.c
+)
diff --git a/src/vnet/lisp-cp/FEATURE.yaml b/src/plugins/lisp/lisp-cp/FEATURE.yaml
index fb48e1fd232..fb48e1fd232 100644
--- a/src/vnet/lisp-cp/FEATURE.yaml
+++ b/src/plugins/lisp/lisp-cp/FEATURE.yaml
diff --git a/src/vnet/lisp-cp/control.c b/src/plugins/lisp/lisp-cp/control.c
index 60d85619dc5..6eee74ac7d0 100644
--- a/src/vnet/lisp-cp/control.c
+++ b/src/plugins/lisp/lisp-cp/control.c
@@ -14,12 +14,12 @@
*/
#include <vlibmemory/api.h>
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-cp/packets.h>
-#include <vnet/lisp-cp/lisp_msg_serdes.h>
-#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
-#include <vnet/lisp-gpe/lisp_gpe_tunnel.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-cp/packets.h>
+#include <lisp/lisp-cp/lisp_msg_serdes.h>
+#include <lisp/lisp-gpe/lisp_gpe_fwd_entry.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe_tunnel.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/fib/fib_table.h>
#include <vnet/ethernet/arp_packet.h>
@@ -34,8 +34,6 @@
#define TIME_UNTIL_REFETCH_OR_DELETE 20
#define MAPPING_TIMEOUT (((m->ttl) * 60) - TIME_UNTIL_REFETCH_OR_DELETE)
-lisp_cp_main_t lisp_control_main;
-
u8 *format_lisp_cp_input_trace (u8 * s, va_list * args);
static void *send_map_request_thread_fn (void *arg);
diff --git a/src/vnet/lisp-cp/control.h b/src/plugins/lisp/lisp-cp/control.h
index 78d1ffe5e70..524f5028465 100644
--- a/src/vnet/lisp-cp/control.h
+++ b/src/plugins/lisp/lisp-cp/control.h
@@ -17,8 +17,8 @@
#define VNET_CONTROL_H_
#include <vnet/vnet.h>
-#include <vnet/lisp-cp/gid_dictionary.h>
-#include <vnet/lisp-cp/lisp_types.h>
+#include <lisp/lisp-cp/gid_dictionary.h>
+#include <lisp/lisp-cp/lisp_types.h>
#include <vppinfra/timing_wheel.h>
#include <vppinfra/tw_timer_1t_3w_1024sl_ov.h>
diff --git a/src/vnet/lisp-cp/gid_dictionary.c b/src/plugins/lisp/lisp-cp/gid_dictionary.c
index 564ee8ea84d..9b0af3f5c6d 100644
--- a/src/vnet/lisp-cp/gid_dictionary.c
+++ b/src/plugins/lisp/lisp-cp/gid_dictionary.c
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include <vnet/lisp-cp/gid_dictionary.h>
+#include <lisp/lisp-cp/gid_dictionary.h>
typedef struct
{
diff --git a/src/vnet/lisp-cp/gid_dictionary.h b/src/plugins/lisp/lisp-cp/gid_dictionary.h
index 5154b3a5874..9a8e213c231 100644
--- a/src/vnet/lisp-cp/gid_dictionary.h
+++ b/src/plugins/lisp/lisp-cp/gid_dictionary.h
@@ -17,7 +17,7 @@
#define VNET_LISP_GPE_GID_DICTIONARY_H_
#include <vnet/vnet.h>
-#include <vnet/lisp-cp/lisp_types.h>
+#include <lisp/lisp-cp/lisp_types.h>
#include <vppinfra/bihash_24_8.h>
#include <vppinfra/bihash_template.h>
diff --git a/src/vnet/lisp-cp/lisp.api b/src/plugins/lisp/lisp-cp/lisp.api
index 50d72527193..ebd0a31c66e 100644
--- a/src/vnet/lisp-cp/lisp.api
+++ b/src/plugins/lisp/lisp-cp/lisp.api
@@ -16,7 +16,7 @@
option version = "2.0.0";
import "vnet/interface_types.api";
-import "vnet/lisp-cp/lisp_types.api";
+import "plugins/lisp/lisp-cp/lisp_types.api";
/** \brief add or delete locator_set
@param client_index - opaque cookie to identify the sender
@@ -26,7 +26,7 @@ import "vnet/lisp-cp/lisp_types.api";
@param locator_num - number of locators
@param locators - LISP locator records
*/
-manual_endian manual_print define lisp_add_del_locator_set
+define lisp_add_del_locator_set
{
u32 client_index;
u32 context;
@@ -294,7 +294,7 @@ define show_lisp_map_request_mode_reply
@param rloc_num - number of remote locators
@param rlocs - remote locator records
*/
-autoreply manual_print manual_endian define lisp_add_del_remote_mapping
+autoreply define lisp_add_del_remote_mapping
{
u32 client_index;
u32 context;
@@ -501,7 +501,7 @@ typedef lisp_adjacency
@param count - number of adjacencies
@param adjacencies - array of adjacencies
*/
-manual_endian manual_print define lisp_adjacencies_get_reply
+define lisp_adjacencies_get_reply
{
u32 context;
i32 retval;
diff --git a/src/vnet/lisp-cp/lisp_api.c b/src/plugins/lisp/lisp-cp/lisp_api.c
index 3cb892f035c..041069d5613 100644
--- a/src/vnet/lisp-cp/lisp_api.c
+++ b/src/plugins/lisp/lisp-cp/lisp_api.c
@@ -22,74 +22,25 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/ethernet/ethernet_types_api.h>
-#include <vnet/lisp-cp/lisp_types_api.h>
+#include <lisp/lisp-cp/lisp_types_api.h>
-#include <vnet/vnet_msg_enum.h>
+/* define message IDs */
+#include <vnet/format_fns.h>
+#include <lisp/lisp-cp/lisp.api_enum.h>
+#include <lisp/lisp-cp/lisp.api_types.h>
-
-#define vl_api_lisp_add_del_locator_set_t_endian vl_noop_handler
-#define vl_api_lisp_add_del_locator_set_t_print vl_noop_handler
-#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
-
-#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
+/**
+ * Base message ID fot the plugin
+ */
+static u32 lisp_base_msg_id;
+#define REPLY_MSG_ID_BASE lisp_base_msg_id
#include <vlibapi/api_helper_macros.h>
-#define foreach_vpe_api_msg \
-_(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
-_(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
-_(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
-_(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
-_(LISP_ADD_DEL_MAP_SERVER, lisp_add_del_map_server) \
-_(LISP_ENABLE_DISABLE, lisp_enable_disable) \
-_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
-_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
-_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
-_(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
-_(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
-_(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
-_(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
-_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
-_(LISP_LOCATOR_DUMP, lisp_locator_dump) \
-_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
-_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
-_(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
-_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
-_(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
-_(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
-_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
-_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
-_(SHOW_LISP_STATUS, show_lisp_status) \
-_(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
- lisp_add_del_map_request_itr_rlocs) \
-_(LISP_GET_MAP_REQUEST_ITR_RLOCS, lisp_get_map_request_itr_rlocs) \
-_(SHOW_LISP_PITR, show_lisp_pitr) \
-_(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
-_(LISP_USE_PETR, lisp_use_petr) \
-_(SHOW_LISP_USE_PETR, show_lisp_use_petr) \
-
static locator_t *
unformat_lisp_locs (vl_api_remote_locator_t * rmt_locs, u32 rloc_num)
{
@@ -532,7 +483,7 @@ send_lisp_locator_details (lisp_cp_main_t * lcm,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS);
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_DETAILS + REPLY_MSG_ID_BASE);
rmp->context = context;
rmp->local = loc->local;
@@ -604,7 +555,8 @@ send_lisp_locator_set_details (lisp_cp_main_t * lcm,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_LOCATOR_SET_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (VL_API_LISP_LOCATOR_SET_DETAILS + REPLY_MSG_ID_BASE);
rmp->context = context;
rmp->ls_index = htonl (ls_index);
@@ -687,7 +639,7 @@ send_lisp_eid_table_details (mapping_t * mapit,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS);
+ rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_DETAILS + REPLY_MSG_ID_BASE);
ls = pool_elt_at_index (lcm->locator_set_pool, mapit->locator_set_index);
if (vec_len (ls->locator_indices) == 0)
@@ -769,7 +721,8 @@ send_lisp_map_server_details (ip_address_t * ip, vl_api_registration_t * reg,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_SERVER_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (VL_API_LISP_MAP_SERVER_DETAILS + REPLY_MSG_ID_BASE);
ip_address_encode2 (ip, &rmp->ip_address);
rmp->context = context;
@@ -802,7 +755,8 @@ send_lisp_map_resolver_details (ip_address_t * ip,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (VL_API_LISP_MAP_RESOLVER_DETAILS + REPLY_MSG_ID_BASE);
ip_address_encode2 (ip, &rmp->ip_address);
rmp->context = context;
@@ -835,7 +789,8 @@ send_eid_table_map_pair (hash_pair_t * p, vl_api_registration_t * reg,
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (VL_API_LISP_EID_TABLE_MAP_DETAILS + REPLY_MSG_ID_BASE);
rmp->vni = clib_host_to_net_u32 (p->key);
rmp->dp_table = clib_host_to_net_u32 (p->value[0]);
@@ -880,7 +835,8 @@ send_eid_table_vni (u32 vni, vl_api_registration_t * reg, u32 context)
rmp = vl_msg_api_alloc (sizeof (*rmp));
clib_memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS);
+ rmp->_vl_msg_id =
+ ntohs (VL_API_LISP_EID_TABLE_VNI_DETAILS + REPLY_MSG_ID_BASE);
rmp->context = context;
rmp->vni = clib_host_to_net_u32 (vni);
vl_api_send_msg (reg, (u8 *) rmp);
@@ -1088,39 +1044,17 @@ vl_api_show_lisp_pitr_t_handler (vl_api_show_lisp_pitr_t * mp)
* 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 _
-}
+#include <lisp/lisp-cp/lisp.api.c>
static clib_error_t *
lisp_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = vlibapi_get_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);
+ lisp_base_msg_id = setup_message_id_table ();
- return 0;
+ return NULL;
}
VLIB_API_INIT_FUNCTION (lisp_api_hookup);
diff --git a/src/vnet/lisp-cp/lisp_cli.c b/src/plugins/lisp/lisp-cp/lisp_cli.c
index 93422fe2de7..8685c1cc04a 100644
--- a/src/vnet/lisp-cp/lisp_cli.c
+++ b/src/plugins/lisp/lisp-cp/lisp_cli.c
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
static clib_error_t *
lisp_show_adjacencies_command_fn (vlib_main_t * vm,
diff --git a/src/vnet/lisp-cp/lisp_cp_dpo.c b/src/plugins/lisp/lisp-cp/lisp_cp_dpo.c
index 848f621e35f..bbb0ee3b6dc 100644
--- a/src/vnet/lisp-cp/lisp_cp_dpo.c
+++ b/src/plugins/lisp/lisp-cp/lisp_cp_dpo.c
@@ -14,8 +14,8 @@
*/
#include <vnet/dpo/dpo.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-cp/control.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-cp/control.h>
/**
* The static array of LISP punt DPOs
diff --git a/src/vnet/lisp-cp/lisp_cp_dpo.h b/src/plugins/lisp/lisp-cp/lisp_cp_dpo.h
index f0f3fae81a4..f0f3fae81a4 100644
--- a/src/vnet/lisp-cp/lisp_cp_dpo.h
+++ b/src/plugins/lisp/lisp-cp/lisp_cp_dpo.h
diff --git a/src/vnet/lisp-cp/lisp_cp_messages.h b/src/plugins/lisp/lisp-cp/lisp_cp_messages.h
index 69510a0e1ce..69510a0e1ce 100644
--- a/src/vnet/lisp-cp/lisp_cp_messages.h
+++ b/src/plugins/lisp/lisp-cp/lisp_cp_messages.h
diff --git a/src/plugins/lisp/lisp-cp/lisp_cp_test.c b/src/plugins/lisp/lisp-cp/lisp_cp_test.c
new file mode 100644
index 00000000000..faffb738c04
--- /dev/null
+++ b/src/plugins/lisp/lisp-cp/lisp_cp_test.c
@@ -0,0 +1,2052 @@
+/*
+ * Copyright (c) 2015 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 <vat/vat.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+#include <vppinfra/error.h>
+
+#include <vnet/ip/ip_format_fns.h>
+#include <vnet/ethernet/ethernet_format_fns.h>
+#include <lisp/lisp-cp/lisp_types.h>
+
+/* define message IDs */
+#include <lisp/lisp-cp/lisp.api_enum.h>
+#include <lisp/lisp-cp/lisp.api_types.h>
+#include <vpp/api/vpe.api_types.h>
+
+typedef struct
+{
+ /* API message ID base */
+ u16 msg_id_base;
+ vat_main_t *vat_main;
+ u32 ping_id;
+} lisp_test_main_t;
+
+lisp_test_main_t lisp_test_main;
+
+#define __plugin_msg_base lisp_test_main.msg_id_base
+#include <vlibapi/vat_helper_macros.h>
+
+/* Macro to finish up custom dump fns */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
+typedef struct
+{
+ u32 spi;
+ u8 si;
+} __attribute__ ((__packed__)) lisp_nsh_api_t;
+
+#define LISP_PING(_lm, mp_ping) \
+ if (!(_lm)->ping_id) \
+ (_lm)->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC)); \
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping)); \
+ mp_ping->_vl_msg_id = htons ((_lm)->ping_id); \
+ mp_ping->client_index = vam->my_client_index; \
+ fformat (vam->ofp, "Sending ping id=%d\n", (_lm)->ping_id); \
+ vam->result_ready = 0; \
+
+uword
+unformat_nsh_address (unformat_input_t * input, va_list * args)
+{
+ lisp_nsh_api_t *nsh = va_arg (*args, lisp_nsh_api_t *);
+ return unformat (input, "SPI:%d SI:%d", &nsh->spi, &nsh->si);
+}
+
+static u8 *
+format_nsh_address_vat (u8 * s, va_list * args)
+{
+ nsh_t *a = va_arg (*args, nsh_t *);
+ return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si);
+}
+
+static u8 *
+format_lisp_flat_eid (u8 * s, va_list * args)
+{
+ vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
+
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (eid->address.prefix.address.af)
+ return format (s, "%U/%d", format_ip6_address,
+ eid->address.prefix.address.un.ip6,
+ eid->address.prefix.len);
+ return format (s, "%U/%d", format_ip4_address,
+ eid->address.prefix.address.un.ip4,
+ eid->address.prefix.len);
+ case EID_TYPE_API_MAC:
+ return format (s, "%U", format_ethernet_address, eid->address.mac);
+ case EID_TYPE_API_NSH:
+ return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
+ }
+ return 0;
+}
+
+static u8 *
+format_lisp_eid_vat (u8 * s, va_list * args)
+{
+ vl_api_eid_t *deid = va_arg (*args, vl_api_eid_t *);
+ vl_api_eid_t *seid = va_arg (*args, vl_api_eid_t *);
+ u8 is_src_dst = (u8) va_arg (*args, int);
+
+ if (is_src_dst)
+ s = format (s, "%U|", format_lisp_flat_eid, seid);
+
+ s = format (s, "%U", format_lisp_flat_eid, deid);
+
+ return s;
+}
+
+
+
+/* *INDENT-OFF* */
+/** Used for parsing LISP eids */
+typedef struct lisp_eid_vat_t_
+{
+ union {
+ ip46_address_t ip;
+ mac_address_t mac;
+ lisp_nsh_api_t nsh;
+ } addr;
+ /**< prefix length if IP */
+ u32 len;
+ /**< type of eid */
+ u8 type;
+} __clib_packed lisp_eid_vat_t;
+/* *INDENT-ON* */
+
+static uword
+unformat_lisp_eid_vat (unformat_input_t * input, va_list * args)
+{
+ lisp_eid_vat_t *a = va_arg (*args, lisp_eid_vat_t *);
+
+ clib_memset (a, 0, sizeof (a[0]));
+
+ if (unformat (input, "%U/%d", unformat_ip46_address, a->addr.ip, &a->len))
+ {
+ a->type = 0; /* ip prefix type */
+ }
+ else if (unformat (input, "%U", unformat_ethernet_address, &a->addr.mac))
+ {
+ a->type = 1; /* mac type */
+ }
+ else if (unformat (input, "%U", unformat_nsh_address, a->addr.nsh))
+ {
+ a->type = 2; /* NSH type */
+ a->addr.nsh.spi = clib_host_to_net_u32 (a->addr.nsh.spi);
+ }
+ else
+ {
+ return 0;
+ }
+
+ if (a->type == 0)
+ {
+ if (ip46_address_is_ip4 (&a->addr.ip))
+ return a->len > 32 ? 1 : 0;
+ else
+ return a->len > 128 ? 1 : 0;
+ }
+
+ return 1;
+}
+
+static void
+lisp_eid_put_vat (vl_api_eid_t * eid, const lisp_eid_vat_t * vat_eid)
+{
+ eid->type = vat_eid->type;
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (ip46_address_is_ip4 (&vat_eid->addr.ip))
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip4,
+ &vat_eid->addr.ip.ip4, 4);
+ eid->address.prefix.address.af = ADDRESS_IP4;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ else
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip6,
+ &vat_eid->addr.ip.ip6, 16);
+ eid->address.prefix.address.af = ADDRESS_IP6;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ return;
+ case EID_TYPE_API_MAC:
+ clib_memcpy (&eid->address.mac, &vat_eid->addr.mac,
+ sizeof (eid->address.mac));
+ return;
+ case EID_TYPE_API_NSH:
+ clib_memcpy (&eid->address.nsh, &vat_eid->addr.nsh,
+ sizeof (eid->address.nsh));
+ return;
+ default:
+ ASSERT (0);
+ return;
+ }
+}
+
+static int
+api_lisp_add_del_locator_set (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_locator_set_t *mp;
+ u8 is_add = 1;
+ u8 *locator_set_name = NULL;
+ u8 locator_set_name_set = 0;
+ vl_api_local_locator_t locator, *locators = 0;
+ u32 sw_if_index, priority, weight;
+ u32 data_len = 0;
+
+ int ret;
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "sw_if_index %u p %u w %u",
+ &sw_if_index, &priority, &weight))
+ {
+ locator.sw_if_index = htonl (sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1 (locators, locator);
+ }
+ else
+ if (unformat
+ (input, "iface %U p %u w %u", unformat_sw_if_index, vam,
+ &sw_if_index, &priority, &weight))
+ {
+ locator.sw_if_index = htonl (sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1 (locators, locator);
+ }
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ vec_free (locators);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ vec_free (locators);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ data_len = sizeof (vl_api_local_locator_t) * vec_len (locators);
+
+ /* Construct the API message */
+ M2 (LISP_ADD_DEL_LOCATOR_SET, mp, data_len);
+
+ mp->is_add = is_add;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ vec_free (locator_set_name);
+
+ mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
+ if (locators)
+ clib_memcpy (mp->locators, locators, data_len);
+ vec_free (locators);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_add_del_locator (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_locator_t *mp;
+ u32 tmp_if_index = ~0;
+ u32 sw_if_index = ~0;
+ u8 sw_if_index_set = 0;
+ u8 sw_if_index_if_name_set = 0;
+ u32 priority = ~0;
+ u8 priority_set = 0;
+ u32 weight = ~0;
+ u8 weight_set = 0;
+ u8 is_add = 1;
+ u8 *locator_set_name = NULL;
+ u8 locator_set_name_set = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "iface %U", unformat_sw_if_index, vam,
+ &tmp_if_index))
+ {
+ sw_if_index_if_name_set = 1;
+ sw_if_index = tmp_if_index;
+ }
+ else if (unformat (input, "sw_if_index %d", &tmp_if_index))
+ {
+ sw_if_index_set = 1;
+ sw_if_index = tmp_if_index;
+ }
+ else if (unformat (input, "p %d", &priority))
+ {
+ priority_set = 1;
+ }
+ else if (unformat (input, "w %d", &weight))
+ {
+ weight_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ return -99;
+ }
+
+ if (sw_if_index_set == 0 && sw_if_index_if_name_set == 0)
+ {
+ errmsg ("missing sw_if_index");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (sw_if_index_set != 0 && sw_if_index_if_name_set != 0)
+ {
+ errmsg ("cannot use both params interface name and sw_if_index");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (priority_set == 0)
+ {
+ errmsg ("missing locator-set priority");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (weight_set == 0)
+ {
+ errmsg ("missing locator-set weight");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ /* Construct the API message */
+ M (LISP_ADD_DEL_LOCATOR, mp);
+
+ mp->is_add = is_add;
+ mp->sw_if_index = ntohl (sw_if_index);
+ mp->priority = priority;
+ mp->weight = weight;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ vec_free (locator_set_name);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_add_del_local_eid (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_local_eid_t *mp;
+ u8 is_add = 1;
+ u8 eid_set = 0;
+ lisp_eid_vat_t _eid, *eid = &_eid;
+ u8 *locator_set_name = 0;
+ u8 locator_set_name_set = 0;
+ u32 vni = 0;
+ u16 key_id = 0;
+ u8 *key = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
+ {
+ eid_set = 1;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "key-id %U", unformat_hmac_key_id, &key_id))
+ ;
+ else if (unformat (input, "secret-key %_%v%_", &key))
+ ;
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ return -99;
+ }
+
+ if (0 == eid_set)
+ {
+ errmsg ("EID address not set!");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (key && (0 == key_id))
+ {
+ errmsg ("invalid key_id!");
+ return -99;
+ }
+
+ if (vec_len (key) > 64)
+ {
+ errmsg ("key too long");
+ vec_free (key);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ /* Construct the API message */
+ M (LISP_ADD_DEL_LOCAL_EID, mp);
+
+ mp->is_add = is_add;
+ lisp_eid_put_vat (&mp->eid, eid);
+ mp->vni = clib_host_to_net_u32 (vni);
+ mp->key.id = key_id;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ clib_memcpy (mp->key.key, key, vec_len (key));
+
+ vec_free (locator_set_name);
+ vec_free (key);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_add_del_map_server (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_map_server_t *mp;
+ u8 is_add = 1;
+ u8 ipv4_set = 0;
+ u8 ipv6_set = 0;
+ ip4_address_t ipv4;
+ ip6_address_t ipv6;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
+ {
+ ipv4_set = 1;
+ }
+ else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
+ {
+ ipv6_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (ipv4_set && ipv6_set)
+ {
+ errmsg ("both eid v4 and v6 addresses set");
+ return -99;
+ }
+
+ if (!ipv4_set && !ipv6_set)
+ {
+ errmsg ("eid addresses not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (LISP_ADD_DEL_MAP_SERVER, mp);
+
+ mp->is_add = is_add;
+ if (ipv6_set)
+ {
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
+ }
+ else
+ {
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip4, &ipv4, sizeof (ipv4));
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_add_del_map_resolver (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_map_resolver_t *mp;
+ u8 is_add = 1;
+ u8 ipv4_set = 0;
+ u8 ipv6_set = 0;
+ ip4_address_t ipv4;
+ ip6_address_t ipv6;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
+ {
+ ipv4_set = 1;
+ }
+ else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
+ {
+ ipv6_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (ipv4_set && ipv6_set)
+ {
+ errmsg ("both eid v4 and v6 addresses set");
+ return -99;
+ }
+
+ if (!ipv4_set && !ipv6_set)
+ {
+ errmsg ("eid addresses not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (LISP_ADD_DEL_MAP_RESOLVER, mp);
+
+ mp->is_add = is_add;
+ if (ipv6_set)
+ {
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
+ }
+ else
+ {
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv4, sizeof (ipv4));
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (LISP_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Enable/disable LISP proxy ITR.
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_lisp_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;
+ u8 is_add = 1;
+ u8 *ls_name = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "locator-set %s", &ls_name))
+ ls_name_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!ls_name_set)
+ {
+ errmsg ("locator-set name not set!");
+ return -99;
+ }
+
+ M (LISP_PITR_SET_LOCATOR_SET, mp);
+
+ mp->is_add = is_add;
+ clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
+ vec_free (ls_name);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_use_petr (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_use_petr_t *mp;
+ u8 is_add = 0;
+ ip_address_t ip;
+ int ret;
+
+ clib_memset (&ip, 0, sizeof (ip));
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "disable"))
+ is_add = 0;
+ else
+ if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (&ip)))
+ {
+ is_add = 1;
+ ip_addr_version (&ip) = AF_IP4;
+ }
+ else
+ if (unformat (input, "%U", unformat_ip6_address, &ip_addr_v6 (&ip)))
+ {
+ is_add = 1;
+ ip_addr_version (&ip) = AF_IP6;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ M (LISP_USE_PETR, mp);
+
+ mp->is_add = is_add;
+ if (is_add)
+ {
+ mp->ip_address.af = ip_addr_version (&ip) == AF_IP4 ? 0 : 1;
+ if (mp->ip_address.af)
+ clib_memcpy (mp->ip_address.un.ip6, &ip, 16);
+ else
+ clib_memcpy (mp->ip_address.un.ip4, &ip, 4);
+ }
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static void
+ vl_api_show_lisp_use_petr_reply_t_handler
+ (vl_api_show_lisp_use_petr_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%s\n", mp->is_petr_enable ? "enabled" : "disabled");
+ if (mp->is_petr_enable)
+ {
+ print (vam->ofp, "Proxy-ETR address; %U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+ }
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static int
+api_show_lisp_use_petr (vat_main_t * vam)
+{
+ vl_api_show_lisp_use_petr_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Proxy-ETR status:");
+ }
+
+ M (SHOW_LISP_USE_PETR, mp);
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static void
+ vl_api_show_lisp_rloc_probe_state_reply_t_handler
+ (vl_api_show_lisp_rloc_probe_state_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ print (vam->ofp, "%s", mp->is_enabled ? "enabled" : "disabled");
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static int
+api_show_lisp_map_register_state (vat_main_t * vam)
+{
+ vl_api_show_lisp_map_register_state_t *mp;
+ int ret;
+
+ M (SHOW_LISP_MAP_REGISTER_STATE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_lisp_rloc_probe_state (vat_main_t * vam)
+{
+ vl_api_show_lisp_rloc_probe_state_t *mp;
+ int ret;
+
+ M (SHOW_LISP_RLOC_PROBE_STATE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_rloc_probe_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_rloc_probe_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ is_set = 1;
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (LISP_RLOC_PROBE_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_map_register_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_map_register_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ is_set = 1;
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (LISP_MAP_REGISTER_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static void
+ vl_api_show_lisp_map_request_mode_reply_t_handler
+ (vl_api_show_lisp_map_request_mode_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "map_request_mode: %s",
+ mp->is_src_dst ? "src-dst" : "dst-only");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_lisp_map_register_state_reply_t_handler
+ (vl_api_show_lisp_map_register_state_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ print (vam->ofp, "%s", mp->is_enabled ? "enabled" : "disabled");
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_lisp_locator_details_t_handler (vl_api_lisp_locator_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *s = 0;
+
+ if (mp->local)
+ {
+ s = format (s, "%=16d%=16d%=16d",
+ ntohl (mp->sw_if_index), mp->priority, mp->weight);
+ }
+ else
+ {
+ s = format (s, "%=16U%=16d%=16d",
+ format_ip46_address,
+ mp->ip_address, mp->priority, mp->weight);
+ }
+
+ print (vam->ofp, "%v", s);
+ vec_free (s);
+}
+
+static void
+vl_api_lisp_locator_set_details_t_handler (vl_api_lisp_locator_set_details_t *
+ mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *ls_name = 0;
+
+ ls_name = format (0, "%s", mp->ls_name);
+
+ print (vam->ofp, "%=10d%=15v", clib_net_to_host_u32 (mp->ls_index),
+ ls_name);
+ vec_free (ls_name);
+}
+
+static void vl_api_lisp_add_del_locator_set_reply_t_handler
+ (vl_api_lisp_add_del_locator_set_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+
+static void
+vl_api_lisp_eid_table_details_t_handler (vl_api_lisp_eid_table_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *s = 0, *eid = 0;
+
+ if (~0 == mp->locator_set_index)
+ s = format (0, "action: %d", mp->action);
+ else
+ s = format (0, "%d", clib_net_to_host_u32 (mp->locator_set_index));
+
+ eid = format (0, "%U", format_lisp_eid_vat,
+ &mp->deid, &mp->seid, mp->is_src_dst);
+ vec_add1 (eid, 0);
+
+ print (vam->ofp, "[%d] %-35s%-20s%-30s%-20d%-20d%-10d%-20s",
+ clib_net_to_host_u32 (mp->vni),
+ eid,
+ mp->is_local ? "local" : "remote",
+ s, clib_net_to_host_u32 (mp->ttl), mp->authoritative,
+ clib_net_to_host_u16 (mp->key.id), mp->key.key);
+
+ vec_free (s);
+ vec_free (eid);
+}
+
+static void
+ vl_api_lisp_eid_table_map_details_t_handler
+ (vl_api_lisp_eid_table_map_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ u8 *line = format (0, "%=10d%=10d",
+ clib_net_to_host_u32 (mp->vni),
+ clib_net_to_host_u32 (mp->dp_table));
+ print (vam->ofp, "%v", line);
+ vec_free (line);
+}
+
+static void
+ vl_api_lisp_eid_table_vni_details_t_handler
+ (vl_api_lisp_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ u8 *line = format (0, "%d", clib_net_to_host_u32 (mp->vni));
+ print (vam->ofp, "%v", line);
+ vec_free (line);
+}
+
+static void
+ vl_api_lisp_adjacencies_get_reply_t_handler
+ (vl_api_lisp_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;
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ {
+ a = &mp->adjacencies[i];
+ print (vam->ofp, "%U %40U",
+ format_lisp_flat_eid, a->leid, format_lisp_flat_eid, a->reid);
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_lisp_map_server_details_t_handler (vl_api_lisp_map_server_details_t *
+ mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "%=20U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+}
+
+static void
+vl_api_lisp_map_resolver_details_t_handler (vl_api_lisp_map_resolver_details_t
+ * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "%=20U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+}
+
+static void
+vl_api_show_lisp_status_reply_t_handler (vl_api_show_lisp_status_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "feature: %s\ngpe: %s",
+ mp->is_lisp_enabled ? "enabled" : "disabled",
+ mp->is_gpe_enabled ? "enabled" : "disabled");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_lisp_get_map_request_itr_rlocs_reply_t_handler
+ (vl_api_lisp_get_map_request_itr_rlocs_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (retval >= 0)
+ {
+ print (vam->ofp, "%=20s", mp->locator_set_name);
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_show_lisp_pitr_reply_t_handler (vl_api_show_lisp_pitr_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%-20s%-16s",
+ mp->is_enabled ? "enabled" : "disabled",
+ mp->is_enabled ? (char *) mp->locator_set_name : "");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+uword
+unformat_hmac_key_id (unformat_input_t * input, va_list * args)
+{
+ u32 *key_id = va_arg (*args, u32 *);
+ u8 *s = 0;
+
+ if (unformat (input, "%s", &s))
+ {
+ if (!strcmp ((char *) s, "sha1"))
+ key_id[0] = HMAC_SHA_1_96;
+ else if (!strcmp ((char *) s, "sha256"))
+ key_id[0] = HMAC_SHA_256_128;
+ else
+ {
+ clib_warning ("invalid key_id: '%s'", s);
+ key_id[0] = HMAC_NO_KEY;
+ }
+ }
+ else
+ return 0;
+
+ vec_free (s);
+ return 1;
+}
+
+
+
+static int
+api_show_lisp_map_request_mode (vat_main_t * vam)
+{
+ vl_api_show_lisp_map_request_mode_t *mp;
+ int ret;
+
+ M (SHOW_LISP_MAP_REQUEST_MODE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_map_request_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_map_request_mode_t *mp;
+ u8 mode = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "dst-only"))
+ mode = 0;
+ else if (unformat (input, "src-dst"))
+ mode = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ M (LISP_MAP_REQUEST_MODE, mp);
+
+ mp->is_src_dst = mode == 1;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_lisp_pitr (vat_main_t * vam)
+{
+ vl_api_show_lisp_pitr_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "lisp status:");
+ }
+
+ M (SHOW_LISP_PITR, mp);
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Add/delete mapping between vni and vrf
+ */
+static int
+api_lisp_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;
+ u8 is_add = 1, vni_set = 0, vrf_set = 0, bd_index_set = 0;
+ u32 vni, vrf, bd_index;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "vrf %d", &vrf))
+ vrf_set = 1;
+ else if (unformat (input, "bd_index %d", &bd_index))
+ bd_index_set = 1;
+ else if (unformat (input, "vni %d", &vni))
+ vni_set = 1;
+ else
+ break;
+ }
+
+ if (!vni_set || (!vrf_set && !bd_index_set))
+ {
+ errmsg ("missing arguments!");
+ return -99;
+ }
+
+ if (vrf_set && bd_index_set)
+ {
+ errmsg ("error: both vrf and bd entered!");
+ return -99;
+ }
+
+ M (LISP_EID_TABLE_ADD_DEL_MAP, mp);
+
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ mp->dp_table = vrf_set ? htonl (vrf) : htonl (bd_index);
+ mp->is_l2 = bd_index_set;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Add/del remote mapping to/from LISP control plane
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_lisp_add_del_remote_mapping (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_remote_mapping_t *mp;
+ u32 vni = 0;
+ lisp_eid_vat_t _eid, *eid = &_eid;
+ lisp_eid_vat_t _seid, *seid = &_seid;
+ u8 is_add = 1, del_all = 0, eid_set = 0, seid_set = 0;
+ u32 action = ~0, p, w, data_len;
+ ip4_address_t rloc4;
+ ip6_address_t rloc6;
+ vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
+ int ret;
+
+ clib_memset (&rloc, 0, sizeof (rloc));
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del-all"))
+ {
+ del_all = 1;
+ }
+ else if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "add"))
+ {
+ is_add = 1;
+ }
+ else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
+ {
+ eid_set = 1;
+ }
+ else if (unformat (input, "seid %U", unformat_lisp_eid_vat, seid))
+ {
+ seid_set = 1;
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else if (unformat (input, "p %d w %d", &p, &w))
+ {
+ if (!curr_rloc)
+ {
+ errmsg ("No RLOC configured for setting priority/weight!");
+ return -99;
+ }
+ curr_rloc->priority = p;
+ curr_rloc->weight = w;
+ }
+ else if (unformat (input, "rloc %U", unformat_ip4_address, &rloc4))
+ {
+ rloc.ip_address.af = 0;
+ clib_memcpy (&rloc.ip_address.un.ip6, &rloc6, sizeof (rloc6));
+ vec_add1 (rlocs, rloc);
+ curr_rloc = &rlocs[vec_len (rlocs) - 1];
+ }
+ else if (unformat (input, "rloc %U", unformat_ip6_address, &rloc6))
+ {
+ rloc.ip_address.af = 1;
+ clib_memcpy (&rloc.ip_address.un.ip4, &rloc4, sizeof (rloc4));
+ vec_add1 (rlocs, rloc);
+ curr_rloc = &rlocs[vec_len (rlocs) - 1];
+ }
+ else if (unformat (input, "action %U",
+ unformat_negative_mapping_action, &action))
+ {
+ ;
+ }
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (0 == eid_set)
+ {
+ errmsg ("missing params!");
+ return -99;
+ }
+
+ if (is_add && (~0 == action) && 0 == vec_len (rlocs))
+ {
+ errmsg ("no action set for negative map-reply!");
+ return -99;
+ }
+
+ data_len = vec_len (rlocs) * sizeof (vl_api_remote_locator_t);
+
+ M2 (LISP_ADD_DEL_REMOTE_MAPPING, mp, data_len);
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ mp->action = (u8) action;
+ mp->is_src_dst = seid_set;
+ mp->del_all = del_all;
+ lisp_eid_put_vat (&mp->deid, eid);
+ lisp_eid_put_vat (&mp->seid, seid);
+
+ mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
+ clib_memcpy (mp->rlocs, rlocs, data_len);
+ vec_free (rlocs);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Add/del LISP adjacency. Saves mapping in LISP control plane and updates
+ * forwarding entries in data-plane accordingly.
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_lisp_add_del_adjacency (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_adjacency_t *mp;
+ u32 vni = 0;
+ u8 is_add = 1;
+ int ret;
+ lisp_eid_vat_t leid, reid;
+
+ leid.type = reid.type = (u8) ~ 0;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "add"))
+ {
+ is_add = 1;
+ }
+ else if (unformat (input, "reid %U/%d", unformat_ip46_address,
+ &reid.addr.ip, &reid.len))
+ {
+ reid.type = 0; /* ipv4 */
+ }
+ else if (unformat (input, "reid %U", unformat_ethernet_address,
+ &reid.addr.mac))
+ {
+ reid.type = 1; /* mac */
+ }
+ else if (unformat (input, "leid %U/%d", unformat_ip46_address,
+ &leid.addr.ip, &leid.len))
+ {
+ leid.type = 0; /* ipv4 */
+ }
+ else if (unformat (input, "leid %U", unformat_ethernet_address,
+ &leid.addr.mac))
+ {
+ leid.type = 1; /* mac */
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if ((u8) ~ 0 == reid.type)
+ {
+ errmsg ("missing params!");
+ return -99;
+ }
+
+ if (leid.type != reid.type)
+ {
+ errmsg ("remote and local EIDs are of different types!");
+ return -99;
+ }
+
+ M (LISP_ADD_DEL_ADJACENCY, mp);
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ lisp_eid_put_vat (&mp->leid, &leid);
+ lisp_eid_put_vat (&mp->reid, &reid);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Add/del map request itr rlocs from LISP 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)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_add_del_map_request_itr_rlocs_t *mp;
+ u8 *locator_set_name = 0;
+ u8 locator_set_name_set = 0;
+ u8 is_add = 1;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%_%v%_", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (is_add && !locator_set_name_set)
+ {
+ errmsg ("itr-rloc is not set!");
+ return -99;
+ }
+
+ if (is_add && vec_len (locator_set_name) > 64)
+ {
+ errmsg ("itr-rloc locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ M (LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, mp);
+ mp->is_add = is_add;
+ if (is_add)
+ {
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ }
+ else
+ {
+ clib_memset (mp->locator_set_name, 0, sizeof (mp->locator_set_name));
+ }
+ vec_free (locator_set_name);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_locator_dump (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_lisp_locator_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ u8 is_index_set = 0, is_name_set = 0;
+ u8 *ls_name = 0;
+ u32 ls_index = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "ls_name %_%v%_", &ls_name))
+ {
+ is_name_set = 1;
+ }
+ else if (unformat (input, "ls_index %d", &ls_index))
+ {
+ is_index_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!is_index_set && !is_name_set)
+ {
+ errmsg ("error: expected lisp of index or name!");
+ return -99;
+ }
+
+ if (is_index_set && is_name_set)
+ {
+ errmsg ("error: only lisp param expected!");
+ return -99;
+ }
+
+ if (vec_len (ls_name) > 62)
+ {
+ errmsg ("error: locator set name too long!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=16s%=16s%=16s", "locator", "priority", "weight");
+ }
+
+ M (LISP_LOCATOR_DUMP, mp);
+ mp->is_index_set = is_index_set;
+
+ if (is_index_set)
+ mp->ls_index = clib_host_to_net_u32 (ls_index);
+ else
+ {
+ vec_add1 (ls_name, 0);
+ strncpy ((char *) mp->ls_name, (char *) ls_name,
+ sizeof (mp->ls_name) - 1);
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ if (!lisp_test_main.ping_id)
+ lisp_test_main.ping_id =
+ vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC));
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping));
+ mp_ping->_vl_msg_id = htons (lisp_test_main.ping_id);
+ mp_ping->client_index = vam->my_client_index;
+
+ fformat (vam->ofp, "Sending ping id=%d\n", lisp_test_main.ping_id);
+
+ vam->result_ready = 0;
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_locator_set_dump (vat_main_t * vam)
+{
+ vl_api_lisp_locator_set_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ unformat_input_t *input = vam->input;
+ u8 filter = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "local"))
+ {
+ filter = 1;
+ }
+ else if (unformat (input, "remote"))
+ {
+ filter = 2;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=10s%=15s", "ls_index", "ls_name");
+ }
+
+ M (LISP_LOCATOR_SET_DUMP, mp);
+
+ mp->filter = filter;
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_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_control_ping_t *mp_ping;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "l2"))
+ {
+ is_l2 = 1;
+ mode_set = 1;
+ }
+ else if (unformat (input, "l3"))
+ {
+ is_l2 = 0;
+ mode_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!mode_set)
+ {
+ errmsg ("expected lisp of 'l2' or 'l3' parameter!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF");
+ }
+
+ M (LISP_EID_TABLE_MAP_DUMP, mp);
+ mp->is_l2 = is_l2;
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_eid_table_vni_dump (vat_main_t * vam)
+{
+ vl_api_lisp_eid_table_vni_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "VNI");
+ }
+
+ M (LISP_EID_TABLE_VNI_DUMP, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_eid_table_dump (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_lisp_eid_table_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ u8 filter = 0;
+ int ret;
+ u32 vni, t = 0;
+ lisp_eid_vat_t eid;
+ u8 eid_set = 0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat
+ (i, "eid %U/%d", unformat_ip46_address, &eid.addr.ip, &eid.len))
+ {
+ eid_set = 1;
+ eid.type = 0;
+ }
+ else
+ if (unformat (i, "eid %U", unformat_ethernet_address, &eid.addr.mac))
+ {
+ eid_set = 1;
+ eid.type = 1;
+ }
+ else if (unformat (i, "eid %U", unformat_nsh_address, &eid.addr.nsh))
+ {
+ eid_set = 1;
+ eid.type = 2;
+ }
+ else if (unformat (i, "vni %d", &t))
+ {
+ vni = t;
+ }
+ else if (unformat (i, "local"))
+ {
+ filter = 1;
+ }
+ else if (unformat (i, "remote"))
+ {
+ filter = 2;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%-35s%-20s%-30s%-20s%-20s%-10s%-20s", "EID",
+ "type", "ls_index", "ttl", "authoritative", "key_id", "key");
+ }
+
+ M (LISP_EID_TABLE_DUMP, mp);
+
+ mp->filter = filter;
+ if (eid_set)
+ {
+ mp->eid_set = 1;
+ mp->vni = htonl (vni);
+ lisp_eid_put_vat (&mp->eid, &eid);
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+
+static int
+api_lisp_adjacencies_get (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_lisp_adjacencies_get_t *mp;
+ u8 vni_set = 0;
+ u32 vni = ~0;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "vni %d", &vni))
+ {
+ vni_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!vni_set)
+ {
+ errmsg ("vni not set!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%s %40s", "leid", "reid");
+ }
+
+ M (LISP_ADJACENCIES_GET, mp);
+ mp->vni = clib_host_to_net_u32 (vni);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_map_server_dump (vat_main_t * vam)
+{
+ vl_api_lisp_map_server_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Map server");
+ }
+
+ M (LISP_MAP_SERVER_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_map_resolver_dump (vat_main_t * vam)
+{
+ vl_api_lisp_map_resolver_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Map resolver");
+ }
+
+ M (LISP_MAP_RESOLVER_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_lisp_status (vat_main_t * vam)
+{
+ vl_api_show_lisp_status_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%-20s%-16s", "LISP status", "locator-set");
+ }
+
+ M (SHOW_LISP_STATUS, mp);
+ /* send it... */
+ S (mp);
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_lisp_get_map_request_itr_rlocs (vat_main_t * vam)
+{
+ vl_api_lisp_get_map_request_itr_rlocs_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "itr-rlocs:");
+ }
+
+ M (LISP_GET_MAP_REQUEST_ITR_RLOCS, mp);
+ /* send it... */
+ S (mp);
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define vat_plugin_register vat_plugin_register_cp
+#include <lisp/lisp-cp/lisp.api_test.c>
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/lisp_msg_serdes.c b/src/plugins/lisp/lisp-cp/lisp_msg_serdes.c
index 90afb10b68b..14d90982d4f 100644
--- a/src/vnet/lisp-cp/lisp_msg_serdes.c
+++ b/src/plugins/lisp/lisp-cp/lisp_msg_serdes.c
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include <vnet/lisp-cp/lisp_msg_serdes.h>
-#include <vnet/lisp-cp/packets.h>
+#include <lisp/lisp-cp/lisp_msg_serdes.h>
+#include <lisp/lisp-cp/packets.h>
#include <vppinfra/time.h>
void *lisp_msg_put_gid (vlib_buffer_t * b, gid_address_t * gid);
diff --git a/src/vnet/lisp-cp/lisp_msg_serdes.h b/src/plugins/lisp/lisp-cp/lisp_msg_serdes.h
index d794eff6340..a6222a0263a 100644
--- a/src/vnet/lisp-cp/lisp_msg_serdes.h
+++ b/src/plugins/lisp/lisp-cp/lisp_msg_serdes.h
@@ -17,8 +17,8 @@
#define VNET_LISP_GPE_LISP_MSG_BUILDER_H_
#include <vnet/vnet.h>
-#include <vnet/lisp-cp/lisp_cp_messages.h>
-#include <vnet/lisp-cp/control.h>
+#include <lisp/lisp-cp/lisp_cp_messages.h>
+#include <lisp/lisp-cp/control.h>
void *lisp_msg_put_mreq (lisp_cp_main_t * lcm, vlib_buffer_t * b,
gid_address_t * seid, gid_address_t * deid,
diff --git a/src/plugins/lisp/lisp-cp/lisp_test.c b/src/plugins/lisp/lisp-cp/lisp_test.c
new file mode 100644
index 00000000000..17bfcf74ebd
--- /dev/null
+++ b/src/plugins/lisp/lisp-cp/lisp_test.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2020 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 <vat/vat.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+
+clib_error_t *vat_plugin_register_one (vat_main_t * vam);
+clib_error_t *vat_plugin_register_cp (vat_main_t * vam);
+clib_error_t *vat_plugin_register_gpe (vat_main_t * vam);
+
+clib_error_t *
+vat_plugin_register (vat_main_t * vam)
+{
+ clib_error_t *err;
+
+ if ((err = vat_plugin_register_gpe (vam)))
+ return err;
+ if ((err = vat_plugin_register_cp (vam)))
+ return err;
+ if ((err = vat_plugin_register_one (vam)))
+ return err;
+
+ return NULL;
+}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/lisp_types.api b/src/plugins/lisp/lisp-cp/lisp_types.api
index aab01308df8..aab01308df8 100644
--- a/src/vnet/lisp-cp/lisp_types.api
+++ b/src/plugins/lisp/lisp-cp/lisp_types.api
diff --git a/src/vnet/lisp-cp/lisp_types.c b/src/plugins/lisp/lisp-cp/lisp_types.c
index 6ff3b4ebf4b..0356949b757 100644
--- a/src/vnet/lisp-cp/lisp_types.c
+++ b/src/plugins/lisp/lisp-cp/lisp_types.c
@@ -14,7 +14,7 @@
*/
#include <vnet/ethernet/ethernet.h>
-#include <vnet/lisp-cp/lisp_types.h>
+#include <lisp/lisp-cp/lisp_types.h>
static u16 gid_address_put_no_vni (u8 * b, gid_address_t * gid);
static u16 gid_address_size_to_put_no_vni (gid_address_t * gid);
diff --git a/src/vnet/lisp-cp/lisp_types.h b/src/plugins/lisp/lisp-cp/lisp_types.h
index e08ba15dfd3..3f7d0302640 100644
--- a/src/vnet/lisp-cp/lisp_types.h
+++ b/src/plugins/lisp/lisp-cp/lisp_types.h
@@ -17,7 +17,7 @@
#define VNET_LISP_GPE_LISP_TYPES_H_
#include <vnet/ip/ip.h>
-#include <vnet/lisp-cp/lisp_cp_messages.h>
+#include <lisp/lisp-cp/lisp_cp_messages.h>
#define SHA1_AUTH_DATA_LEN 20
#define SHA256_AUTH_DATA_LEN 32
diff --git a/src/vnet/lisp-cp/lisp_types_api.c b/src/plugins/lisp/lisp-cp/lisp_types_api.c
index e966f625677..795bd15f3e2 100644
--- a/src/vnet/lisp-cp/lisp_types_api.c
+++ b/src/plugins/lisp/lisp-cp/lisp_types_api.c
@@ -16,7 +16,7 @@
*------------------------------------------------------------------
*/
-#include <vnet/lisp-cp/lisp_types_api.h>
+#include <lisp/lisp-cp/lisp_types_api.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/ethernet/ethernet_types_api.h>
diff --git a/src/vnet/lisp-cp/lisp_types_api.h b/src/plugins/lisp/lisp-cp/lisp_types_api.h
index c1aa9dc81ff..6f48281d81f 100644
--- a/src/vnet/lisp-cp/lisp_types_api.h
+++ b/src/plugins/lisp/lisp-cp/lisp_types_api.h
@@ -16,8 +16,8 @@
*------------------------------------------------------------------
*/
-#include <vnet/lisp-cp/lisp_types.h>
-#include <vnet/lisp-cp/lisp.api_types.h>
+#include <lisp/lisp-cp/lisp_types.h>
+#include <lisp/lisp-cp/lisp.api_types.h>
int unformat_lisp_eid_api (gid_address_t * dst, u32 vni, const vl_api_eid_t * eid);
diff --git a/src/vnet/lisp-cp/one.api b/src/plugins/lisp/lisp-cp/one.api
index be3a444e263..4df5faf5a5f 100644
--- a/src/vnet/lisp-cp/one.api
+++ b/src/plugins/lisp/lisp-cp/one.api
@@ -16,7 +16,7 @@
option version = "2.0.0";
import "vnet/interface_types.api";
-import "vnet/lisp-cp/lisp_types.api";
+import "plugins/lisp/lisp-cp/lisp_types.api";
/** \brief add or delete locator_set
@param client_index - opaque cookie to identify the sender
@@ -26,7 +26,7 @@ import "vnet/lisp-cp/lisp_types.api";
@param locator_num - number of locators
@param locators - locator records
*/
-manual_endian manual_print define one_add_del_locator_set
+define one_add_del_locator_set
{
u32 client_index;
u32 context;
@@ -355,7 +355,7 @@ define show_one_map_request_mode_reply
@param rloc_num - number of remote locators
@param rlocs - remote locator records
*/
-autoreply manual_print manual_endian define one_add_del_remote_mapping
+autoreply define one_add_del_remote_mapping
{
u32 client_index;
u32 context;
@@ -410,7 +410,7 @@ define one_l2_arp_entries_get
@param count - number of elements in the list
@param vl_api_one_arp_entry_t - list of entries
*/
-manual_print manual_endian define one_l2_arp_entries_get_reply
+define one_l2_arp_entries_get_reply
{
u32 context;
i32 retval;
@@ -441,7 +441,7 @@ define one_ndp_entries_get
u32 bd;
};
-manual_print manual_endian define one_ndp_entries_get_reply
+define one_ndp_entries_get_reply
{
u32 context;
i32 retval;
@@ -491,7 +491,7 @@ define one_ndp_bd_get
@param count - number of elements in the list
@param bridge_domains - list of BDs
*/
-manual_print manual_endian define one_ndp_bd_get_reply
+define one_ndp_bd_get_reply
{
u32 context;
i32 retval;
@@ -514,7 +514,7 @@ define one_l2_arp_bd_get
@param count - number of elements in the list
@param bridge_domains - list of BDs
*/
-manual_print manual_endian define one_l2_arp_bd_get_reply
+define one_l2_arp_bd_get_reply
{
u32 context;
i32 retval;
@@ -708,7 +708,7 @@ typedef one_adjacency
@param count - number of adjacencies
@param adjacencies - array of adjacencies
*/
-manual_endian manual_print define one_adjacencies_get_reply
+define one_adjacencies_get_reply
{
u32 context;
i32 retval;
diff --git a/src/vnet/lisp-cp/one_api.c b/src/plugins/lisp/lisp-cp/one_api.c
index 452a756ee80..eb0b4c691b7 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/plugins/lisp/lisp-cp/one_api.c
@@ -22,43 +22,22 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/ethernet/ethernet_types_api.h>
-#include <vnet/vnet_msg_enum.h>
+/* define message IDs */
+#include <vnet/format_fns.h>
+#include <lisp/lisp-cp/one.api_enum.h>
+#include <lisp/lisp-cp/one.api_types.h>
-#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_api_one_add_del_l2_arp_entry vl_noop_handler
-#define vl_api_one_l2_arp_bd_get vl_noop_handler
-
-#define vl_api_one_ndp_entries_get_reply_t_endian vl_noop_handler
-#define vl_api_one_ndp_entries_get_reply_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
+/**
+ * Base message ID fot the plugin
+ */
+static u32 one_base_msg_id;
+#define REPLY_MSG_ID_BASE one_base_msg_id
#include <vlibapi/api_helper_macros.h>
@@ -1695,43 +1674,28 @@ vl_api_one_show_petr_mode_t_handler (vl_api_one_show_petr_mode_t * mp)
* 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_one;
-#undef _
-}
+#include <lisp/lisp-cp/one.api.c>
static clib_error_t *
one_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = vlibapi_get_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);
+ one_base_msg_id = setup_message_id_table ();
return 0;
}
VLIB_API_INIT_FUNCTION (one_api_hookup);
+#include <vlib/unix/plugin.h>
+#include <vpp/app/version.h>
+
+/* *INDENT-OFF* */
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "Locator ID Separation Protocol (LISP)",
+};
+/* *INDENT-ON* */
+
/*
* fd.io coding-style-patch-verification: ON
*
diff --git a/src/vnet/lisp-cp/one_cli.c b/src/plugins/lisp/lisp-cp/one_cli.c
index 70de0c1a554..b43532684ef 100644
--- a/src/vnet/lisp-cp/one_cli.c
+++ b/src/plugins/lisp/lisp-cp/one_cli.c
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
static clib_error_t *
lisp_show_adjacencies_command_fn (vlib_main_t * vm,
diff --git a/src/plugins/lisp/lisp-cp/one_test.c b/src/plugins/lisp/lisp-cp/one_test.c
new file mode 100644
index 00000000000..42554576fa0
--- /dev/null
+++ b/src/plugins/lisp/lisp-cp/one_test.c
@@ -0,0 +1,3101 @@
+/*
+ * Copyright (c) 2015 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 <vat/vat.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+#include <vppinfra/error.h>
+
+#include <vnet/ip/ip_format_fns.h>
+#include <vnet/ethernet/ethernet_format_fns.h>
+#include <lisp/lisp-cp/lisp_types.h>
+
+/* define message IDs */
+#include <lisp/lisp-cp/one.api_enum.h>
+#include <lisp/lisp-cp/one.api_types.h>
+#include <vpp/api/vpe.api_types.h>
+
+typedef struct
+{
+ /* API message ID base */
+ u16 msg_id_base;
+ u32 ping_id;
+ vat_main_t *vat_main;
+} one_test_main_t;
+
+one_test_main_t one_test_main;
+
+#define __plugin_msg_base one_test_main.msg_id_base
+#include <vlibapi/vat_helper_macros.h>
+
+/* Macro to finish up custom dump fns */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
+#define LISP_PING(_lm, mp_ping) \
+ if (!(_lm)->ping_id) \
+ (_lm)->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC)); \
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping)); \
+ mp_ping->_vl_msg_id = htons ((_lm)->ping_id); \
+ mp_ping->client_index = vam->my_client_index; \
+ fformat (vam->ofp, "Sending ping id=%d\n", (_lm)->ping_id); \
+ vam->result_ready = 0; \
+
+typedef struct
+{
+ u32 spi;
+ u8 si;
+} __attribute__ ((__packed__)) lisp_nsh_api_t;
+
+static uword
+unformat_nsh_address (unformat_input_t * input, va_list * args)
+{
+ lisp_nsh_api_t *nsh = va_arg (*args, lisp_nsh_api_t *);
+ return unformat (input, "SPI:%d SI:%d", &nsh->spi, &nsh->si);
+}
+
+static u8 *
+format_nsh_address_vat (u8 * s, va_list * args)
+{
+ nsh_t *a = va_arg (*args, nsh_t *);
+ return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si);
+}
+
+static u8 *
+format_lisp_transport_protocol (u8 * s, va_list * args)
+{
+ u32 proto = va_arg (*args, u32);
+
+ switch (proto)
+ {
+ case 1:
+ return format (s, "udp");
+ case 2:
+ return format (s, "api");
+ default:
+ return 0;
+ }
+ return 0;
+}
+
+static void
+vl_api_one_locator_details_t_handler (vl_api_one_locator_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *s = 0;
+
+ if (mp->local)
+ {
+ s = format (s, "%=16d%=16d%=16d",
+ ntohl (mp->sw_if_index), mp->priority, mp->weight);
+ }
+ else
+ {
+ s = format (s, "%=16U%=16d%=16d",
+ format_ip46_address,
+ mp->ip_address, mp->priority, mp->weight);
+ }
+
+ print (vam->ofp, "%v", s);
+ vec_free (s);
+}
+
+static void
+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;
+
+ ls_name = format (0, "%s", mp->ls_name);
+
+ print (vam->ofp, "%=10d%=15v", clib_net_to_host_u32 (mp->ls_index),
+ ls_name);
+ vec_free (ls_name);
+}
+
+static void vl_api_one_get_transport_protocol_reply_t_handler
+ (vl_api_one_get_transport_protocol_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ u32 proto = mp->protocol;
+ print (vam->ofp, "Transport protocol: %U",
+ format_lisp_transport_protocol, proto);
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+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);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+static u8 *
+format_lisp_flat_eid (u8 * s, va_list * args)
+{
+ vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
+
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (eid->address.prefix.address.af)
+ return format (s, "%U/%d", format_ip6_address,
+ eid->address.prefix.address.un.ip6,
+ eid->address.prefix.len);
+ return format (s, "%U/%d", format_ip4_address,
+ eid->address.prefix.address.un.ip4,
+ eid->address.prefix.len);
+ case EID_TYPE_API_MAC:
+ return format (s, "%U", format_ethernet_address, eid->address.mac);
+ case EID_TYPE_API_NSH:
+ return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
+ }
+ return 0;
+}
+
+static u8 *
+format_lisp_eid_vat (u8 * s, va_list * args)
+{
+ vl_api_eid_t *deid = va_arg (*args, vl_api_eid_t *);
+ vl_api_eid_t *seid = va_arg (*args, vl_api_eid_t *);
+ u8 is_src_dst = (u8) va_arg (*args, int);
+
+ if (is_src_dst)
+ s = format (s, "%U|", format_lisp_flat_eid, seid);
+
+ s = format (s, "%U", format_lisp_flat_eid, deid);
+
+ return s;
+}
+
+static void
+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;
+
+ if (~0 == mp->locator_set_index)
+ s = format (0, "action: %d", mp->action);
+ else
+ s = format (0, "%d", clib_net_to_host_u32 (mp->locator_set_index));
+
+ eid = format (0, "%U", format_lisp_eid_vat,
+ &mp->deid, &mp->seid, mp->is_src_dst);
+ vec_add1 (eid, 0);
+
+ print (vam->ofp, "[%d] %-35s%-20s%-30s%-20d%-20d%-10d%-20s",
+ clib_net_to_host_u32 (mp->vni),
+ eid,
+ mp->is_local ? "local" : "remote",
+ s, clib_net_to_host_u32 (mp->ttl), mp->authoritative,
+ clib_net_to_host_u16 (mp->key.id), mp->key.key);
+
+ vec_free (s);
+ vec_free (eid);
+}
+
+static void
+vl_api_one_stats_details_t_handler (vl_api_one_stats_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *seid = 0, *deid = 0;
+ ip46_address_t lloc, rloc;
+
+ deid = format (0, "%U", format_lisp_eid_vat, &mp->deid, 0, 0);
+
+ seid = format (0, "%U", format_lisp_eid_vat, &mp->seid, 0, 0);
+
+ vec_add1 (deid, 0);
+ vec_add1 (seid, 0);
+
+ if (mp->lloc.af)
+ {
+ clib_memcpy (&lloc.ip6, mp->lloc.un.ip6, 16);
+ clib_memcpy (&rloc.ip6, mp->rloc.un.ip6, 16);
+ }
+ else
+ {
+ clib_memcpy (&lloc.ip4, mp->lloc.un.ip4, 4);
+ clib_memcpy (&rloc.ip4, mp->rloc.un.ip4, 4);
+ }
+
+
+ print (vam->ofp, "([%d] %s %s) (%U %U) %u %u",
+ clib_net_to_host_u32 (mp->vni),
+ seid, deid,
+ format_ip46_address, lloc,
+ format_ip46_address, rloc,
+ clib_net_to_host_u32 (mp->pkt_count),
+ clib_net_to_host_u32 (mp->bytes));
+
+ vec_free (deid);
+ vec_free (seid);
+}
+
+static void
+ vl_api_one_eid_table_map_details_t_handler
+ (vl_api_one_eid_table_map_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ u8 *line = format (0, "%=10d%=10d",
+ clib_net_to_host_u32 (mp->vni),
+ clib_net_to_host_u32 (mp->dp_table));
+ print (vam->ofp, "%v", line);
+ vec_free (line);
+}
+
+static void
+ vl_api_one_eid_table_vni_details_t_handler
+ (vl_api_one_eid_table_vni_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ u8 *line = format (0, "%d", clib_net_to_host_u32 (mp->vni));
+ print (vam->ofp, "%v", line);
+ vec_free (line);
+}
+
+static void
+ vl_api_show_one_map_register_fallback_threshold_reply_t_handler
+ (vl_api_show_one_map_register_fallback_threshold_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ print (vam->ofp, "fallback threshold value: %d", mp->value);
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ 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);
+
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ 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);
+
+ if (retval)
+ goto end;
+
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_one_stats_enable_disable_reply_t_handler
+ (vl_api_show_one_stats_enable_disable_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_ndp_entries_get_reply_t_handler
+ (vl_api_one_ndp_entries_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ print (vam->ofp, "%U -> %U", format_ip6_address, &mp->entries[i].ip6,
+ format_ethernet_address, mp->entries[i].mac);
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_l2_arp_entries_get_reply_t_handler
+ (vl_api_one_l2_arp_entries_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ print (vam->ofp, "%U -> %U", format_ip4_address, &mp->entries[i].ip4,
+ format_ethernet_address, mp->entries[i].mac);
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_one_ndp_bd_get_reply_t_handler (vl_api_one_ndp_bd_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ {
+ print (vam->ofp, "%d", clib_net_to_host_u32 (mp->bridge_domains[i]));
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_l2_arp_bd_get_reply_t_handler
+ (vl_api_one_l2_arp_bd_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ {
+ print (vam->ofp, "%d", clib_net_to_host_u32 (mp->bridge_domains[i]));
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ 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_one_adjacency_t *a;
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ {
+ a = &mp->adjacencies[i];
+ print (vam->ofp, "%U %40U",
+ format_lisp_flat_eid, a->leid, format_lisp_flat_eid, a->reid);
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+vl_api_one_map_server_details_t_handler (vl_api_one_map_server_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "%=20U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+}
+
+static void
+vl_api_one_map_resolver_details_t_handler (vl_api_one_map_resolver_details_t
+ * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "%=20U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+}
+
+static void
+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);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "feature: %s\ngpe: %s",
+ mp->feature_status ? "enabled" : "disabled",
+ mp->gpe_status ? "enabled" : "disabled");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ 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);
+
+ if (retval >= 0)
+ {
+ print (vam->ofp, "%=20s", mp->locator_set_name);
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+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 void
+ 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);
+
+ if (0 <= retval)
+ {
+ u32 mode = mp->mode;
+ print (vam->ofp, "map_request_mode: %U",
+ format_lisp_map_request_mode, mode);
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_show_xtr_mode_reply_t_handler
+ (vl_api_one_show_xtr_mode_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_show_pitr_mode_reply_t_handler
+ (vl_api_one_show_pitr_mode_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_one_show_petr_mode_reply_t_handler
+ (vl_api_one_show_petr_mode_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_one_use_petr_reply_t_handler
+ (vl_api_show_one_use_petr_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%s\n", mp->status ? "enabled" : "disabled");
+ if (mp->status)
+ {
+ print (vam->ofp, "Proxy-ETR address; %U",
+ mp->ip_address.af ? format_ip6_address : format_ip4_address,
+ mp->ip_address.un);
+ }
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_one_nsh_mapping_reply_t_handler
+ (vl_api_show_one_nsh_mapping_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%-20s%-16s",
+ mp->is_set ? "set" : "not-set",
+ mp->is_set ? (char *) mp->locator_set_name : "");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_show_one_map_register_ttl_reply_t_handler
+ (vl_api_show_one_map_register_ttl_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "ttl: %u", mp->ttl);
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+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);
+
+ if (0 <= retval)
+ {
+ print (vam->ofp, "%-20s%-16s",
+ mp->status ? "enabled" : "disabled",
+ mp->status ? (char *) mp->locator_set_name : "");
+ }
+
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+/* *INDENT-OFF* */
+/** Used for parsing LISP eids */
+typedef CLIB_PACKED(struct{
+ union {
+ ip46_address_t ip;
+ mac_address_t mac;
+ lisp_nsh_api_t nsh;
+ } addr;
+ u32 len; /**< prefix length if IP */
+ u8 type; /**< type of eid */
+}) lisp_eid_vat_t;
+/* *INDENT-ON* */
+
+static uword
+unformat_lisp_eid_vat (unformat_input_t * input, va_list * args)
+{
+ lisp_eid_vat_t *a = va_arg (*args, lisp_eid_vat_t *);
+
+ clib_memset (a, 0, sizeof (a[0]));
+
+ if (unformat (input, "%U/%d", unformat_ip46_address, a->addr.ip, &a->len))
+ {
+ a->type = 0; /* ip prefix type */
+ }
+ else if (unformat (input, "%U", unformat_ethernet_address, &a->addr.mac))
+ {
+ a->type = 1; /* mac type */
+ }
+ else if (unformat (input, "%U", unformat_nsh_address, a->addr.nsh))
+ {
+ a->type = 2; /* NSH type */
+ a->addr.nsh.spi = clib_host_to_net_u32 (a->addr.nsh.spi);
+ }
+ else
+ {
+ return 0;
+ }
+
+ if (a->type == 0)
+ {
+ if (ip46_address_is_ip4 (&a->addr.ip))
+ return a->len > 32 ? 1 : 0;
+ else
+ return a->len > 128 ? 1 : 0;
+ }
+
+ return 1;
+}
+
+static void
+lisp_eid_put_vat (vl_api_eid_t * eid, const lisp_eid_vat_t * vat_eid)
+{
+ eid->type = vat_eid->type;
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (ip46_address_is_ip4 (&vat_eid->addr.ip))
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip4,
+ &vat_eid->addr.ip.ip4, 4);
+ eid->address.prefix.address.af = ADDRESS_IP4;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ else
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip6,
+ &vat_eid->addr.ip.ip6, 16);
+ eid->address.prefix.address.af = ADDRESS_IP6;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ return;
+ case EID_TYPE_API_MAC:
+ clib_memcpy (&eid->address.mac, &vat_eid->addr.mac,
+ sizeof (eid->address.mac));
+ return;
+ case EID_TYPE_API_NSH:
+ clib_memcpy (&eid->address.nsh, &vat_eid->addr.nsh,
+ sizeof (eid->address.nsh));
+ return;
+ default:
+ ASSERT (0);
+ return;
+ }
+}
+
+static int
+api_one_add_del_locator_set (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_locator_set_t *mp;
+ u8 is_add = 1;
+ u8 *locator_set_name = NULL;
+ u8 locator_set_name_set = 0;
+ vl_api_local_locator_t locator, *locators = 0;
+ u32 sw_if_index, priority, weight;
+ u32 data_len = 0;
+
+ int ret;
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "sw_if_index %u p %u w %u",
+ &sw_if_index, &priority, &weight))
+ {
+ locator.sw_if_index = htonl (sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1 (locators, locator);
+ }
+ else
+ if (unformat
+ (input, "iface %U p %u w %u", unformat_sw_if_index, vam,
+ &sw_if_index, &priority, &weight))
+ {
+ locator.sw_if_index = htonl (sw_if_index);
+ locator.priority = priority;
+ locator.weight = weight;
+ vec_add1 (locators, locator);
+ }
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ vec_free (locators);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ vec_free (locators);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ data_len = sizeof (vl_api_local_locator_t) * vec_len (locators);
+
+ /* Construct the API message */
+ M2 (ONE_ADD_DEL_LOCATOR_SET, mp, data_len);
+
+ mp->is_add = is_add;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ vec_free (locator_set_name);
+
+ mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
+ if (locators)
+ clib_memcpy (mp->locators, locators, data_len);
+ vec_free (locators);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_locator_set api_one_add_del_locator_set
+
+static int
+api_one_add_del_locator (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_locator_t *mp;
+ u32 tmp_if_index = ~0;
+ u32 sw_if_index = ~0;
+ u8 sw_if_index_set = 0;
+ u8 sw_if_index_if_name_set = 0;
+ u32 priority = ~0;
+ u8 priority_set = 0;
+ u32 weight = ~0;
+ u8 weight_set = 0;
+ u8 is_add = 1;
+ u8 *locator_set_name = NULL;
+ u8 locator_set_name_set = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "iface %U", unformat_sw_if_index, vam,
+ &tmp_if_index))
+ {
+ sw_if_index_if_name_set = 1;
+ sw_if_index = tmp_if_index;
+ }
+ else if (unformat (input, "sw_if_index %d", &tmp_if_index))
+ {
+ sw_if_index_set = 1;
+ sw_if_index = tmp_if_index;
+ }
+ else if (unformat (input, "p %d", &priority))
+ {
+ priority_set = 1;
+ }
+ else if (unformat (input, "w %d", &weight))
+ {
+ weight_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ return -99;
+ }
+
+ if (sw_if_index_set == 0 && sw_if_index_if_name_set == 0)
+ {
+ errmsg ("missing sw_if_index");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (sw_if_index_set != 0 && sw_if_index_if_name_set != 0)
+ {
+ errmsg ("cannot use both params interface name and sw_if_index");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (priority_set == 0)
+ {
+ errmsg ("missing locator-set priority");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (weight_set == 0)
+ {
+ errmsg ("missing locator-set weight");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ /* Construct the API message */
+ M (ONE_ADD_DEL_LOCATOR, mp);
+
+ mp->is_add = is_add;
+ mp->sw_if_index = ntohl (sw_if_index);
+ mp->priority = priority;
+ mp->weight = weight;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ vec_free (locator_set_name);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_locator api_one_add_del_locator
+
+static int
+api_one_add_del_local_eid (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_local_eid_t *mp;
+ u8 is_add = 1;
+ u8 eid_set = 0;
+ lisp_eid_vat_t _eid, *eid = &_eid;
+ u8 *locator_set_name = 0;
+ u8 locator_set_name_set = 0;
+ u32 vni = 0;
+ u16 key_id = 0;
+ u8 *key = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
+ {
+ eid_set = 1;
+ }
+ else if (unformat (input, "locator-set %s", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else if (unformat (input, "key-id %U", unformat_hmac_key_id, &key_id))
+ ;
+ else if (unformat (input, "secret-key %_%v%_", &key))
+ ;
+ else
+ break;
+ }
+
+ if (locator_set_name_set == 0)
+ {
+ errmsg ("missing locator-set name");
+ return -99;
+ }
+
+ if (0 == eid_set)
+ {
+ errmsg ("EID address not set!");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ if (key && (0 == key_id))
+ {
+ errmsg ("invalid key_id!");
+ return -99;
+ }
+
+ if (vec_len (key) > 64)
+ {
+ errmsg ("key too long");
+ vec_free (key);
+ return -99;
+ }
+
+ if (vec_len (locator_set_name) > 64)
+ {
+ errmsg ("locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+ vec_add1 (locator_set_name, 0);
+
+ /* Construct the API message */
+ M (ONE_ADD_DEL_LOCAL_EID, mp);
+
+ mp->is_add = is_add;
+ lisp_eid_put_vat (&mp->eid, eid);
+ mp->vni = clib_host_to_net_u32 (vni);
+ mp->key.id = key_id;
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ clib_memcpy (mp->key.key, key, vec_len (key));
+
+ vec_free (locator_set_name);
+ vec_free (key);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_add_del_map_server (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_map_server_t *mp;
+ u8 is_add = 1;
+ u8 ipv4_set = 0;
+ u8 ipv6_set = 0;
+ ip4_address_t ipv4;
+ ip6_address_t ipv6;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
+ {
+ ipv4_set = 1;
+ }
+ else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
+ {
+ ipv6_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (ipv4_set && ipv6_set)
+ {
+ errmsg ("both eid v4 and v6 addresses set");
+ return -99;
+ }
+
+ if (!ipv4_set && !ipv6_set)
+ {
+ errmsg ("eid addresses not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ADD_DEL_MAP_SERVER, mp);
+
+ mp->is_add = is_add;
+ if (ipv6_set)
+ {
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
+ }
+ else
+ {
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip4, &ipv4, sizeof (ipv4));
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_map_server api_one_add_del_map_server
+
+static int
+api_one_add_del_map_resolver (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_map_resolver_t *mp;
+ u8 is_add = 1;
+ u8 ipv4_set = 0;
+ u8 ipv6_set = 0;
+ ip4_address_t ipv4;
+ ip6_address_t ipv6;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
+ {
+ ipv4_set = 1;
+ }
+ else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
+ {
+ ipv6_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (ipv4_set && ipv6_set)
+ {
+ errmsg ("both eid v4 and v6 addresses set");
+ return -99;
+ }
+
+ if (!ipv4_set && !ipv6_set)
+ {
+ errmsg ("eid addresses not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ADD_DEL_MAP_RESOLVER, mp);
+
+ mp->is_add = is_add;
+ if (ipv6_set)
+ {
+ mp->ip_address.af = 1;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
+ }
+ else
+ {
+ mp->ip_address.af = 0;
+ clib_memcpy (mp->ip_address.un.ip6, &ipv4, sizeof (ipv4));
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_rloc_probe_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_rloc_probe_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ is_set = 1;
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_RLOC_PROBE_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_rloc_probe_enable_disable api_one_rloc_probe_enable_disable
+
+static int
+api_one_map_register_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_map_register_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ is_set = 1;
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_MAP_REGISTER_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_map_register_enable_disable api_one_map_register_enable_disable
+
+static int
+api_one_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_enable_disable api_one_enable_disable
+
+static int
+api_one_enable_disable_xtr_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_enable_disable_xtr_mode_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ENABLE_DISABLE_XTR_MODE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_show_xtr_mode (vat_main_t * vam)
+{
+ vl_api_one_show_xtr_mode_t *mp;
+ int ret;
+
+ /* Construct the API message */
+ M (ONE_SHOW_XTR_MODE, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_enable_disable_pitr_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_enable_disable_pitr_mode_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ENABLE_DISABLE_PITR_MODE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_show_pitr_mode (vat_main_t * vam)
+{
+ vl_api_one_show_pitr_mode_t *mp;
+ int ret;
+
+ /* Construct the API message */
+ M (ONE_SHOW_PITR_MODE, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_enable_disable_petr_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_enable_disable_petr_mode_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (ONE_ENABLE_DISABLE_PETR_MODE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_show_petr_mode (vat_main_t * vam)
+{
+ vl_api_one_show_petr_mode_t *mp;
+ int ret;
+
+ /* Construct the API message */
+ M (ONE_SHOW_PETR_MODE, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_map_register_state (vat_main_t * vam)
+{
+ vl_api_show_one_map_register_state_t *mp;
+ int ret;
+
+ M (SHOW_ONE_MAP_REGISTER_STATE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_show_lisp_map_register_state api_show_one_map_register_state
+
+static int
+api_show_one_rloc_probe_state (vat_main_t * vam)
+{
+ vl_api_show_one_rloc_probe_state_t *mp;
+ int ret;
+
+ M (SHOW_ONE_RLOC_PROBE_STATE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_show_lisp_rloc_probe_state api_show_one_rloc_probe_state
+
+static int
+api_one_add_del_ndp_entry (vat_main_t * vam)
+{
+ vl_api_one_add_del_ndp_entry_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 is_add = 1;
+ u8 mac_set = 0;
+ u8 bd_set = 0;
+ u8 ip_set = 0;
+ u8 mac[6] = { 0, };
+ u8 ip6[16] = { 0, };
+ u32 bd = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "mac %U", unformat_ethernet_address, mac))
+ mac_set = 1;
+ else if (unformat (input, "ip %U", unformat_ip6_address, ip6))
+ ip_set = 1;
+ else if (unformat (input, "bd %d", &bd))
+ bd_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!bd_set || !ip_set || (!mac_set && is_add))
+ {
+ errmsg ("Missing BD, IP or MAC!");
+ return -99;
+ }
+
+ M (ONE_ADD_DEL_NDP_ENTRY, mp);
+ mp->is_add = is_add;
+ clib_memcpy (&mp->entry.mac, mac, 6);
+ mp->bd = clib_host_to_net_u32 (bd);
+ clib_memcpy (&mp->entry.ip6, ip6, sizeof (mp->entry.ip6));
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_add_del_l2_arp_entry (vat_main_t * vam)
+{
+ vl_api_one_add_del_l2_arp_entry_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 is_add = 1;
+ u8 mac_set = 0;
+ u8 bd_set = 0;
+ u8 ip_set = 0;
+ u8 mac[6] = { 0, };
+ u32 ip4 = 0, bd = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "mac %U", unformat_ethernet_address, mac))
+ mac_set = 1;
+ else if (unformat (input, "ip %U", unformat_ip4_address, &ip4))
+ ip_set = 1;
+ else if (unformat (input, "bd %d", &bd))
+ bd_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!bd_set || !ip_set || (!mac_set && is_add))
+ {
+ errmsg ("Missing BD, IP or MAC!");
+ return -99;
+ }
+
+ M (ONE_ADD_DEL_L2_ARP_ENTRY, mp);
+ mp->is_add = is_add;
+ clib_memcpy (&mp->entry.mac, mac, 6);
+ mp->bd = clib_host_to_net_u32 (bd);
+ clib_memcpy (mp->entry.ip4, &ip4, sizeof (mp->entry.ip4));
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_ndp_bd_get (vat_main_t * vam)
+{
+ vl_api_one_ndp_bd_get_t *mp;
+ int ret;
+
+ M (ONE_NDP_BD_GET, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_ndp_entries_get (vat_main_t * vam)
+{
+ vl_api_one_ndp_entries_get_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 bd_set = 0;
+ u32 bd = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "bd %d", &bd))
+ bd_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!bd_set)
+ {
+ errmsg ("Expected bridge domain!");
+ return -99;
+ }
+
+ M (ONE_NDP_ENTRIES_GET, mp);
+ mp->bd = clib_host_to_net_u32 (bd);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_l2_arp_bd_get (vat_main_t * vam)
+{
+ vl_api_one_l2_arp_bd_get_t *mp;
+ int ret;
+
+ M (ONE_L2_ARP_BD_GET, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_l2_arp_entries_get (vat_main_t * vam)
+{
+ vl_api_one_l2_arp_entries_get_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 bd_set = 0;
+ u32 bd = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "bd %d", &bd))
+ bd_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!bd_set)
+ {
+ errmsg ("Expected bridge domain!");
+ return -99;
+ }
+
+ M (ONE_L2_ARP_ENTRIES_GET, mp);
+ mp->bd = clib_host_to_net_u32 (bd);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_stats_enable_disable (vat_main_t * vam)
+{
+ vl_api_one_stats_enable_disable_t *mp;
+ unformat_input_t *input = vam->input;
+ u8 is_set = 0;
+ u8 is_enable = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ M (ONE_STATS_ENABLE_DISABLE, mp);
+ mp->is_enable = is_enable;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_stats_enable_disable (vat_main_t * vam)
+{
+ vl_api_show_one_stats_enable_disable_t *mp;
+ int ret;
+
+ M (SHOW_ONE_STATS_ENABLE_DISABLE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_map_request_mode (vat_main_t * vam)
+{
+ vl_api_show_one_map_request_mode_t *mp;
+ int ret;
+
+ M (SHOW_ONE_MAP_REQUEST_MODE, mp);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_show_lisp_map_request_mode api_show_one_map_request_mode
+
+static int
+api_one_map_request_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_map_request_mode_t *mp;
+ u8 mode = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "dst-only"))
+ mode = 0;
+ else if (unformat (input, "src-dst"))
+ mode = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ M (ONE_MAP_REQUEST_MODE, mp);
+
+ mp->mode = mode;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_map_request_mode api_one_map_request_mode
+
+/**
+ * Enable/disable ONE proxy ITR.
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_one_pitr_set_locator_set (vat_main_t * vam)
+{
+ u8 ls_name_set = 0;
+ unformat_input_t *input = vam->input;
+ vl_api_one_pitr_set_locator_set_t *mp;
+ u8 is_add = 1;
+ u8 *ls_name = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "locator-set %s", &ls_name))
+ ls_name_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!ls_name_set)
+ {
+ errmsg ("locator-set name not set!");
+ return -99;
+ }
+
+ M (ONE_PITR_SET_LOCATOR_SET, mp);
+
+ mp->is_add = is_add;
+ clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
+ vec_free (ls_name);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_pitr_set_locator_set api_one_pitr_set_locator_set
+
+static int
+api_one_nsh_set_locator_set (vat_main_t * vam)
+{
+ u8 ls_name_set = 0;
+ unformat_input_t *input = vam->input;
+ vl_api_one_nsh_set_locator_set_t *mp;
+ u8 is_add = 1;
+ u8 *ls_name = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "ls %s", &ls_name))
+ ls_name_set = 1;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!ls_name_set && is_add)
+ {
+ errmsg ("locator-set name not set!");
+ return -99;
+ }
+
+ M (ONE_NSH_SET_LOCATOR_SET, mp);
+
+ mp->is_add = is_add;
+ clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
+ vec_free (ls_name);
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_pitr (vat_main_t * vam)
+{
+ vl_api_show_one_pitr_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "lisp status:");
+ }
+
+ M (SHOW_ONE_PITR, mp);
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_show_lisp_pitr api_show_one_pitr
+
+static int
+api_one_use_petr (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_use_petr_t *mp;
+ u8 is_add = 0;
+ ip_address_t ip;
+ int ret;
+
+ clib_memset (&ip, 0, sizeof (ip));
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "disable"))
+ is_add = 0;
+ else
+ if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (&ip)))
+ {
+ is_add = 1;
+ ip_addr_version (&ip) = AF_IP4;
+ }
+ else
+ if (unformat (input, "%U", unformat_ip6_address, &ip_addr_v6 (&ip)))
+ {
+ is_add = 1;
+ ip_addr_version (&ip) = AF_IP6;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ M (ONE_USE_PETR, mp);
+
+ mp->is_add = is_add;
+ if (is_add)
+ {
+ mp->ip_address.af = ip_addr_version (&ip) == AF_IP4 ? 0 : 1;
+ if (mp->ip_address.af)
+ clib_memcpy (mp->ip_address.un.ip6, &ip, 16);
+ else
+ clib_memcpy (mp->ip_address.un.ip4, &ip, 4);
+ }
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_use_petr api_one_use_petr
+
+static int
+api_show_one_nsh_mapping (vat_main_t * vam)
+{
+ vl_api_show_one_use_petr_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "local ONE NSH mapping:");
+ }
+
+ M (SHOW_ONE_NSH_MAPPING, mp);
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_use_petr (vat_main_t * vam)
+{
+ vl_api_show_one_use_petr_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Proxy-ETR status:");
+ }
+
+ M (SHOW_ONE_USE_PETR, mp);
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_show_lisp_use_petr api_show_one_use_petr
+
+/**
+ * Add/delete mapping between vni and vrf
+ */
+static int
+api_one_eid_table_add_del_map (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ 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;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "vrf %d", &vrf))
+ vrf_set = 1;
+ else if (unformat (input, "bd_index %d", &bd_index))
+ bd_index_set = 1;
+ else if (unformat (input, "vni %d", &vni))
+ vni_set = 1;
+ else
+ break;
+ }
+
+ if (!vni_set || (!vrf_set && !bd_index_set))
+ {
+ errmsg ("missing arguments!");
+ return -99;
+ }
+
+ if (vrf_set && bd_index_set)
+ {
+ errmsg ("error: both vrf and bd entered!");
+ return -99;
+ }
+
+ M (ONE_EID_TABLE_ADD_DEL_MAP, mp);
+
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ mp->dp_table = vrf_set ? htonl (vrf) : htonl (bd_index);
+ mp->is_l2 = bd_index_set;
+
+ /* send */
+ S (mp);
+
+ /* wait for reply */
+ W (ret);
+ 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)
+{
+ u32 *action = va_arg (*args, u32 *);
+ u8 *s = 0;
+
+ if (unformat (input, "%s", &s))
+ {
+ if (!strcmp ((char *) s, "no-action"))
+ action[0] = 0;
+ else if (!strcmp ((char *) s, "natively-forward"))
+ action[0] = 1;
+ else if (!strcmp ((char *) s, "send-map-request"))
+ action[0] = 2;
+ else if (!strcmp ((char *) s, "drop"))
+ action[0] = 3;
+ else
+ {
+ clib_warning ("invalid action: '%s'", s);
+ action[0] = 3;
+ }
+ }
+ else
+ return 0;
+
+ vec_free (s);
+ return 1;
+}
+
+/**
+ * Add/del remote mapping to/from ONE control plane
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_one_add_del_remote_mapping (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ 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;
+ u8 is_add = 1, del_all = 0, eid_set = 0, seid_set = 0;
+ u32 action = ~0, p, w, data_len;
+ ip4_address_t rloc4;
+ ip6_address_t rloc6;
+ vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
+ int ret;
+
+ clib_memset (&rloc, 0, sizeof (rloc));
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del-all"))
+ {
+ del_all = 1;
+ }
+ else if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "add"))
+ {
+ is_add = 1;
+ }
+ else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
+ {
+ eid_set = 1;
+ }
+ else if (unformat (input, "seid %U", unformat_lisp_eid_vat, seid))
+ {
+ seid_set = 1;
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else if (unformat (input, "p %d w %d", &p, &w))
+ {
+ if (!curr_rloc)
+ {
+ errmsg ("No RLOC configured for setting priority/weight!");
+ return -99;
+ }
+ curr_rloc->priority = p;
+ curr_rloc->weight = w;
+ }
+ else if (unformat (input, "rloc %U", unformat_ip4_address, &rloc4))
+ {
+ rloc.ip_address.af = 0;
+ clib_memcpy (&rloc.ip_address.un.ip6, &rloc6, sizeof (rloc6));
+ vec_add1 (rlocs, rloc);
+ curr_rloc = &rlocs[vec_len (rlocs) - 1];
+ }
+ else if (unformat (input, "rloc %U", unformat_ip6_address, &rloc6))
+ {
+ rloc.ip_address.af = 1;
+ clib_memcpy (&rloc.ip_address.un.ip4, &rloc4, sizeof (rloc4));
+ vec_add1 (rlocs, rloc);
+ curr_rloc = &rlocs[vec_len (rlocs) - 1];
+ }
+ else if (unformat (input, "action %U",
+ unformat_negative_mapping_action, &action))
+ {
+ ;
+ }
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (0 == eid_set)
+ {
+ errmsg ("missing params!");
+ return -99;
+ }
+
+ if (is_add && (~0 == action) && 0 == vec_len (rlocs))
+ {
+ errmsg ("no action set for negative map-reply!");
+ return -99;
+ }
+
+ data_len = vec_len (rlocs) * sizeof (vl_api_remote_locator_t);
+
+ M2 (ONE_ADD_DEL_REMOTE_MAPPING, mp, data_len);
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ mp->action = (u8) action;
+ mp->is_src_dst = seid_set;
+ mp->del_all = del_all;
+ lisp_eid_put_vat (&mp->deid, eid);
+ lisp_eid_put_vat (&mp->seid, seid);
+
+ mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
+ clib_memcpy (mp->rlocs, rlocs, data_len);
+ vec_free (rlocs);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_remote_mapping api_one_add_del_remote_mapping
+
+/**
+ * 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_one_add_del_adjacency (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_add_del_adjacency_t *mp;
+ u32 vni = 0;
+ u8 is_add = 1;
+ int ret;
+ lisp_eid_vat_t leid, reid;
+
+ leid.type = reid.type = (u8) ~ 0;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "add"))
+ {
+ is_add = 1;
+ }
+ else if (unformat (input, "reid %U/%d", unformat_ip46_address,
+ &reid.addr.ip, &reid.len))
+ {
+ reid.type = 0; /* ipv4 */
+ }
+ else if (unformat (input, "reid %U", unformat_ethernet_address,
+ &reid.addr.mac))
+ {
+ reid.type = 1; /* mac */
+ }
+ else if (unformat (input, "leid %U/%d", unformat_ip46_address,
+ &leid.addr.ip, &leid.len))
+ {
+ leid.type = 0; /* ipv4 */
+ }
+ else if (unformat (input, "leid %U", unformat_ethernet_address,
+ &leid.addr.mac))
+ {
+ leid.type = 1; /* mac */
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ ;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if ((u8) ~ 0 == reid.type)
+ {
+ errmsg ("missing params!");
+ return -99;
+ }
+
+ if (leid.type != reid.type)
+ {
+ errmsg ("remote and local EIDs are of different types!");
+ return -99;
+ }
+
+ M (ONE_ADD_DEL_ADJACENCY, mp);
+ mp->is_add = is_add;
+ mp->vni = htonl (vni);
+ lisp_eid_put_vat (&mp->leid, &leid);
+ lisp_eid_put_vat (&mp->reid, &reid);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_adjacency api_one_add_del_adjacency
+
+
+static int
+api_one_map_register_fallback_threshold (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_map_register_fallback_threshold_t *mp;
+ u32 value = 0;
+ u8 is_set = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "%u", &value))
+ is_set = 1;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!is_set)
+ {
+ errmsg ("fallback threshold value is missing!");
+ return -99;
+ }
+
+ M (ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp);
+ mp->value = clib_host_to_net_u32 (value);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_map_register_fallback_threshold (vat_main_t * vam)
+{
+ vl_api_show_one_map_register_fallback_threshold_t *mp;
+ int ret;
+
+ M (SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+uword
+unformat_lisp_transport_protocol (unformat_input_t * input, va_list * args)
+{
+ u32 *proto = va_arg (*args, u32 *);
+
+ if (unformat (input, "udp"))
+ *proto = 1;
+ else if (unformat (input, "api"))
+ *proto = 2;
+ else
+ return 0;
+
+ return 1;
+}
+
+static int
+api_one_set_transport_protocol (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_set_transport_protocol_t *mp;
+ u8 is_set = 0;
+ u32 protocol = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "%U", unformat_lisp_transport_protocol, &protocol))
+ is_set = 1;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!is_set)
+ {
+ errmsg ("Transport protocol missing!");
+ return -99;
+ }
+
+ M (ONE_SET_TRANSPORT_PROTOCOL, mp);
+ mp->protocol = (u8) protocol;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_get_transport_protocol (vat_main_t * vam)
+{
+ vl_api_one_get_transport_protocol_t *mp;
+ int ret;
+
+ M (ONE_GET_TRANSPORT_PROTOCOL, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_map_register_set_ttl (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_one_map_register_set_ttl_t *mp;
+ u32 ttl = 0;
+ u8 is_set = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "%u", &ttl))
+ is_set = 1;
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!is_set)
+ {
+ errmsg ("TTL value missing!");
+ return -99;
+ }
+
+ M (ONE_MAP_REGISTER_SET_TTL, mp);
+ mp->ttl = clib_host_to_net_u32 (ttl);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_map_register_ttl (vat_main_t * vam)
+{
+ vl_api_show_one_map_register_ttl_t *mp;
+ int ret;
+
+ M (SHOW_ONE_MAP_REGISTER_TTL, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+/**
+ * Add/del map request itr rlocs from ONE control plane and updates
+ *
+ * @param vam vpp API test context
+ * @return return code
+ */
+static int
+api_one_add_del_map_request_itr_rlocs (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ 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;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ {
+ is_add = 0;
+ }
+ else if (unformat (input, "%_%v%_", &locator_set_name))
+ {
+ locator_set_name_set = 1;
+ }
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (is_add && !locator_set_name_set)
+ {
+ errmsg ("itr-rloc is not set!");
+ return -99;
+ }
+
+ if (is_add && vec_len (locator_set_name) > 64)
+ {
+ errmsg ("itr-rloc locator-set name too long");
+ vec_free (locator_set_name);
+ return -99;
+ }
+
+ M (ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, mp);
+ mp->is_add = is_add;
+ if (is_add)
+ {
+ clib_memcpy (mp->locator_set_name, locator_set_name,
+ vec_len (locator_set_name));
+ }
+ else
+ {
+ clib_memset (mp->locator_set_name, 0, sizeof (mp->locator_set_name));
+ }
+ vec_free (locator_set_name);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_add_del_map_request_itr_rlocs api_one_add_del_map_request_itr_rlocs
+
+static int
+api_one_locator_dump (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ 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;
+ u32 ls_index = ~0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "ls_name %_%v%_", &ls_name))
+ {
+ is_name_set = 1;
+ }
+ else if (unformat (input, "ls_index %d", &ls_index))
+ {
+ is_index_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!is_index_set && !is_name_set)
+ {
+ errmsg ("error: expected one of index or name!");
+ return -99;
+ }
+
+ if (is_index_set && is_name_set)
+ {
+ errmsg ("error: only one param expected!");
+ return -99;
+ }
+
+ if (vec_len (ls_name) > 62)
+ {
+ errmsg ("error: locator set name too long!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=16s%=16s%=16s", "locator", "priority", "weight");
+ }
+
+ M (ONE_LOCATOR_DUMP, mp);
+ mp->is_index_set = is_index_set;
+
+ if (is_index_set)
+ mp->ls_index = clib_host_to_net_u32 (ls_index);
+ else
+ {
+ vec_add1 (ls_name, 0);
+ strncpy ((char *) mp->ls_name, (char *) ls_name,
+ sizeof (mp->ls_name) - 1);
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_locator_dump api_one_locator_dump
+
+static int
+api_one_locator_set_dump (vat_main_t * vam)
+{
+ vl_api_one_locator_set_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ unformat_input_t *input = vam->input;
+ u8 filter = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "local"))
+ {
+ filter = 1;
+ }
+ else if (unformat (input, "remote"))
+ {
+ filter = 2;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=10s%=15s", "ls_index", "ls_name");
+ }
+
+ M (ONE_LOCATOR_SET_DUMP, mp);
+
+ mp->filter = filter;
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_locator_set_dump api_one_locator_set_dump
+
+static int
+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_one_eid_table_map_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "l2"))
+ {
+ is_l2 = 1;
+ mode_set = 1;
+ }
+ else if (unformat (input, "l3"))
+ {
+ is_l2 = 0;
+ mode_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!mode_set)
+ {
+ errmsg ("expected one of 'l2' or 'l3' parameter!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF");
+ }
+
+ M (ONE_EID_TABLE_MAP_DUMP, mp);
+ mp->is_l2 = is_l2;
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_eid_table_map_dump api_one_eid_table_map_dump
+
+static int
+api_one_eid_table_vni_dump (vat_main_t * vam)
+{
+ vl_api_one_eid_table_vni_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "VNI");
+ }
+
+ M (ONE_EID_TABLE_VNI_DUMP, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_eid_table_vni_dump api_one_eid_table_vni_dump
+
+static int
+api_one_eid_table_dump (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_one_eid_table_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ u8 filter = 0;
+ int ret;
+ u32 vni, t = 0;
+ lisp_eid_vat_t eid;
+ u8 eid_set = 0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat
+ (i, "eid %U/%d", unformat_ip46_address, &eid.addr.ip, &eid.len))
+ {
+ eid_set = 1;
+ eid.type = 0;
+ }
+ else
+ if (unformat (i, "eid %U", unformat_ethernet_address, &eid.addr.mac))
+ {
+ eid_set = 1;
+ eid.type = 1;
+ }
+ else if (unformat (i, "eid %U", unformat_nsh_address, &eid.addr.nsh))
+ {
+ eid_set = 1;
+ eid.type = 2;
+ }
+ else if (unformat (i, "vni %d", &t))
+ {
+ vni = t;
+ }
+ else if (unformat (i, "local"))
+ {
+ filter = 1;
+ }
+ else if (unformat (i, "remote"))
+ {
+ filter = 2;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%-35s%-20s%-30s%-20s%-20s%-10s%-20s", "EID",
+ "type", "ls_index", "ttl", "authoritative", "key_id", "key");
+ }
+
+ M (ONE_EID_TABLE_DUMP, mp);
+
+ mp->filter = filter;
+ if (eid_set)
+ {
+ mp->eid_set = 1;
+ mp->vni = htonl (vni);
+ lisp_eid_put_vat (&mp->eid, &eid);
+ }
+
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_adjacencies_get (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_one_adjacencies_get_t *mp;
+ u8 vni_set = 0;
+ u32 vni = ~0;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "vni %d", &vni))
+ {
+ vni_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!vni_set)
+ {
+ errmsg ("vni not set!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%s %40s", "leid", "reid");
+ }
+
+ M (ONE_ADJACENCIES_GET, mp);
+ mp->vni = clib_host_to_net_u32 (vni);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_map_server_dump (vat_main_t * vam)
+{
+ vl_api_one_map_server_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Map server");
+ }
+
+ M (ONE_MAP_SERVER_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_map_server_dump api_one_map_server_dump
+
+static int
+api_one_map_resolver_dump (vat_main_t * vam)
+{
+ vl_api_one_map_resolver_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "Map resolver");
+ }
+
+ M (ONE_MAP_RESOLVER_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define api_lisp_map_resolver_dump api_one_map_resolver_dump
+
+static int
+api_one_stats_flush (vat_main_t * vam)
+{
+ vl_api_one_stats_flush_t *mp;
+ int ret = 0;
+
+ M (ONE_STATS_FLUSH, mp);
+ S (mp);
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_stats_dump (vat_main_t * vam)
+{
+ vl_api_one_stats_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ int ret;
+
+ M (ONE_STATS_DUMP, mp);
+ /* send it... */
+ S (mp);
+
+ /* Use a control ping for synchronization */
+ LISP_PING (&one_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_show_one_status (vat_main_t * vam)
+{
+ vl_api_show_one_status_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%-20s%-16s", "ONE status", "locator-set");
+ }
+
+ M (SHOW_ONE_STATUS, mp);
+ /* send it... */
+ S (mp);
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_one_get_map_request_itr_rlocs (vat_main_t * vam)
+{
+ vl_api_one_get_map_request_itr_rlocs_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%=20s", "itr-rlocs:");
+ }
+
+ M (ONE_GET_MAP_REQUEST_ITR_RLOCS, mp);
+ /* send it... */
+ S (mp);
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define vat_plugin_register vat_plugin_register_one
+#include <lisp/lisp-cp/one.api_test.c>
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-cp/packets.c b/src/plugins/lisp/lisp-cp/packets.c
index bbc3ad64572..95f95cdb68a 100644
--- a/src/vnet/lisp-cp/packets.c
+++ b/src/plugins/lisp/lisp-cp/packets.c
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include <vnet/lisp-cp/packets.h>
-#include <vnet/lisp-cp/lisp_cp_messages.h>
+#include <lisp/lisp-cp/packets.h>
+#include <lisp/lisp-cp/lisp_cp_messages.h>
#include <vnet/udp/udp_packet.h>
/* Returns IP ID for the packet */
diff --git a/src/vnet/lisp-cp/packets.h b/src/plugins/lisp/lisp-cp/packets.h
index eb9871bf9c0..68cd949e75d 100644
--- a/src/vnet/lisp-cp/packets.h
+++ b/src/plugins/lisp/lisp-cp/packets.h
@@ -14,7 +14,7 @@
*/
#include <vnet/vnet.h>
-#include <vnet/lisp-cp/lisp_types.h>
+#include <lisp/lisp-cp/lisp_types.h>
#define IP_DF 0x4000 /* don't fragment */
diff --git a/src/vnet/lisp-gpe/FEATURE.yaml b/src/plugins/lisp/lisp-gpe/FEATURE.yaml
index d2016e6120d..d2016e6120d 100644
--- a/src/vnet/lisp-gpe/FEATURE.yaml
+++ b/src/plugins/lisp/lisp-gpe/FEATURE.yaml
diff --git a/src/vnet/lisp-gpe/decap.c b/src/plugins/lisp/lisp-gpe/decap.c
index ab35c7ea73d..03e265ab739 100644
--- a/src/vnet/lisp-gpe/decap.c
+++ b/src/plugins/lisp/lisp-gpe/decap.c
@@ -19,7 +19,7 @@
*/
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
typedef struct
{
@@ -453,7 +453,7 @@ lisp_gpe_ip6_input (vlib_main_t * vm, vlib_node_runtime_t * node,
static char *lisp_gpe_ip4_input_error_strings[] = {
#define lisp_gpe_error(n,s) s,
-#include <vnet/lisp-gpe/lisp_gpe_error.def>
+#include <lisp/lisp-gpe/lisp_gpe_error.def>
#undef lisp_gpe_error
};
diff --git a/src/vnet/lisp-gpe/dir.dox b/src/plugins/lisp/lisp-gpe/dir.dox
index afa6da9ab2c..afa6da9ab2c 100644
--- a/src/vnet/lisp-gpe/dir.dox
+++ b/src/plugins/lisp/lisp-gpe/dir.dox
diff --git a/src/vnet/lisp-gpe/interface.c b/src/plugins/lisp/lisp-gpe/interface.c
index 1ccb53dda72..0d5f689fe7b 100644
--- a/src/vnet/lisp-gpe/interface.c
+++ b/src/plugins/lisp/lisp-gpe/interface.c
@@ -25,15 +25,15 @@
#include <vnet/ip/ip.h>
#include <vnet/udp/udp.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe_fwd_entry.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
#include <vnet/adj/adj.h>
#include <vnet/fib/fib_table.h>
#include <vnet/fib/ip4_fib.h>
#include <vnet/fib/ip6_fib.h>
-#include <vnet/lisp-cp/lisp_cp_dpo.h>
+#include <lisp/lisp-cp/lisp_cp_dpo.h>
/**
* @brief The VLIB node arc/edge from the interface's TX node, to the L2
diff --git a/src/vnet/lisp-gpe/lisp_gpe.api b/src/plugins/lisp/lisp-gpe/lisp_gpe.api
index 6c751eabffb..2e1846261ab 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.api
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe.api
@@ -16,7 +16,7 @@
option version = "2.0.0";
import "vnet/interface_types.api";
-import "vnet/lisp-cp/lisp_types.api";
+import "plugins/lisp/lisp-cp/lisp_types.api";
/** \brief GPE locator structure
@param is_ip4 - whether addr is IPv4 or v6
@@ -41,7 +41,7 @@ typedef gpe_locator
@param loc_num - number of locators
@param locs - array of remote locators
*/
-manual_print manual_endian define gpe_add_del_fwd_entry
+define gpe_add_del_fwd_entry
{
u32 client_index;
u32 context;
@@ -95,7 +95,7 @@ define gpe_fwd_entry_vnis_get
u32 context;
};
-manual_print manual_endian define gpe_fwd_entry_vnis_get_reply
+define gpe_fwd_entry_vnis_get_reply
{
u32 context;
i32 retval;
@@ -120,7 +120,7 @@ typedef gpe_fwd_entry
u8 action;
};
-manual_print manual_endian define gpe_fwd_entries_get_reply
+define gpe_fwd_entries_get_reply
{
u32 context;
i32 retval;
@@ -135,7 +135,7 @@ define gpe_fwd_entry_path_dump
u32 fwd_entry_index;
};
-manual_endian manual_print define gpe_fwd_entry_path_details
+define gpe_fwd_entry_path_details
{
u32 context;
vl_api_gpe_locator_t lcl_loc;
@@ -222,7 +222,7 @@ typedef gpe_native_fwd_rpath
vl_api_address_t nh_addr;
};
-manual_print manual_endian define gpe_native_fwd_rpaths_get_reply
+define gpe_native_fwd_rpaths_get_reply
{
u32 context;
i32 retval;
diff --git a/src/vnet/lisp-gpe/lisp_gpe.c b/src/plugins/lisp/lisp-gpe/lisp_gpe.c
index c75ad6b87cd..1f087fd0625 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe.c
@@ -18,10 +18,10 @@
*
*/
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe_fwd_entry.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
#include <vnet/fib/fib_path_list.h>
#include <vnet/fib/fib_table.h>
#include <vnet/fib/fib_internal.h>
diff --git a/src/vnet/lisp-gpe/lisp_gpe.h b/src/plugins/lisp/lisp-gpe/lisp_gpe.h
index 3a3d0e9f4da..aa2e7d1bfbf 100644
--- a/src/vnet/lisp-gpe/lisp_gpe.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe.h
@@ -28,8 +28,8 @@
#include <vnet/ethernet/ethernet.h>
#include <vnet/ip/ip4_packet.h>
#include <vnet/udp/udp.h>
-#include <vnet/lisp-cp/lisp_types.h>
-#include <vnet/lisp-gpe/lisp_gpe_packet.h>
+#include <lisp/lisp-cp/lisp_types.h>
+#include <lisp/lisp-gpe/lisp_gpe_packet.h>
#include <vnet/adj/adj_types.h>
#include <vppinfra/bihash_24_8.h>
#include <vppinfra/bihash_template.h>
@@ -73,7 +73,7 @@ typedef enum
typedef enum
{
#define lisp_gpe_error(n,s) LISP_GPE_ERROR_##n,
-#include <vnet/lisp-gpe/lisp_gpe_error.def>
+#include <lisp/lisp-gpe/lisp_gpe_error.def>
#undef lisp_gpe_error
LISP_GPE_N_ERROR,
} lisp_gpe_error_t;
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.c
index cd0b33857f5..eab10f4d2d5 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.c
@@ -19,11 +19,11 @@
*/
#include <vnet/dpo/load_balance.h>
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-cp/lisp_types.h>
-#include <vnet/lisp-gpe/lisp_gpe_sub_interface.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
-#include <vnet/lisp-gpe/lisp_gpe_tunnel.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-cp/lisp_types.h>
+#include <lisp/lisp-gpe/lisp_gpe_sub_interface.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe_tunnel.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/adj/adj_midchain.h>
#include <vppinfra/bihash_24_8.h>
diff --git a/src/vnet/lisp-gpe/lisp_gpe_adjacency.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.h
index adc3acaee3c..060c5d13ebc 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_adjacency.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_adjacency.h
@@ -22,7 +22,7 @@
#define LISP_GPE_ADJACENCY_H__
#include <vnet/fib/fib_node.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
/**
* @brief A LISP GPE Adjacency.
diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_api.c
index e20347a46f6..df90ef54403 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_api.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_api.c
@@ -22,50 +22,29 @@
#include <vnet/interface.h>
#include <vnet/api_errno.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
-#include <vnet/lisp-gpe/lisp_gpe_tunnel.h>
-#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe_tunnel.h>
+#include <lisp/lisp-gpe/lisp_gpe_fwd_entry.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
#include <vnet/fib/fib_table.h>
-#include <vnet/vnet_msg_enum.h>
#include <vnet/ip/ip_types_api.h>
#include <vnet/ethernet/ethernet_types_api.h>
-#include <vnet/lisp-gpe/lisp_types_api.h>
+#include <lisp/lisp-gpe/lisp_types_api.h>
-#define vl_api_gpe_locator_pair_t_endian vl_noop_handler
-#define vl_api_gpe_locator_pair_t_print vl_noop_handler
-#define vl_api_gpe_add_del_fwd_entry_t_endian vl_noop_handler
-#define vl_api_gpe_add_del_fwd_entry_t_print vl_noop_handler
+/* define message IDs */
+#include <vnet/format_fns.h>
+#include <lisp/lisp-gpe/lisp_gpe.api_enum.h>
+#include <lisp/lisp-gpe/lisp_gpe.api_types.h>
-#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
+/**
+ * Base message ID fot the plugin
+ */
+static u32 gpe_base_msg_id;
+#define REPLY_MSG_ID_BASE gpe_base_msg_id
#include <vlibapi/api_helper_macros.h>
-#define foreach_vpe_api_msg \
-_(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
-_(GPE_FWD_ENTRIES_GET, gpe_fwd_entries_get) \
-_(GPE_FWD_ENTRY_PATH_DUMP, gpe_fwd_entry_path_dump) \
-_(GPE_ENABLE_DISABLE, gpe_enable_disable) \
-_(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
-_(GPE_FWD_ENTRY_VNIS_GET, gpe_fwd_entry_vnis_get) \
-_(GPE_SET_ENCAP_MODE, gpe_set_encap_mode) \
-_(GPE_GET_ENCAP_MODE, gpe_get_encap_mode) \
-_(GPE_ADD_DEL_NATIVE_FWD_RPATH, gpe_add_del_native_fwd_rpath) \
-_(GPE_NATIVE_FWD_RPATHS_GET, gpe_native_fwd_rpaths_get)
-
static locator_pair_t *
unformat_gpe_loc_pairs (void *locs, u32 rloc_num)
{
@@ -497,45 +476,23 @@ vl_api_gpe_native_fwd_rpaths_get_t_handler (vl_api_gpe_native_fwd_rpaths_get_t
}
/*
- * gpe_api_hookup
+ * lisp_api_hookup
* Add vpe's API message handlers to the table.
* vlib has already 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_gpe;
-#undef _
-}
+#include <lisp/lisp-gpe/lisp_gpe.api.c>
static clib_error_t *
gpe_api_hookup (vlib_main_t * vm)
{
- api_main_t *am = vlibapi_get_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);
+ gpe_base_msg_id = setup_message_id_table ();
- return 0;
+ return NULL;
}
VLIB_API_INIT_FUNCTION (gpe_api_hookup);
diff --git a/src/vnet/lisp-gpe/lisp_gpe_error.def b/src/plugins/lisp/lisp-gpe/lisp_gpe_error.def
index 415fada73d2..415fada73d2 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_error.def
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_error.def
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.c
index 487ba246b4d..334164c2583 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.c
@@ -13,10 +13,10 @@
* limitations under the License.
*/
-#include <vnet/lisp-gpe/lisp_gpe_fwd_entry.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
-#include <vnet/lisp-cp/lisp_cp_dpo.h>
+#include <lisp/lisp-gpe/lisp_gpe_fwd_entry.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-cp/lisp_cp_dpo.h>
#include <vnet/fib/fib_table.h>
#include <vnet/fib/fib_entry.h>
#include <vnet/fib/fib_path_list.h>
diff --git a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.h
index dfdb8b911ae..a170787f5b2 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_fwd_entry.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_fwd_entry.h
@@ -20,7 +20,7 @@
#ifndef __LISP_GPE_FWD_ENTRY_H__
#define __LISP_GPE_FWD_ENTRY_H__
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
/**
* @brief A path on which to forward lisp traffic
diff --git a/src/vnet/lisp-gpe/lisp_gpe_packet.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_packet.h
index 62ac9bd7015..62ac9bd7015 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_packet.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_packet.h
diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c
index 1ccd5817d7f..b84c76f0103 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.c
@@ -17,8 +17,8 @@
* @brief LISP sub-interfaces.
*
*/
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
-#include <vnet/lisp-gpe/lisp_gpe_sub_interface.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe_sub_interface.h>
#include <vnet/fib/fib_table.h>
#include <vnet/interface.h>
diff --git a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.h
index 7375bf00ccc..c8b447a65dc 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_sub_interface.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_sub_interface.h
@@ -21,7 +21,7 @@
#ifndef __LISP_GPE_SUB_INTERFACE_H__
#define __LISP_GPE_SUB_INTERFACE_H__
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
/**
* A Key for lookup in the L£ sub-interface DB
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.c
index e2a310c043c..fb6aa1ac1d5 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tenant.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.c
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include <vnet/lisp-gpe/lisp_gpe_tenant.h>
+#include <lisp/lisp-gpe/lisp_gpe_tenant.h>
/**
* The pool of all tenants
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tenant.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.h
index a9271da91f5..35b6569d0ed 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tenant.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_tenant.h
@@ -16,7 +16,7 @@
#ifndef __LISP_GPE_TENANT_H__
#define __LISP_GPE_TENANT_H__
-#include <vnet/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
/**
* Refernece counting lock types on the tenant.
diff --git a/src/plugins/lisp/lisp-gpe/lisp_gpe_test.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_test.c
new file mode 100644
index 00000000000..39f99492268
--- /dev/null
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_test.c
@@ -0,0 +1,888 @@
+/*
+ * Copyright (c) 2015 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 <vat/vat.h>
+#include <vlibapi/api.h>
+#include <vlibmemory/api.h>
+#include <vppinfra/error.h>
+
+#include <vnet/ip/ip_format_fns.h>
+#include <vnet/ethernet/ethernet_format_fns.h>
+#include <lisp/lisp-cp/lisp_types.h>
+
+/* define message IDs */
+#include <lisp/lisp-gpe/lisp_gpe.api_enum.h>
+#include <lisp/lisp-gpe/lisp_gpe.api_types.h>
+#include <vpp/api/vpe.api_types.h>
+
+typedef struct
+{
+ /* API message ID base */
+ u16 msg_id_base;
+ vat_main_t *vat_main;
+ u32 ping_id;
+} lisp_gpe_test_main_t;
+
+lisp_gpe_test_main_t lisp_gpe_test_main;
+
+#define __plugin_msg_base lisp_gpe_test_main.msg_id_base
+#include <vlibapi/vat_helper_macros.h>
+
+/* Macro to finish up custom dump fns */
+#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__)
+#define FINISH \
+ vec_add1 (s, 0); \
+ vl_print (handle, (char *)s); \
+ vec_free (s); \
+ return handle;
+
+#define LISP_PING(_lm, mp_ping) \
+ if (!(_lm)->ping_id) \
+ (_lm)->ping_id = vl_msg_api_get_msg_index ((u8 *) (VL_API_CONTROL_PING_CRC)); \
+ mp_ping = vl_msg_api_alloc_as_if_client (sizeof (*mp_ping)); \
+ mp_ping->_vl_msg_id = htons ((_lm)->ping_id); \
+ mp_ping->client_index = vam->my_client_index; \
+ fformat (vam->ofp, "Sending ping id=%d\n", (_lm)->ping_id); \
+ vam->result_ready = 0; \
+
+typedef struct
+{
+ u32 spi;
+ u8 si;
+} __attribute__ ((__packed__)) lisp_nsh_api_t;
+
+static uword
+unformat_nsh_address (unformat_input_t * input, va_list * args)
+{
+ lisp_nsh_api_t *nsh = va_arg (*args, lisp_nsh_api_t *);
+ return unformat (input, "SPI:%d SI:%d", &nsh->spi, &nsh->si);
+}
+
+static u8 *
+format_nsh_address_vat (u8 * s, va_list * args)
+{
+ nsh_t *a = va_arg (*args, nsh_t *);
+ return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si);
+}
+
+static u8 *
+format_lisp_flat_eid (u8 * s, va_list * args)
+{
+ vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
+
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (eid->address.prefix.address.af)
+ return format (s, "%U/%d", format_ip6_address,
+ eid->address.prefix.address.un.ip6,
+ eid->address.prefix.len);
+ return format (s, "%U/%d", format_ip4_address,
+ eid->address.prefix.address.un.ip4,
+ eid->address.prefix.len);
+ case EID_TYPE_API_MAC:
+ return format (s, "%U", format_ethernet_address, eid->address.mac);
+ case EID_TYPE_API_NSH:
+ return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
+ }
+ return 0;
+}
+
+static void vl_api_gpe_add_del_fwd_entry_reply_t_handler
+ (vl_api_gpe_add_del_fwd_entry_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ i32 retval = ntohl (mp->retval);
+ if (vam->async_mode)
+ {
+ vam->async_errors += (retval < 0);
+ }
+ else
+ {
+ vam->retval = retval;
+ vam->result_ready = 1;
+ }
+}
+
+static void
+api_gpe_fwd_entry_net_to_host (vl_api_gpe_fwd_entry_t * e)
+{
+ e->dp_table = clib_net_to_host_u32 (e->dp_table);
+ e->fwd_entry_index = clib_net_to_host_u32 (e->fwd_entry_index);
+ e->vni = clib_net_to_host_u32 (e->vni);
+}
+
+static void
+ gpe_fwd_entries_get_reply_t_net_to_host
+ (vl_api_gpe_fwd_entries_get_reply_t * mp)
+{
+ u32 i;
+
+ mp->count = clib_net_to_host_u32 (mp->count);
+ for (i = 0; i < mp->count; i++)
+ {
+ api_gpe_fwd_entry_net_to_host (&mp->entries[i]);
+ }
+}
+
+static u8 *
+format_gpe_encap_mode (u8 * s, va_list * args)
+{
+ u32 mode = va_arg (*args, u32);
+
+ switch (mode)
+ {
+ case 0:
+ return format (s, "lisp");
+ case 1:
+ return format (s, "vxlan");
+ }
+ return 0;
+}
+
+static void
+ vl_api_gpe_get_encap_mode_reply_t_handler
+ (vl_api_gpe_get_encap_mode_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ print (vam->ofp, "gpe mode: %U", format_gpe_encap_mode, mp->encap_mode);
+ vam->retval = ntohl (mp->retval);
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_gpe_fwd_entry_path_details_t_handler
+ (vl_api_gpe_fwd_entry_path_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
+
+ if (mp->lcl_loc.addr.af)
+ format_ip_address_fcn = format_ip6_address;
+ else
+ format_ip_address_fcn = format_ip4_address;
+
+ print (vam->ofp, "w:%d %30U %30U", mp->rmt_loc.weight,
+ format_ip_address_fcn, &mp->lcl_loc.addr.un,
+ format_ip_address_fcn, &mp->rmt_loc.addr.un);
+}
+
+static void
+ vl_api_gpe_fwd_entries_get_reply_t_handler
+ (vl_api_gpe_fwd_entries_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i;
+ int retval = clib_net_to_host_u32 (mp->retval);
+ vl_api_gpe_fwd_entry_t *e;
+
+ if (retval)
+ goto end;
+
+ gpe_fwd_entries_get_reply_t_net_to_host (mp);
+
+ for (i = 0; i < mp->count; i++)
+ {
+ e = &mp->entries[i];
+ print (vam->ofp, "%10d %10d %U %40U", e->fwd_entry_index, e->dp_table,
+ format_lisp_flat_eid, e->leid, format_lisp_flat_eid, e->reid);
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_gpe_native_fwd_rpaths_get_reply_t_handler
+ (vl_api_gpe_native_fwd_rpaths_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+ vl_api_gpe_native_fwd_rpath_t *r;
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ {
+ r = &mp->entries[i];
+ print (vam->ofp, "fib_index: %d sw_if_index %d nh %U",
+ clib_net_to_host_u32 (r->fib_index),
+ clib_net_to_host_u32 (r->nh_sw_if_index),
+ r->nh_addr.af ? format_ip6_address : format_ip4_address,
+ r->nh_addr.un);
+ }
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+static void
+ vl_api_gpe_fwd_entry_vnis_get_reply_t_handler
+ (vl_api_gpe_fwd_entry_vnis_get_reply_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ u32 i, n;
+ int retval = clib_net_to_host_u32 (mp->retval);
+
+ if (retval)
+ goto end;
+
+ n = clib_net_to_host_u32 (mp->count);
+
+ for (i = 0; i < n; i++)
+ print (vam->ofp, "%d", clib_net_to_host_u32 (mp->vnis[i]));
+
+end:
+ vam->retval = retval;
+ vam->result_ready = 1;
+}
+
+
+/* *INDENT-OFF* */
+/** Used for parsing LISP eids */
+typedef CLIB_PACKED(struct{
+ union {
+ ip46_address_t ip;
+ mac_address_t mac;
+ lisp_nsh_api_t nsh;
+ } addr;
+ u32 len; /**< prefix length if IP */
+ u8 type; /**< type of eid */
+}) lisp_eid_vat_t;
+/* *INDENT-ON* */
+
+static uword
+unformat_lisp_eid_vat (unformat_input_t * input, va_list * args)
+{
+ lisp_eid_vat_t *a = va_arg (*args, lisp_eid_vat_t *);
+
+ clib_memset (a, 0, sizeof (a[0]));
+
+ if (unformat (input, "%U/%d", unformat_ip46_address, a->addr.ip, &a->len))
+ {
+ a->type = 0; /* ip prefix type */
+ }
+ else if (unformat (input, "%U", unformat_ethernet_address, &a->addr.mac))
+ {
+ a->type = 1; /* mac type */
+ }
+ else if (unformat (input, "%U", unformat_nsh_address, a->addr.nsh))
+ {
+ a->type = 2; /* NSH type */
+ a->addr.nsh.spi = clib_host_to_net_u32 (a->addr.nsh.spi);
+ }
+ else
+ {
+ return 0;
+ }
+
+ if (a->type == 0)
+ {
+ if (ip46_address_is_ip4 (&a->addr.ip))
+ return a->len > 32 ? 1 : 0;
+ else
+ return a->len > 128 ? 1 : 0;
+ }
+
+ return 1;
+}
+
+static void
+lisp_eid_put_vat (vl_api_eid_t * eid, const lisp_eid_vat_t * vat_eid)
+{
+ eid->type = vat_eid->type;
+ switch (eid->type)
+ {
+ case EID_TYPE_API_PREFIX:
+ if (ip46_address_is_ip4 (&vat_eid->addr.ip))
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip4,
+ &vat_eid->addr.ip.ip4, 4);
+ eid->address.prefix.address.af = ADDRESS_IP4;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ else
+ {
+ clib_memcpy (&eid->address.prefix.address.un.ip6,
+ &vat_eid->addr.ip.ip6, 16);
+ eid->address.prefix.address.af = ADDRESS_IP6;
+ eid->address.prefix.len = vat_eid->len;
+ }
+ return;
+ case EID_TYPE_API_MAC:
+ clib_memcpy (&eid->address.mac, &vat_eid->addr.mac,
+ sizeof (eid->address.mac));
+ return;
+ case EID_TYPE_API_NSH:
+ clib_memcpy (&eid->address.nsh, &vat_eid->addr.nsh,
+ sizeof (eid->address.nsh));
+ return;
+ default:
+ ASSERT (0);
+ return;
+ }
+}
+
+static int
+api_gpe_add_del_fwd_entry (vat_main_t * vam)
+{
+ u32 dp_table = 0, vni = 0;;
+ unformat_input_t *input = vam->input;
+ vl_api_gpe_add_del_fwd_entry_t *mp;
+ u8 is_add = 1;
+ lisp_eid_vat_t _rmt_eid, *rmt_eid = &_rmt_eid;
+ lisp_eid_vat_t _lcl_eid, *lcl_eid = &_lcl_eid;
+ u8 rmt_eid_set = 0, lcl_eid_set = 0;
+ u32 action = ~0, w;
+ ip4_address_t rmt_rloc4, lcl_rloc4;
+ ip6_address_t rmt_rloc6, lcl_rloc6;
+ vl_api_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
+ int ret;
+
+ clib_memset (&rloc, 0, sizeof (rloc));
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "del"))
+ is_add = 0;
+ else if (unformat (input, "add"))
+ is_add = 1;
+ else if (unformat (input, "reid %U", unformat_lisp_eid_vat, rmt_eid))
+ {
+ rmt_eid_set = 1;
+ }
+ else if (unformat (input, "leid %U", unformat_lisp_eid_vat, lcl_eid))
+ {
+ lcl_eid_set = 1;
+ }
+ else if (unformat (input, "vrf %d", &dp_table))
+ ;
+ else if (unformat (input, "bd %d", &dp_table))
+ ;
+ else if (unformat (input, "vni %d", &vni))
+ ;
+ else if (unformat (input, "w %d", &w))
+ {
+ if (!curr_rloc)
+ {
+ errmsg ("No RLOC configured for setting priority/weight!");
+ return -99;
+ }
+ curr_rloc->weight = w;
+ }
+ else if (unformat (input, "loc-pair %U %U", unformat_ip4_address,
+ &lcl_rloc4, unformat_ip4_address, &rmt_rloc4))
+ {
+ rloc.addr.af = 0;
+ clib_memcpy (&rloc.addr.un.ip4, &lcl_rloc4, sizeof (lcl_rloc4));
+ rloc.weight = 0;
+ vec_add1 (lcl_locs, rloc);
+
+ clib_memcpy (&rloc.addr.un.ip4, &rmt_rloc4, sizeof (rmt_rloc4));
+ vec_add1 (rmt_locs, rloc);
+ /* weight saved in rmt loc */
+ curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
+ }
+ else if (unformat (input, "loc-pair %U %U", unformat_ip6_address,
+ &lcl_rloc6, unformat_ip6_address, &rmt_rloc6))
+ {
+ rloc.addr.af = 1;
+ clib_memcpy (&rloc.addr.un.ip6, &lcl_rloc6, sizeof (lcl_rloc6));
+ rloc.weight = 0;
+ vec_add1 (lcl_locs, rloc);
+
+ clib_memcpy (&rloc.addr.un.ip6, &rmt_rloc6, sizeof (rmt_rloc6));
+ vec_add1 (rmt_locs, rloc);
+ /* weight saved in rmt loc */
+ curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
+ }
+ else if (unformat (input, "action %d", &action))
+ {
+ ;
+ }
+ else
+ {
+ clib_warning ("parse error '%U'", format_unformat_error, input);
+ return -99;
+ }
+ }
+
+ if (!rmt_eid_set)
+ {
+ errmsg ("remote eid addresses not set");
+ return -99;
+ }
+
+ if (lcl_eid_set && rmt_eid->type != lcl_eid->type)
+ {
+ errmsg ("eid types don't match");
+ return -99;
+ }
+
+ if (0 == rmt_locs && (u32) ~ 0 == action)
+ {
+ errmsg ("action not set for negative mapping");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M2 (GPE_ADD_DEL_FWD_ENTRY, mp,
+ sizeof (vl_api_gpe_locator_t) * vec_len (rmt_locs) * 2);
+
+ mp->is_add = is_add;
+ lisp_eid_put_vat (&mp->rmt_eid, rmt_eid);
+ lisp_eid_put_vat (&mp->lcl_eid, lcl_eid);
+ mp->dp_table = clib_host_to_net_u32 (dp_table);
+ mp->vni = clib_host_to_net_u32 (vni);
+ mp->action = action;
+
+ if (0 != rmt_locs && 0 != lcl_locs)
+ {
+ mp->loc_num = clib_host_to_net_u32 (vec_len (rmt_locs) * 2);
+ clib_memcpy (mp->locs, lcl_locs,
+ (sizeof (vl_api_gpe_locator_t) * vec_len (lcl_locs)));
+
+ u32 offset = sizeof (vl_api_gpe_locator_t) * vec_len (lcl_locs);
+ clib_memcpy (((u8 *) mp->locs) + offset, rmt_locs,
+ (sizeof (vl_api_gpe_locator_t) * vec_len (rmt_locs)));
+ }
+ vec_free (lcl_locs);
+ vec_free (rmt_locs);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_enable_disable (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_gpe_enable_disable_t *mp;
+ u8 is_set = 0;
+ u8 is_enable = 1;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "enable"))
+ {
+ is_set = 1;
+ is_enable = 1;
+ }
+ else if (unformat (input, "disable"))
+ {
+ is_set = 1;
+ is_enable = 0;
+ }
+ else
+ break;
+ }
+
+ if (is_set == 0)
+ {
+ errmsg ("Value not set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (GPE_ENABLE_DISABLE, mp);
+
+ mp->is_enable = is_enable;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+uword
+unformat_gpe_encap_mode (unformat_input_t * input, va_list * args)
+{
+ u32 *mode = va_arg (*args, u32 *);
+
+ if (unformat (input, "lisp"))
+ *mode = 0;
+ else if (unformat (input, "vxlan"))
+ *mode = 1;
+ else
+ return 0;
+
+ return 1;
+}
+
+static int
+api_gpe_get_encap_mode (vat_main_t * vam)
+{
+ vl_api_gpe_get_encap_mode_t *mp;
+ int ret;
+
+ /* Construct the API message */
+ M (GPE_GET_ENCAP_MODE, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_set_encap_mode (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_gpe_set_encap_mode_t *mp;
+ int ret;
+ u32 mode = 0;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "%U", unformat_gpe_encap_mode, &mode))
+ ;
+ else
+ break;
+ }
+
+ /* Construct the API message */
+ M (GPE_SET_ENCAP_MODE, mp);
+
+ mp->is_vxlan = mode;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_add_del_iface (vat_main_t * vam)
+{
+ unformat_input_t *input = vam->input;
+ vl_api_gpe_add_del_iface_t *mp;
+ u8 action_set = 0, is_add = 1, is_l2 = 0, dp_table_set = 0, vni_set = 0;
+ u32 dp_table = 0, vni = 0;
+ int ret;
+
+ /* Parse args required to build the message */
+ while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (input, "up"))
+ {
+ action_set = 1;
+ is_add = 1;
+ }
+ else if (unformat (input, "down"))
+ {
+ action_set = 1;
+ is_add = 0;
+ }
+ else if (unformat (input, "table_id %d", &dp_table))
+ {
+ dp_table_set = 1;
+ }
+ else if (unformat (input, "bd_id %d", &dp_table))
+ {
+ dp_table_set = 1;
+ is_l2 = 1;
+ }
+ else if (unformat (input, "vni %d", &vni))
+ {
+ vni_set = 1;
+ }
+ else
+ break;
+ }
+
+ if (action_set == 0)
+ {
+ errmsg ("Action not set");
+ return -99;
+ }
+ if (dp_table_set == 0 || vni_set == 0)
+ {
+ errmsg ("vni and dp_table must be set");
+ return -99;
+ }
+
+ /* Construct the API message */
+ M (GPE_ADD_DEL_IFACE, mp);
+
+ mp->is_add = is_add;
+ mp->dp_table = clib_host_to_net_u32 (dp_table);
+ mp->is_l2 = is_l2;
+ mp->vni = clib_host_to_net_u32 (vni);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_fwd_entries_get (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_gpe_fwd_entries_get_t *mp;
+ u8 vni_set = 0;
+ u32 vni = ~0;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "vni %d", &vni))
+ {
+ vni_set = 1;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!vni_set)
+ {
+ errmsg ("vni not set!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "%10s %10s %s %40s", "fwd_index", "dp_table",
+ "leid", "reid");
+ }
+
+ M (GPE_FWD_ENTRIES_GET, mp);
+ mp->vni = clib_host_to_net_u32 (vni);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_native_fwd_rpaths_get (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_gpe_native_fwd_rpaths_get_t *mp;
+ int ret;
+ u8 ip_family_set = 0, is_ip4 = 1;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "ip4"))
+ {
+ ip_family_set = 1;
+ is_ip4 = 1;
+ }
+ else if (unformat (i, "ip6"))
+ {
+ ip_family_set = 1;
+ is_ip4 = 0;
+ }
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!ip_family_set)
+ {
+ errmsg ("ip family not set!");
+ return -99;
+ }
+
+ M (GPE_NATIVE_FWD_RPATHS_GET, mp);
+ mp->is_ip4 = is_ip4;
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_fwd_entry_vnis_get (vat_main_t * vam)
+{
+ vl_api_gpe_fwd_entry_vnis_get_t *mp;
+ int ret;
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "VNIs");
+ }
+
+ M (GPE_FWD_ENTRY_VNIS_GET, mp);
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_add_del_native_fwd_rpath (vat_main_t * vam)
+{
+ unformat_input_t *i = vam->input;
+ vl_api_gpe_add_del_native_fwd_rpath_t *mp;
+ int ret = 0;
+ u8 is_add = 1, ip_set = 0, is_ip4 = 1;
+ struct in_addr ip4;
+ struct in6_addr ip6;
+ u32 table_id = 0, nh_sw_if_index = ~0;
+
+ clib_memset (&ip4, 0, sizeof (ip4));
+ clib_memset (&ip6, 0, sizeof (ip6));
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "del"))
+ is_add = 0;
+ else if (unformat (i, "via %U %U", unformat_ip4_address, &ip4,
+ unformat_sw_if_index, vam, &nh_sw_if_index))
+ {
+ ip_set = 1;
+ is_ip4 = 1;
+ }
+ else if (unformat (i, "via %U %U", unformat_ip6_address, &ip6,
+ unformat_sw_if_index, vam, &nh_sw_if_index))
+ {
+ ip_set = 1;
+ is_ip4 = 0;
+ }
+ else if (unformat (i, "via %U", unformat_ip4_address, &ip4))
+ {
+ ip_set = 1;
+ is_ip4 = 1;
+ nh_sw_if_index = ~0;
+ }
+ else if (unformat (i, "via %U", unformat_ip6_address, &ip6))
+ {
+ ip_set = 1;
+ is_ip4 = 0;
+ nh_sw_if_index = ~0;
+ }
+ else if (unformat (i, "table %d", &table_id))
+ ;
+ else
+ {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
+
+ if (!ip_set)
+ {
+ errmsg ("nh addr not set!");
+ return -99;
+ }
+
+ M (GPE_ADD_DEL_NATIVE_FWD_RPATH, mp);
+ mp->is_add = is_add;
+ mp->table_id = clib_host_to_net_u32 (table_id);
+ mp->nh_sw_if_index = clib_host_to_net_u32 (nh_sw_if_index);
+ mp->nh_addr.af = is_ip4 ? 0 : 1;
+ if (is_ip4)
+ clib_memcpy (mp->nh_addr.un.ip4, &ip4, sizeof (ip4));
+ else
+ clib_memcpy (mp->nh_addr.un.ip6, &ip6, sizeof (ip6));
+
+ /* send it... */
+ S (mp);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+static int
+api_gpe_fwd_entry_path_dump (vat_main_t * vam)
+{
+ vl_api_gpe_fwd_entry_path_dump_t *mp;
+ vl_api_control_ping_t *mp_ping;
+ unformat_input_t *i = vam->input;
+ u32 fwd_entry_index = ~0;
+ int ret;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
+ {
+ if (unformat (i, "index %d", &fwd_entry_index))
+ ;
+ else
+ break;
+ }
+
+ if (~0 == fwd_entry_index)
+ {
+ errmsg ("no index specified!");
+ return -99;
+ }
+
+ if (!vam->json_output)
+ {
+ print (vam->ofp, "first line");
+ }
+
+ M (GPE_FWD_ENTRY_PATH_DUMP, mp);
+
+ /* send it... */
+ S (mp);
+ /* Use a control ping for synchronization */
+ LISP_PING (&lisp_gpe_test_main, mp_ping);
+ S (mp_ping);
+
+ /* Wait for a reply... */
+ W (ret);
+ return ret;
+}
+
+#define vat_plugin_register vat_plugin_register_gpe
+#include <lisp/lisp-gpe/lisp_gpe.api_test.c>
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.c
index 0373542ba34..b2426429322 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.c
@@ -17,9 +17,9 @@
* @brief Common utility functions for IPv4, IPv6 and L2 LISP-GPE tunnels.
*
*/
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_tunnel.h>
-#include <vnet/lisp-gpe/lisp_gpe_adjacency.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe_tunnel.h>
+#include <lisp/lisp-gpe/lisp_gpe_adjacency.h>
#include <vnet/fib/fib_table.h>
diff --git a/src/vnet/lisp-gpe/lisp_gpe_tunnel.h b/src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.h
index 333d2882883..7fe3062dc57 100644
--- a/src/vnet/lisp-gpe/lisp_gpe_tunnel.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_tunnel.h
@@ -21,8 +21,8 @@
#ifndef LISP_GPE_TUNNEL_H__
#define LISP_GPE_TUNNEL_H__
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_packet.h>
+#include <lisp/lisp-gpe/lisp_gpe.h>
+#include <lisp/lisp-gpe/lisp_gpe_packet.h>
/**
* Forward declaration
diff --git a/src/vnet/lisp-gpe/lisp_types_api.c b/src/plugins/lisp/lisp-gpe/lisp_types_api.c
index 84e06c41264..84e06c41264 120000
--- a/src/vnet/lisp-gpe/lisp_types_api.c
+++ b/src/plugins/lisp/lisp-gpe/lisp_types_api.c
diff --git a/src/vnet/lisp-gpe/lisp_types_api.h b/src/plugins/lisp/lisp-gpe/lisp_types_api.h
index f895123c6b0..f895123c6b0 120000
--- a/src/vnet/lisp-gpe/lisp_types_api.h
+++ b/src/plugins/lisp/lisp-gpe/lisp_types_api.h
diff --git a/src/vnet/lisp-gpe/rfc.txt b/src/plugins/lisp/lisp-gpe/rfc.txt
index 5e3da150c70..5e3da150c70 100644
--- a/src/vnet/lisp-gpe/rfc.txt
+++ b/src/plugins/lisp/lisp-gpe/rfc.txt
diff --git a/src/plugins/unittest/lisp_cp_test.c b/src/plugins/lisp/test/lisp_cp_test.c
index ac6f65c7e47..228ff32d010 100644
--- a/src/plugins/unittest/lisp_cp_test.c
+++ b/src/plugins/lisp/test/lisp_cp_test.c
@@ -15,11 +15,11 @@
#include <vnet/vnet.h>
#include <vppinfra/error.h>
-#include <vnet/lisp-cp/lisp_cp_messages.h>
-#include <vnet/lisp-cp/control.h>
-#include <vnet/lisp-cp/lisp_msg_serdes.h>
+#include <lisp/lisp-cp/lisp_cp_messages.h>
+#include <lisp/lisp-cp/control.h>
+#include <lisp/lisp-cp/lisp_msg_serdes.h>
#include <vlibapi/api.h>
-#include <vnet/lisp-cp/packets.h>
+#include <lisp/lisp-cp/packets.h>
#define _assert(e) \
error = CLIB_ERROR_ASSERT (e); \
@@ -1422,6 +1422,16 @@ VLIB_CLI_COMMAND (lisp_cp_command, static) =
};
/* *INDENT-ON* */
+#include <vlib/unix/plugin.h>
+#include <vpp/app/version.h>
+
+/* *INDENT-OFF* */
+VLIB_PLUGIN_REGISTER () = {
+ .version = VPP_BUILD_VER,
+ .description = "Test Locator ID Separation Protocol (LISP)",
+ .default_disabled = 1,
+};
+/* *INDENT-ON* */
/*
* fd.io coding-style-patch-verification: ON
diff --git a/test/test_lisp.py b/src/plugins/lisp/test/test_lisp.py
index 70cb4f4bf34..70cb4f4bf34 100644
--- a/test/test_lisp.py
+++ b/src/plugins/lisp/test/test_lisp.py
diff --git a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
index 6c5abcce052..b69cd745e9b 100644
--- a/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
+++ b/src/plugins/nsh/nsh-md2-ioam/md2_ioam_transit.c
@@ -18,8 +18,7 @@
#include <vnet/ip/ip.h>
#include <vnet/udp/udp.h>
#include <vnet/ethernet/ethernet.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_packet.h>
+#include <lisp/lisp-gpe/lisp_gpe_packet.h>
#include <nsh/nsh.h>
#include <nsh/nsh_packet.h>
#include <nsh/nsh-md2-ioam/nsh_md2_ioam.h>
diff --git a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h
index 77cc8792c93..cdb06dab996 100644
--- a/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h
+++ b/src/plugins/nsh/nsh-md2-ioam/nsh_md2_ioam_util.h
@@ -15,8 +15,7 @@
#ifndef __included_nsh_md2_ioam_util_h__
#define __included_nsh_md2_ioam_util_h__
-#include <vnet/lisp-gpe/lisp_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe_packet.h>
+#include <lisp/lisp-gpe/lisp_gpe_packet.h>
#include <vnet/ip/ip.h>
#include <nsh/nsh.h>
#include <nsh/nsh-md2-ioam/nsh_md2_ioam.h>
diff --git a/src/plugins/unittest/CMakeLists.txt b/src/plugins/unittest/CMakeLists.txt
index 18780b6a607..ba6a82280f6 100644
--- a/src/plugins/unittest/CMakeLists.txt
+++ b/src/plugins/unittest/CMakeLists.txt
@@ -33,7 +33,6 @@ add_vpp_plugin(unittest
fib_test.c
interface_test.c
ipsec_test.c
- lisp_cp_test.c
llist_test.c
mactime_test.c
mfib_test.c
diff --git a/src/vat/api_format.c b/src/vat/api_format.c
index 926f65dcd86..d24a406ce01 100644
--- a/src/vat/api_format.c
+++ b/src/vat/api_format.c
@@ -30,7 +30,6 @@
#include <vnet/vxlan/vxlan.h>
#include <vnet/gre/gre.h>
#include <vnet/vxlan-gpe/vxlan_gpe.h>
-#include <vnet/lisp-gpe/lisp_gpe.h>
#include <vpp/api/vpe_msg_enum.h>
#include <vnet/l2/l2_classify.h>
@@ -2295,131 +2294,6 @@ static void vl_api_mpls_tunnel_add_del_reply_t_handler_json
vam->result_ready = 1;
}
-static void vl_api_gpe_add_del_fwd_entry_reply_t_handler
- (vl_api_gpe_add_del_fwd_entry_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->result_ready = 1;
- }
-}
-
-static void vl_api_gpe_add_del_fwd_entry_reply_t_handler_json
- (vl_api_gpe_add_del_fwd_entry_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "fwd_entry_index",
- clib_net_to_host_u32 (mp->fwd_entry_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-u8 *
-format_lisp_transport_protocol (u8 * s, va_list * args)
-{
- u32 proto = va_arg (*args, u32);
-
- switch (proto)
- {
- case 1:
- return format (s, "udp");
- case 2:
- return format (s, "api");
- default:
- return 0;
- }
- return 0;
-}
-
-static void vl_api_one_get_transport_protocol_reply_t_handler
- (vl_api_one_get_transport_protocol_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- u32 proto = mp->protocol;
- print (vam->ofp, "Transport protocol: %U",
- format_lisp_transport_protocol, proto);
- vam->retval = retval;
- vam->result_ready = 1;
- }
-}
-
-static void vl_api_one_get_transport_protocol_reply_t_handler_json
- (vl_api_one_get_transport_protocol_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *s;
-
- s = format (0, "%U", format_lisp_transport_protocol, mp->protocol);
- vec_add1 (s, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_string_copy (&node, "transport-protocol", s);
-
- vec_free (s);
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-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);
- if (vam->async_mode)
- {
- vam->async_errors += (retval < 0);
- }
- else
- {
- vam->retval = retval;
- vam->result_ready = 1;
- }
-}
-
-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;
-
- vat_json_init_object (&node);
- vat_json_object_add_int (&node, "retval", ntohl (mp->retval));
- vat_json_object_add_uint (&node, "locator_set_index", ntohl (mp->ls_index));
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static void vl_api_vxlan_add_del_tunnel_reply_t_handler
(vl_api_vxlan_add_del_tunnel_reply_t * mp)
{
@@ -2802,1676 +2676,6 @@ static void vl_api_get_node_graph_reply_t_handler_json
vam->result_ready = 1;
}
-static void
-vl_api_one_locator_details_t_handler (vl_api_one_locator_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *s = 0;
-
- if (mp->local)
- {
- s = format (s, "%=16d%=16d%=16d",
- ntohl (mp->sw_if_index), mp->priority, mp->weight);
- }
- else
- {
- s = format (s, "%=16U%=16d%=16d",
- format_ip46_address,
- mp->ip_address, mp->priority, mp->weight);
- }
-
- print (vam->ofp, "%v", s);
- vec_free (s);
-}
-
-static void
-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;
- struct in6_addr ip6;
- struct in_addr ip4;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
- vat_json_init_object (node);
-
- vat_json_object_add_uint (node, "local", mp->local ? 1 : 0);
- vat_json_object_add_uint (node, "priority", mp->priority);
- vat_json_object_add_uint (node, "weight", mp->weight);
-
- if (mp->local)
- vat_json_object_add_uint (node, "sw_if_index",
- clib_net_to_host_u32 (mp->sw_if_index));
- else
- {
- if (mp->ip_address.af)
- {
- clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "address", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "address", ip4);
- }
- }
-}
-
-static void
-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;
-
- ls_name = format (0, "%s", mp->ls_name);
-
- print (vam->ofp, "%=10d%=15v", clib_net_to_host_u32 (mp->ls_index),
- ls_name);
- vec_free (ls_name);
-}
-
-static void
- 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;
- u8 *ls_name = 0;
-
- ls_name = format (0, "%s", mp->ls_name);
- vec_add1 (ls_name, 0);
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_string_copy (node, "ls_name", ls_name);
- vat_json_object_add_uint (node, "ls_index",
- clib_net_to_host_u32 (mp->ls_index));
- vec_free (ls_name);
-}
-
-typedef struct
-{
- u32 spi;
- u8 si;
-} __attribute__ ((__packed__)) lisp_nsh_api_t;
-
-uword
-unformat_nsh_address (unformat_input_t * input, va_list * args)
-{
- lisp_nsh_api_t *nsh = va_arg (*args, lisp_nsh_api_t *);
- return unformat (input, "SPI:%d SI:%d", &nsh->spi, &nsh->si);
-}
-
-static u8 *
-format_nsh_address_vat (u8 * s, va_list * args)
-{
- nsh_t *a = va_arg (*args, nsh_t *);
- return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si);
-}
-
-static u8 *
-format_lisp_flat_eid (u8 * s, va_list * args)
-{
- vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
-
- switch (eid->type)
- {
- case EID_TYPE_API_PREFIX:
- if (eid->address.prefix.address.af)
- return format (s, "%U/%d", format_ip6_address,
- eid->address.prefix.address.un.ip6,
- eid->address.prefix.len);
- return format (s, "%U/%d", format_ip4_address,
- eid->address.prefix.address.un.ip4,
- eid->address.prefix.len);
- case EID_TYPE_API_MAC:
- return format (s, "%U", format_ethernet_address, eid->address.mac);
- case EID_TYPE_API_NSH:
- return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
- }
- return 0;
-}
-
-static u8 *
-format_lisp_eid_vat (u8 * s, va_list * args)
-{
- vl_api_eid_t *deid = va_arg (*args, vl_api_eid_t *);
- vl_api_eid_t *seid = va_arg (*args, vl_api_eid_t *);
- u8 is_src_dst = (u8) va_arg (*args, int);
-
- if (is_src_dst)
- s = format (s, "%U|", format_lisp_flat_eid, seid);
-
- s = format (s, "%U", format_lisp_flat_eid, deid);
-
- return s;
-}
-
-static void
-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;
-
- if (~0 == mp->locator_set_index)
- s = format (0, "action: %d", mp->action);
- else
- s = format (0, "%d", clib_net_to_host_u32 (mp->locator_set_index));
-
- eid = format (0, "%U", format_lisp_eid_vat,
- &mp->deid, &mp->seid, mp->is_src_dst);
- vec_add1 (eid, 0);
-
- print (vam->ofp, "[%d] %-35s%-20s%-30s%-20d%-20d%-10d%-20s",
- clib_net_to_host_u32 (mp->vni),
- eid,
- mp->is_local ? "local" : "remote",
- s, clib_net_to_host_u32 (mp->ttl), mp->authoritative,
- clib_net_to_host_u16 (mp->key.id), mp->key.key);
-
- vec_free (s);
- vec_free (eid);
-}
-
-static void
-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;
- u8 *eid = 0;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- if (~0 == mp->locator_set_index)
- vat_json_object_add_uint (node, "action", mp->action);
- else
- vat_json_object_add_uint (node, "locator_set_index",
- clib_net_to_host_u32 (mp->locator_set_index));
-
- vat_json_object_add_uint (node, "is_local", mp->is_local ? 1 : 0);
- if (mp->deid.type == 3)
- {
- vat_json_node_t *nsh_json = vat_json_object_add (node, "eid");
- vat_json_init_object (nsh_json);
- lisp_nsh_api_t *nsh = (lisp_nsh_api_t *) & mp->deid.address.nsh;
- vat_json_object_add_uint (nsh_json, "spi",
- clib_net_to_host_u32 (nsh->spi));
- vat_json_object_add_uint (nsh_json, "si", nsh->si);
- }
- else
- {
- eid = format (0, "%U", format_lisp_eid_vat,
- &mp->deid, &mp->seid, mp->is_src_dst);
- vec_add1 (eid, 0);
- vat_json_object_add_string_copy (node, "eid", eid);
- vec_free (eid);
- }
- vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
- vat_json_object_add_uint (node, "ttl", clib_net_to_host_u32 (mp->ttl));
- vat_json_object_add_uint (node, "authoritative", (mp->authoritative));
-
- if (mp->key.id)
- {
- vat_json_object_add_uint (node, "key_id",
- clib_net_to_host_u16 (mp->key.id));
- vat_json_object_add_string_copy (node, "key", mp->key.key);
- }
-}
-
-static void
-vl_api_one_stats_details_t_handler (vl_api_one_stats_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *seid = 0, *deid = 0;
- ip46_address_t lloc, rloc;
-
- deid = format (0, "%U", format_lisp_eid_vat, &mp->deid, 0, 0);
-
- seid = format (0, "%U", format_lisp_eid_vat, &mp->seid, 0, 0);
-
- vec_add1 (deid, 0);
- vec_add1 (seid, 0);
-
- if (mp->lloc.af)
- {
- clib_memcpy (&lloc.ip6, mp->lloc.un.ip6, 16);
- clib_memcpy (&rloc.ip6, mp->rloc.un.ip6, 16);
- }
- else
- {
- clib_memcpy (&lloc.ip4, mp->lloc.un.ip4, 4);
- clib_memcpy (&rloc.ip4, mp->rloc.un.ip4, 4);
- }
-
-
- print (vam->ofp, "([%d] %s %s) (%U %U) %u %u",
- clib_net_to_host_u32 (mp->vni),
- seid, deid,
- format_ip46_address, lloc,
- format_ip46_address, rloc,
- clib_net_to_host_u32 (mp->pkt_count),
- clib_net_to_host_u32 (mp->bytes));
-
- vec_free (deid);
- vec_free (seid);
-}
-
-static void
-vl_api_one_stats_details_t_handler_json (vl_api_one_stats_details_t * mp)
-{
- struct in6_addr ip6;
- struct in_addr ip4;
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = 0;
- u8 *deid = 0, *seid = 0;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- deid = format (0, "%U", format_lisp_eid_vat, &mp->deid, 0, 0);
-
- seid = format (0, "%U", format_lisp_eid_vat, &mp->seid, 0, 0);
-
- vec_add1 (deid, 0);
- vec_add1 (seid, 0);
-
- vat_json_object_add_string_copy (node, "seid", seid);
- vat_json_object_add_string_copy (node, "deid", deid);
- vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
-
- if (mp->lloc.af)
- {
- clib_memcpy (&ip6, mp->lloc.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "lloc", ip6);
- clib_memcpy (&ip6, mp->rloc.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "rloc", ip6);
-
- }
- else
- {
- clib_memcpy (&ip4, mp->lloc.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "lloc", ip4);
- clib_memcpy (&ip4, mp->rloc.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "rloc", ip4);
- }
- vat_json_object_add_uint (node, "pkt_count",
- clib_net_to_host_u32 (mp->pkt_count));
- vat_json_object_add_uint (node, "bytes", clib_net_to_host_u32 (mp->bytes));
-
- vec_free (deid);
- vec_free (seid);
-}
-
-static void
- vl_api_one_eid_table_map_details_t_handler
- (vl_api_one_eid_table_map_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- u8 *line = format (0, "%=10d%=10d",
- clib_net_to_host_u32 (mp->vni),
- clib_net_to_host_u32 (mp->dp_table));
- print (vam->ofp, "%v", line);
- vec_free (line);
-}
-
-static void
- 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;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "dp_table",
- clib_net_to_host_u32 (mp->dp_table));
- vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
-}
-
-static void
- vl_api_one_eid_table_vni_details_t_handler
- (vl_api_one_eid_table_vni_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- u8 *line = format (0, "%d", clib_net_to_host_u32 (mp->vni));
- print (vam->ofp, "%v", line);
- vec_free (line);
-}
-
-static void
- 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;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "vni", clib_net_to_host_u32 (mp->vni));
-}
-
-static void
- vl_api_show_one_map_register_fallback_threshold_reply_t_handler
- (vl_api_show_one_map_register_fallback_threshold_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- vl_api_show_one_map_register_fallback_threshold_reply_t_endian (mp);
- print (vam->ofp, "fallback threshold value: %d", mp->value);
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_map_register_fallback_threshold_reply_t_handler_json
- (vl_api_show_one_map_register_fallback_threshold_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t _node, *node = &_node;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- vl_api_show_one_map_register_fallback_threshold_reply_t_endian (mp);
- vat_json_init_object (node);
- vat_json_object_add_uint (node, "value", mp->value);
-
- vat_json_print (vam->ofp, node);
- vat_json_free (node);
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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);
-
- print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
-
- vat_json_init_object (node);
- vat_json_object_add_string_copy (node, "state", s);
-
- vat_json_print (vam->ofp, node);
- vat_json_free (node);
-
- vam->retval = retval;
- vam->result_ready = 1;
- vec_free (s);
-}
-
-static void
- 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);
-
- if (retval)
- goto end;
-
- print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
- vat_json_init_object (node);
- vat_json_object_add_string_copy (node, "state", s);
-
- vat_json_print (vam->ofp, node);
- vat_json_free (node);
-
- vam->retval = retval;
- vam->result_ready = 1;
- vec_free (s);
-}
-
-static void
- vl_api_show_one_stats_enable_disable_reply_t_handler
- (vl_api_show_one_stats_enable_disable_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- print (vam->ofp, "%s", mp->is_enable ? "enabled" : "disabled");
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_stats_enable_disable_reply_t_handler_json
- (vl_api_show_one_stats_enable_disable_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t _node, *node = &_node;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- u8 *s = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
- vat_json_init_object (node);
- vat_json_object_add_string_copy (node, "state", s);
-
- vat_json_print (vam->ofp, node);
- vat_json_free (node);
-
- vam->retval = retval;
- vam->result_ready = 1;
- vec_free (s);
-}
-
-static void
-api_gpe_fwd_entry_net_to_host (vl_api_gpe_fwd_entry_t * e)
-{
- e->dp_table = clib_net_to_host_u32 (e->dp_table);
- e->fwd_entry_index = clib_net_to_host_u32 (e->fwd_entry_index);
- e->vni = clib_net_to_host_u32 (e->vni);
-}
-
-static void
- gpe_fwd_entries_get_reply_t_net_to_host
- (vl_api_gpe_fwd_entries_get_reply_t * mp)
-{
- u32 i;
-
- mp->count = clib_net_to_host_u32 (mp->count);
- for (i = 0; i < mp->count; i++)
- {
- api_gpe_fwd_entry_net_to_host (&mp->entries[i]);
- }
-}
-
-static u8 *
-format_gpe_encap_mode (u8 * s, va_list * args)
-{
- u32 mode = va_arg (*args, u32);
-
- switch (mode)
- {
- case 0:
- return format (s, "lisp");
- case 1:
- return format (s, "vxlan");
- }
- return 0;
-}
-
-static void
- vl_api_gpe_get_encap_mode_reply_t_handler
- (vl_api_gpe_get_encap_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- print (vam->ofp, "gpe mode: %U", format_gpe_encap_mode, mp->encap_mode);
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_get_encap_mode_reply_t_handler_json
- (vl_api_gpe_get_encap_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- u8 *encap_mode = format (0, "%U", format_gpe_encap_mode, mp->encap_mode);
- vec_add1 (encap_mode, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "gpe_mode", encap_mode);
-
- vec_free (encap_mode);
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_fwd_entry_path_details_t_handler
- (vl_api_gpe_fwd_entry_path_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u8 *(*format_ip_address_fcn) (u8 *, va_list *) = 0;
-
- if (mp->lcl_loc.addr.af)
- format_ip_address_fcn = format_ip6_address;
- else
- format_ip_address_fcn = format_ip4_address;
-
- print (vam->ofp, "w:%d %30U %30U", mp->rmt_loc.weight,
- format_ip_address_fcn, &mp->lcl_loc.addr.un,
- format_ip_address_fcn, &mp->rmt_loc.addr.un);
-}
-
-static void
-lisp_fill_locator_node (vat_json_node_t * n, vl_api_gpe_locator_t * loc)
-{
- struct in6_addr ip6;
- struct in_addr ip4;
-
- if (loc->addr.af)
- {
- clib_memcpy (&ip6, loc->addr.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (n, "address", ip6);
- }
- else
- {
- clib_memcpy (&ip4, loc->addr.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (n, "address", ip4);
- }
- vat_json_object_add_uint (n, "weight", loc->weight);
-}
-
-static void
- vl_api_gpe_fwd_entry_path_details_t_handler_json
- (vl_api_gpe_fwd_entry_path_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- vat_json_node_t *loc_node;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
- vat_json_init_object (node);
-
- loc_node = vat_json_object_add (node, "local_locator");
- vat_json_init_object (loc_node);
- lisp_fill_locator_node (loc_node, &mp->lcl_loc);
-
- loc_node = vat_json_object_add (node, "remote_locator");
- vat_json_init_object (loc_node);
- lisp_fill_locator_node (loc_node, &mp->rmt_loc);
-}
-
-static void
- vl_api_gpe_fwd_entries_get_reply_t_handler
- (vl_api_gpe_fwd_entries_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i;
- int retval = clib_net_to_host_u32 (mp->retval);
- vl_api_gpe_fwd_entry_t *e;
-
- if (retval)
- goto end;
-
- gpe_fwd_entries_get_reply_t_net_to_host (mp);
-
- for (i = 0; i < mp->count; i++)
- {
- e = &mp->entries[i];
- print (vam->ofp, "%10d %10d %U %40U", e->fwd_entry_index, e->dp_table,
- format_lisp_flat_eid, e->leid, format_lisp_flat_eid, e->reid);
- }
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_fwd_entries_get_reply_t_handler_json
- (vl_api_gpe_fwd_entries_get_reply_t * mp)
-{
- u8 *s = 0;
- vat_main_t *vam = &vat_main;
- vat_json_node_t *e = 0, root;
- u32 i;
- int retval = clib_net_to_host_u32 (mp->retval);
- vl_api_gpe_fwd_entry_t *fwd;
-
- if (retval)
- goto end;
-
- gpe_fwd_entries_get_reply_t_net_to_host (mp);
- vat_json_init_array (&root);
-
- for (i = 0; i < mp->count; i++)
- {
- e = vat_json_array_add (&root);
- fwd = &mp->entries[i];
-
- vat_json_init_object (e);
- vat_json_object_add_int (e, "fwd_entry_index", fwd->fwd_entry_index);
- vat_json_object_add_int (e, "dp_table", fwd->dp_table);
- vat_json_object_add_int (e, "vni", fwd->vni);
- vat_json_object_add_int (e, "action", fwd->action);
-
- s = format (0, "%U", format_lisp_flat_eid, fwd->leid);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "leid", s);
- vec_free (s);
-
- s = format (0, "%U", format_lisp_flat_eid, fwd->reid);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "reid", s);
- vec_free (s);
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_native_fwd_rpaths_get_reply_t_handler
- (vl_api_gpe_native_fwd_rpaths_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
- vl_api_gpe_native_fwd_rpath_t *r;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- {
- r = &mp->entries[i];
- print (vam->ofp, "fib_index: %d sw_if_index %d nh %U",
- clib_net_to_host_u32 (r->fib_index),
- clib_net_to_host_u32 (r->nh_sw_if_index),
- r->nh_addr.af ? format_ip6_address : format_ip4_address,
- r->nh_addr.un);
- }
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_native_fwd_rpaths_get_reply_t_handler_json
- (vl_api_gpe_native_fwd_rpaths_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t root, *e;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
- vl_api_gpe_native_fwd_rpath_t *r;
- u8 *s;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- e = vat_json_array_add (&root);
- vat_json_init_object (e);
- r = &mp->entries[i];
- s =
- format (0, "%U",
- r->nh_addr.af ? format_ip6_address : format_ip4_address,
- r->nh_addr.un);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "ip4", s);
- vec_free (s);
-
- vat_json_object_add_uint (e, "fib_index",
- clib_net_to_host_u32 (r->fib_index));
- vat_json_object_add_uint (e, "nh_sw_if_index",
- clib_net_to_host_u32 (r->nh_sw_if_index));
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_fwd_entry_vnis_get_reply_t_handler
- (vl_api_gpe_fwd_entry_vnis_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- print (vam->ofp, "%d", clib_net_to_host_u32 (mp->vnis[i]));
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_gpe_fwd_entry_vnis_get_reply_t_handler_json
- (vl_api_gpe_fwd_entry_vnis_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t root;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- vat_json_array_add_uint (&root, clib_net_to_host_u32 (mp->vnis[i]));
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_ndp_entries_get_reply_t_handler
- (vl_api_one_ndp_entries_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- print (vam->ofp, "%U -> %U", format_ip6_address, &mp->entries[i].ip6,
- format_ethernet_address, mp->entries[i].mac);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_ndp_entries_get_reply_t_handler_json
- (vl_api_one_ndp_entries_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_one_ndp_entry_t *arp_entry;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- e = vat_json_array_add (&root);
- arp_entry = &mp->entries[i];
-
- vat_json_init_object (e);
- s = format (0, "%U", format_ethernet_address, arp_entry->mac);
- vec_add1 (s, 0);
-
- vat_json_object_add_string_copy (e, "mac", s);
- vec_free (s);
-
- s = format (0, "%U", format_ip6_address, &arp_entry->ip6);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "ip6", s);
- vec_free (s);
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_l2_arp_entries_get_reply_t_handler
- (vl_api_one_l2_arp_entries_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- print (vam->ofp, "%U -> %U", format_ip4_address, &mp->entries[i].ip4,
- format_ethernet_address, mp->entries[i].mac);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_l2_arp_entries_get_reply_t_handler_json
- (vl_api_one_l2_arp_entries_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_one_l2_arp_entry_t *arp_entry;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- e = vat_json_array_add (&root);
- arp_entry = &mp->entries[i];
-
- vat_json_init_object (e);
- s = format (0, "%U", format_ethernet_address, arp_entry->mac);
- vec_add1 (s, 0);
-
- vat_json_object_add_string_copy (e, "mac", s);
- vec_free (s);
-
- s = format (0, "%U", format_ip4_address, &arp_entry->ip4);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "ip4", s);
- vec_free (s);
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
-vl_api_one_ndp_bd_get_reply_t_handler (vl_api_one_ndp_bd_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- {
- print (vam->ofp, "%d", clib_net_to_host_u32 (mp->bridge_domains[i]));
- }
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_ndp_bd_get_reply_t_handler_json
- (vl_api_one_ndp_bd_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t root;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- vat_json_array_add_uint (&root,
- clib_net_to_host_u32 (mp->bridge_domains[i]));
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_l2_arp_bd_get_reply_t_handler
- (vl_api_one_l2_arp_bd_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- {
- print (vam->ofp, "%d", clib_net_to_host_u32 (mp->bridge_domains[i]));
- }
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_l2_arp_bd_get_reply_t_handler_json
- (vl_api_one_l2_arp_bd_get_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t root;
- u32 i, n;
- int retval = clib_net_to_host_u32 (mp->retval);
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- vat_json_array_add_uint (&root,
- clib_net_to_host_u32 (mp->bridge_domains[i]));
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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_one_adjacency_t *a;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
-
- for (i = 0; i < n; i++)
- {
- a = &mp->adjacencies[i];
- print (vam->ofp, "%U %40U",
- format_lisp_flat_eid, a->leid, format_lisp_flat_eid, a->reid);
- }
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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_one_adjacency_t *a;
-
- if (retval)
- goto end;
-
- n = clib_net_to_host_u32 (mp->count);
- vat_json_init_array (&root);
-
- for (i = 0; i < n; i++)
- {
- e = vat_json_array_add (&root);
- a = &mp->adjacencies[i];
-
- vat_json_init_object (e);
- s = format (0, "%U", format_lisp_flat_eid, a->leid);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "leid", s);
- vec_free (s);
-
- s = format (0, "%U", format_lisp_flat_eid, a->reid);
- vec_add1 (s, 0);
- vat_json_object_add_string_copy (e, "reid", s);
- vec_free (s);
- }
-
- vat_json_print (vam->ofp, &root);
- vat_json_free (&root);
-
-end:
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
-vl_api_one_map_server_details_t_handler (vl_api_one_map_server_details_t * mp)
-{
- vat_main_t *vam = &vat_main;
-
- print (vam->ofp, "%=20U",
- mp->ip_address.af ? format_ip6_address : format_ip4_address,
- mp->ip_address.un);
-}
-
-static void
- 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;
- struct in6_addr ip6;
- struct in_addr ip4;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- if (mp->ip_address.af)
- {
- clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "map-server", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "map-server", ip4);
- }
-}
-
-static void
-vl_api_one_map_resolver_details_t_handler (vl_api_one_map_resolver_details_t
- * mp)
-{
- vat_main_t *vam = &vat_main;
-
- print (vam->ofp, "%=20U",
- mp->ip_address.af ? format_ip6_address : format_ip4_address,
- mp->ip_address.un);
-}
-
-static void
- 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;
- struct in6_addr ip6;
- struct in_addr ip4;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- if (mp->ip_address.af)
- {
- clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (node, "map resolver", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (node, "map resolver", ip4);
- }
-}
-
-static void
-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);
-
- if (0 <= retval)
- {
- print (vam->ofp, "feature: %s\ngpe: %s",
- mp->feature_status ? "enabled" : "disabled",
- mp->gpe_status ? "enabled" : "disabled");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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;
- u8 *gpe_status = NULL;
- u8 *feature_status = NULL;
-
- gpe_status = format (0, "%s", mp->gpe_status ? "enabled" : "disabled");
- feature_status = format (0, "%s",
- mp->feature_status ? "enabled" : "disabled");
- vec_add1 (gpe_status, 0);
- vec_add1 (feature_status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "gpe_status", gpe_status);
- vat_json_object_add_string_copy (&node, "feature_status", feature_status);
-
- vec_free (gpe_status);
- vec_free (feature_status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- 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);
-
- if (retval >= 0)
- {
- print (vam->ofp, "%=20s", mp->locator_set_name);
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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;
-
- if (VAT_JSON_ARRAY != vam->json_tree.type)
- {
- ASSERT (VAT_JSON_NONE == vam->json_tree.type);
- vat_json_init_array (&vam->json_tree);
- }
- node = vat_json_array_add (&vam->json_tree);
-
- vat_json_init_object (node);
- vat_json_object_add_string_copy (node, "itr-rlocs", mp->locator_set_name);
-
- vat_json_print (vam->ofp, node);
- vat_json_free (node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-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 void
- 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);
-
- if (0 <= retval)
- {
- u32 mode = mp->mode;
- print (vam->ofp, "map_request_mode: %U",
- format_lisp_map_request_mode, mode);
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- 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;
- u8 *s = 0;
- u32 mode;
-
- mode = mp->mode;
- s = format (0, "%U", format_lisp_map_request_mode, mode);
- vec_add1 (s, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "map_request_mode", s);
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vec_free (s);
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_xtr_mode_reply_t_handler
- (vl_api_one_show_xtr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_xtr_mode_reply_t_handler_json
- (vl_api_one_show_xtr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *status = 0;
-
- status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "status", status);
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_pitr_mode_reply_t_handler
- (vl_api_one_show_pitr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_pitr_mode_reply_t_handler_json
- (vl_api_one_show_pitr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *status = 0;
-
- status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "status", status);
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_petr_mode_reply_t_handler
- (vl_api_one_show_petr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%s\n", mp->is_enable ? "enabled" : "disabled");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_one_show_petr_mode_reply_t_handler_json
- (vl_api_one_show_petr_mode_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *status = 0;
-
- status = format (0, "%s", mp->is_enable ? "enabled" : "disabled");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "status", status);
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_use_petr_reply_t_handler
- (vl_api_show_one_use_petr_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%s\n", mp->status ? "enabled" : "disabled");
- if (mp->status)
- {
- print (vam->ofp, "Proxy-ETR address; %U",
- mp->ip_address.af ? format_ip6_address : format_ip4_address,
- mp->ip_address.un);
- }
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_use_petr_reply_t_handler_json
- (vl_api_show_one_use_petr_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *status = 0;
- struct in_addr ip4;
- struct in6_addr ip6;
-
- status = format (0, "%s", mp->status ? "enabled" : "disabled");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "status", status);
- if (mp->status)
- {
- if (mp->ip_address.af)
- {
- clib_memcpy (&ip6, mp->ip_address.un.ip6, sizeof (ip6));
- vat_json_object_add_ip6 (&node, "address", ip6);
- }
- else
- {
- clib_memcpy (&ip4, mp->ip_address.un.ip4, sizeof (ip4));
- vat_json_object_add_ip4 (&node, "address", ip4);
- }
- }
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_nsh_mapping_reply_t_handler
- (vl_api_show_one_nsh_mapping_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%-20s%-16s",
- mp->is_set ? "set" : "not-set",
- mp->is_set ? (char *) mp->locator_set_name : "");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_nsh_mapping_reply_t_handler_json
- (vl_api_show_one_nsh_mapping_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
- u8 *status = 0;
-
- status = format (0, "%s", mp->is_set ? "yes" : "no");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "is_set", status);
- if (mp->is_set)
- {
- vat_json_object_add_string_copy (&node, "locator_set",
- mp->locator_set_name);
- }
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_map_register_ttl_reply_t_handler
- (vl_api_show_one_map_register_ttl_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- i32 retval = ntohl (mp->retval);
-
- vl_api_show_one_map_register_ttl_reply_t_endian (mp);
-
- if (0 <= retval)
- {
- print (vam->ofp, "ttl: %u", mp->ttl);
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
- vl_api_show_one_map_register_ttl_reply_t_handler_json
- (vl_api_show_one_map_register_ttl_reply_t * mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t node;
-
- vl_api_show_one_map_register_ttl_reply_t_endian (mp);
- vat_json_init_object (&node);
- vat_json_object_add_uint (&node, "ttl", mp->ttl);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
-static void
-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);
-
- if (0 <= retval)
- {
- print (vam->ofp, "%-20s%-16s",
- mp->status ? "enabled" : "disabled",
- mp->status ? (char *) mp->locator_set_name : "");
- }
-
- vam->retval = retval;
- vam->result_ready = 1;
-}
-
-static void
-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;
- u8 *status = 0;
-
- status = format (0, "%s", mp->status ? "enabled" : "disabled");
- vec_add1 (status, 0);
-
- vat_json_init_object (&node);
- vat_json_object_add_string_copy (&node, "status", status);
- if (mp->status)
- {
- vat_json_object_add_string_copy (&node, "locator_set",
- mp->locator_set_name);
- }
-
- vec_free (status);
-
- vat_json_print (vam->ofp, &node);
- vat_json_free (&node);
-
- vam->retval = ntohl (mp->retval);
- vam->result_ready = 1;
-}
-
static u8 *
format_policer_type (u8 * s, va_list * va)
{
@@ -5023,17 +3227,6 @@ static void vl_api_flow_classify_details_t_handler_json
vat_json_object_add_uint (node, "table_index", ntohl (mp->table_index));
}
-#define vl_api_one_adjacencies_get_reply_t_endian vl_noop_handler
-#define vl_api_one_adjacencies_get_reply_t_print vl_noop_handler
-#define vl_api_one_l2_arp_bd_get_reply_t_print vl_noop_handler
-#define vl_api_one_l2_arp_entries_get_reply_t_endian vl_noop_handler
-#define vl_api_one_l2_arp_entries_get_reply_t_print vl_noop_handler
-#define vl_api_one_l2_arp_bd_get_reply_t_endian vl_noop_handler
-#define vl_api_one_ndp_bd_get_reply_t_endian vl_noop_handler
-#define vl_api_one_ndp_bd_get_reply_t_print vl_noop_handler
-#define vl_api_one_ndp_entries_get_reply_t_print vl_noop_handler
-#define vl_api_one_ndp_entries_get_reply_t_endian vl_noop_handler
-
/*
* Generate boilerplate reply handlers, which
* dig the return value out of the xxx_reply_t API message,
@@ -5108,34 +3301,6 @@ _(cop_whitelist_enable_disable_reply) \
_(sw_interface_clear_stats_reply) \
_(ioam_enable_reply) \
_(ioam_disable_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_map_register_set_ttl_reply) \
-_(one_set_transport_protocol_reply) \
-_(one_map_register_fallback_threshold_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) \
-_(one_use_petr_reply) \
-_(one_stats_enable_disable_reply) \
-_(one_add_del_l2_arp_entry_reply) \
-_(one_add_del_ndp_entry_reply) \
-_(one_stats_flush_reply) \
-_(one_enable_disable_xtr_mode_reply) \
-_(one_enable_disable_pitr_mode_reply) \
-_(one_enable_disable_petr_mode_reply) \
-_(gpe_enable_disable_reply) \
-_(gpe_set_encap_mode_reply) \
-_(gpe_add_del_iface_reply) \
-_(gpe_add_del_native_fwd_rpath_reply) \
_(af_packet_delete_reply) \
_(policer_classify_set_interface_reply) \
_(set_ipfix_exporter_reply) \
@@ -5324,81 +3489,6 @@ _(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) \
-_(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_MAP_REGISTER_SET_TTL_REPLY, one_map_register_set_ttl_reply) \
-_(ONE_SET_TRANSPORT_PROTOCOL_REPLY, one_set_transport_protocol_reply) \
-_(ONE_GET_TRANSPORT_PROTOCOL_REPLY, one_get_transport_protocol_reply) \
-_(ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY, \
- one_map_register_fallback_threshold_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_USE_PETR_REPLY, one_use_petr_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) \
-_(ONE_STATS_DETAILS, one_stats_details) \
-_(ONE_STATS_FLUSH_REPLY, one_stats_flush_reply) \
-_(ONE_STATS_ENABLE_DISABLE_REPLY, one_stats_enable_disable_reply) \
-_(SHOW_ONE_STATS_ENABLE_DISABLE_REPLY, \
- show_one_stats_enable_disable_reply) \
-_(ONE_ADD_DEL_NDP_ENTRY_REPLY, one_add_del_ndp_entry_reply) \
-_(ONE_NDP_BD_GET_REPLY, one_ndp_bd_get_reply) \
-_(ONE_NDP_ENTRIES_GET_REPLY, one_ndp_entries_get_reply) \
-_(ONE_ADD_DEL_L2_ARP_ENTRY_REPLY, one_add_del_l2_arp_entry_reply) \
-_(ONE_L2_ARP_BD_GET_REPLY, one_l2_arp_bd_get_reply) \
-_(ONE_L2_ARP_ENTRIES_GET_REPLY, one_l2_arp_entries_get_reply) \
-_(ONE_ENABLE_DISABLE_XTR_MODE_REPLY, one_enable_disable_xtr_mode_reply) \
-_(ONE_ENABLE_DISABLE_PITR_MODE_REPLY, \
- one_enable_disable_pitr_mode_reply) \
-_(ONE_ENABLE_DISABLE_PETR_MODE_REPLY, \
- one_enable_disable_petr_mode_reply) \
-_(ONE_SHOW_XTR_MODE_REPLY, one_show_xtr_mode_reply) \
-_(ONE_SHOW_PITR_MODE_REPLY, one_show_pitr_mode_reply) \
-_(ONE_SHOW_PETR_MODE_REPLY, one_show_petr_mode_reply) \
-_(GPE_SET_ENCAP_MODE_REPLY, gpe_set_encap_mode_reply) \
-_(GPE_GET_ENCAP_MODE_REPLY, gpe_get_encap_mode_reply) \
-_(GPE_ADD_DEL_IFACE_REPLY, gpe_add_del_iface_reply) \
-_(GPE_ENABLE_DISABLE_REPLY, gpe_enable_disable_reply) \
-_(GPE_ADD_DEL_FWD_ENTRY_REPLY, gpe_add_del_fwd_entry_reply) \
-_(GPE_FWD_ENTRY_VNIS_GET_REPLY, gpe_fwd_entry_vnis_get_reply) \
-_(GPE_FWD_ENTRIES_GET_REPLY, gpe_fwd_entries_get_reply) \
-_(GPE_NATIVE_FWD_RPATHS_GET_REPLY, gpe_native_fwd_rpaths_get_reply) \
-_(GPE_ADD_DEL_NATIVE_FWD_RPATH_REPLY, \
- gpe_add_del_native_fwd_rpath_reply) \
-_(GPE_FWD_ENTRY_PATH_DETAILS, \
- gpe_fwd_entry_path_details) \
-_(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_NSH_MAPPING_REPLY, show_one_nsh_mapping_reply) \
-_(SHOW_ONE_PITR_REPLY, show_one_pitr_reply) \
-_(SHOW_ONE_USE_PETR_REPLY, show_one_use_petr_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) \
-_(SHOW_ONE_MAP_REGISTER_TTL_REPLY, show_one_map_register_ttl_reply) \
-_(SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD_REPLY, \
- show_one_map_register_fallback_threshold_reply) \
_(AF_PACKET_CREATE_REPLY, af_packet_create_reply) \
_(AF_PACKET_DELETE_REPLY, af_packet_delete_reply) \
_(AF_PACKET_DETAILS, af_packet_details) \
@@ -13589,3002 +11679,6 @@ api_get_node_graph (vat_main_t * vam)
return ret;
}
-/* *INDENT-OFF* */
-/** Used for parsing LISP eids */
-typedef CLIB_PACKED(struct{
- union {
- ip46_address_t ip;
- mac_address_t mac;
- lisp_nsh_api_t nsh;
- } addr;
- u32 len; /**< prefix length if IP */
- u8 type; /**< type of eid */
-}) lisp_eid_vat_t;
-/* *INDENT-ON* */
-
-static uword
-unformat_lisp_eid_vat (unformat_input_t * input, va_list * args)
-{
- lisp_eid_vat_t *a = va_arg (*args, lisp_eid_vat_t *);
-
- clib_memset (a, 0, sizeof (a[0]));
-
- if (unformat (input, "%U/%d", unformat_ip46_address, a->addr.ip, &a->len))
- {
- a->type = 0; /* ip prefix type */
- }
- else if (unformat (input, "%U", unformat_ethernet_address, &a->addr.mac))
- {
- a->type = 1; /* mac type */
- }
- else if (unformat (input, "%U", unformat_nsh_address, a->addr.nsh))
- {
- a->type = 2; /* NSH type */
- a->addr.nsh.spi = clib_host_to_net_u32 (a->addr.nsh.spi);
- }
- else
- {
- return 0;
- }
-
- if (a->type == 0)
- {
- if (ip46_address_is_ip4 (&a->addr.ip))
- return a->len > 32 ? 1 : 0;
- else
- return a->len > 128 ? 1 : 0;
- }
-
- return 1;
-}
-
-static void
-lisp_eid_put_vat (vl_api_eid_t * eid, const lisp_eid_vat_t * vat_eid)
-{
- eid->type = vat_eid->type;
- switch (eid->type)
- {
- case EID_TYPE_API_PREFIX:
- if (ip46_address_is_ip4 (&vat_eid->addr.ip))
- {
- clib_memcpy (&eid->address.prefix.address.un.ip4,
- &vat_eid->addr.ip.ip4, 4);
- eid->address.prefix.address.af = ADDRESS_IP4;
- eid->address.prefix.len = vat_eid->len;
- }
- else
- {
- clib_memcpy (&eid->address.prefix.address.un.ip6,
- &vat_eid->addr.ip.ip6, 16);
- eid->address.prefix.address.af = ADDRESS_IP6;
- eid->address.prefix.len = vat_eid->len;
- }
- return;
- case EID_TYPE_API_MAC:
- clib_memcpy (&eid->address.mac, &vat_eid->addr.mac,
- sizeof (eid->address.mac));
- return;
- case EID_TYPE_API_NSH:
- clib_memcpy (&eid->address.nsh, &vat_eid->addr.nsh,
- sizeof (eid->address.nsh));
- return;
- default:
- ASSERT (0);
- return;
- }
-}
-
-static int
-api_one_add_del_locator_set (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_locator_set_t *mp;
- u8 is_add = 1;
- u8 *locator_set_name = NULL;
- u8 locator_set_name_set = 0;
- vl_api_local_locator_t locator, *locators = 0;
- u32 sw_if_index, priority, weight;
- u32 data_len = 0;
-
- int ret;
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "locator-set %s", &locator_set_name))
- {
- locator_set_name_set = 1;
- }
- else if (unformat (input, "sw_if_index %u p %u w %u",
- &sw_if_index, &priority, &weight))
- {
- locator.sw_if_index = htonl (sw_if_index);
- locator.priority = priority;
- locator.weight = weight;
- vec_add1 (locators, locator);
- }
- else
- if (unformat
- (input, "iface %U p %u w %u", api_unformat_sw_if_index, vam,
- &sw_if_index, &priority, &weight))
- {
- locator.sw_if_index = htonl (sw_if_index);
- locator.priority = priority;
- locator.weight = weight;
- vec_add1 (locators, locator);
- }
- else
- break;
- }
-
- if (locator_set_name_set == 0)
- {
- errmsg ("missing locator-set name");
- vec_free (locators);
- return -99;
- }
-
- if (vec_len (locator_set_name) > 64)
- {
- errmsg ("locator-set name too long");
- vec_free (locator_set_name);
- vec_free (locators);
- return -99;
- }
- vec_add1 (locator_set_name, 0);
-
- data_len = sizeof (vl_api_local_locator_t) * vec_len (locators);
-
- /* Construct the API message */
- M2 (ONE_ADD_DEL_LOCATOR_SET, mp, data_len);
-
- mp->is_add = is_add;
- clib_memcpy (mp->locator_set_name, locator_set_name,
- vec_len (locator_set_name));
- vec_free (locator_set_name);
-
- mp->locator_num = clib_host_to_net_u32 (vec_len (locators));
- if (locators)
- clib_memcpy (mp->locators, locators, data_len);
- vec_free (locators);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_add_del_locator_set api_one_add_del_locator_set
-
-static int
-api_one_add_del_locator (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_locator_t *mp;
- u32 tmp_if_index = ~0;
- u32 sw_if_index = ~0;
- u8 sw_if_index_set = 0;
- u8 sw_if_index_if_name_set = 0;
- u32 priority = ~0;
- u8 priority_set = 0;
- u32 weight = ~0;
- u8 weight_set = 0;
- u8 is_add = 1;
- u8 *locator_set_name = NULL;
- u8 locator_set_name_set = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "locator-set %s", &locator_set_name))
- {
- locator_set_name_set = 1;
- }
- else if (unformat (input, "iface %U", api_unformat_sw_if_index, vam,
- &tmp_if_index))
- {
- sw_if_index_if_name_set = 1;
- sw_if_index = tmp_if_index;
- }
- else if (unformat (input, "sw_if_index %d", &tmp_if_index))
- {
- sw_if_index_set = 1;
- sw_if_index = tmp_if_index;
- }
- else if (unformat (input, "p %d", &priority))
- {
- priority_set = 1;
- }
- else if (unformat (input, "w %d", &weight))
- {
- weight_set = 1;
- }
- else
- break;
- }
-
- if (locator_set_name_set == 0)
- {
- errmsg ("missing locator-set name");
- return -99;
- }
-
- if (sw_if_index_set == 0 && sw_if_index_if_name_set == 0)
- {
- errmsg ("missing sw_if_index");
- vec_free (locator_set_name);
- return -99;
- }
-
- if (sw_if_index_set != 0 && sw_if_index_if_name_set != 0)
- {
- errmsg ("cannot use both params interface name and sw_if_index");
- vec_free (locator_set_name);
- return -99;
- }
-
- if (priority_set == 0)
- {
- errmsg ("missing locator-set priority");
- vec_free (locator_set_name);
- return -99;
- }
-
- if (weight_set == 0)
- {
- errmsg ("missing locator-set weight");
- vec_free (locator_set_name);
- return -99;
- }
-
- if (vec_len (locator_set_name) > 64)
- {
- errmsg ("locator-set name too long");
- vec_free (locator_set_name);
- return -99;
- }
- vec_add1 (locator_set_name, 0);
-
- /* Construct the API message */
- M (ONE_ADD_DEL_LOCATOR, mp);
-
- mp->is_add = is_add;
- mp->sw_if_index = ntohl (sw_if_index);
- mp->priority = priority;
- mp->weight = weight;
- clib_memcpy (mp->locator_set_name, locator_set_name,
- vec_len (locator_set_name));
- vec_free (locator_set_name);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- 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)
-{
- u32 *key_id = va_arg (*args, u32 *);
- u8 *s = 0;
-
- if (unformat (input, "%s", &s))
- {
- if (!strcmp ((char *) s, "sha1"))
- key_id[0] = HMAC_SHA_1_96;
- else if (!strcmp ((char *) s, "sha256"))
- key_id[0] = HMAC_SHA_256_128;
- else
- {
- clib_warning ("invalid key_id: '%s'", s);
- key_id[0] = HMAC_NO_KEY;
- }
- }
- else
- return 0;
-
- vec_free (s);
- return 1;
-}
-
-static int
-api_one_add_del_local_eid (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_local_eid_t *mp;
- u8 is_add = 1;
- u8 eid_set = 0;
- lisp_eid_vat_t _eid, *eid = &_eid;
- u8 *locator_set_name = 0;
- u8 locator_set_name_set = 0;
- u32 vni = 0;
- u16 key_id = 0;
- u8 *key = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "vni %d", &vni))
- {
- ;
- }
- else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
- {
- eid_set = 1;
- }
- else if (unformat (input, "locator-set %s", &locator_set_name))
- {
- locator_set_name_set = 1;
- }
- else if (unformat (input, "key-id %U", unformat_hmac_key_id, &key_id))
- ;
- else if (unformat (input, "secret-key %_%v%_", &key))
- ;
- else
- break;
- }
-
- if (locator_set_name_set == 0)
- {
- errmsg ("missing locator-set name");
- return -99;
- }
-
- if (0 == eid_set)
- {
- errmsg ("EID address not set!");
- vec_free (locator_set_name);
- return -99;
- }
-
- if (key && (0 == key_id))
- {
- errmsg ("invalid key_id!");
- return -99;
- }
-
- if (vec_len (key) > 64)
- {
- errmsg ("key too long");
- vec_free (key);
- return -99;
- }
-
- if (vec_len (locator_set_name) > 64)
- {
- errmsg ("locator-set name too long");
- vec_free (locator_set_name);
- return -99;
- }
- vec_add1 (locator_set_name, 0);
-
- /* Construct the API message */
- M (ONE_ADD_DEL_LOCAL_EID, mp);
-
- mp->is_add = is_add;
- lisp_eid_put_vat (&mp->eid, eid);
- mp->vni = clib_host_to_net_u32 (vni);
- mp->key.id = key_id;
- clib_memcpy (mp->locator_set_name, locator_set_name,
- vec_len (locator_set_name));
- clib_memcpy (mp->key.key, key, vec_len (key));
-
- vec_free (locator_set_name);
- vec_free (key);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#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)
-{
- u32 dp_table = 0, vni = 0;;
- unformat_input_t *input = vam->input;
- vl_api_gpe_add_del_fwd_entry_t *mp;
- u8 is_add = 1;
- lisp_eid_vat_t _rmt_eid, *rmt_eid = &_rmt_eid;
- lisp_eid_vat_t _lcl_eid, *lcl_eid = &_lcl_eid;
- u8 rmt_eid_set = 0, lcl_eid_set = 0;
- u32 action = ~0, w;
- ip4_address_t rmt_rloc4, lcl_rloc4;
- ip6_address_t rmt_rloc6, lcl_rloc6;
- vl_api_gpe_locator_t *rmt_locs = 0, *lcl_locs = 0, rloc, *curr_rloc = 0;
- int ret;
-
- clib_memset (&rloc, 0, sizeof (rloc));
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "add"))
- is_add = 1;
- else if (unformat (input, "reid %U", unformat_lisp_eid_vat, rmt_eid))
- {
- rmt_eid_set = 1;
- }
- else if (unformat (input, "leid %U", unformat_lisp_eid_vat, lcl_eid))
- {
- lcl_eid_set = 1;
- }
- else if (unformat (input, "vrf %d", &dp_table))
- ;
- else if (unformat (input, "bd %d", &dp_table))
- ;
- else if (unformat (input, "vni %d", &vni))
- ;
- else if (unformat (input, "w %d", &w))
- {
- if (!curr_rloc)
- {
- errmsg ("No RLOC configured for setting priority/weight!");
- return -99;
- }
- curr_rloc->weight = w;
- }
- else if (unformat (input, "loc-pair %U %U", unformat_ip4_address,
- &lcl_rloc4, unformat_ip4_address, &rmt_rloc4))
- {
- rloc.addr.af = 0;
- clib_memcpy (&rloc.addr.un.ip4, &lcl_rloc4, sizeof (lcl_rloc4));
- rloc.weight = 0;
- vec_add1 (lcl_locs, rloc);
-
- clib_memcpy (&rloc.addr.un.ip4, &rmt_rloc4, sizeof (rmt_rloc4));
- vec_add1 (rmt_locs, rloc);
- /* weight saved in rmt loc */
- curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
- }
- else if (unformat (input, "loc-pair %U %U", unformat_ip6_address,
- &lcl_rloc6, unformat_ip6_address, &rmt_rloc6))
- {
- rloc.addr.af = 1;
- clib_memcpy (&rloc.addr.un.ip6, &lcl_rloc6, sizeof (lcl_rloc6));
- rloc.weight = 0;
- vec_add1 (lcl_locs, rloc);
-
- clib_memcpy (&rloc.addr.un.ip6, &rmt_rloc6, sizeof (rmt_rloc6));
- vec_add1 (rmt_locs, rloc);
- /* weight saved in rmt loc */
- curr_rloc = &rmt_locs[vec_len (rmt_locs) - 1];
- }
- else if (unformat (input, "action %d", &action))
- {
- ;
- }
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!rmt_eid_set)
- {
- errmsg ("remote eid addresses not set");
- return -99;
- }
-
- if (lcl_eid_set && rmt_eid->type != lcl_eid->type)
- {
- errmsg ("eid types don't match");
- return -99;
- }
-
- if (0 == rmt_locs && (u32) ~ 0 == action)
- {
- errmsg ("action not set for negative mapping");
- return -99;
- }
-
- /* Construct the API message */
- M2 (GPE_ADD_DEL_FWD_ENTRY, mp,
- sizeof (vl_api_gpe_locator_t) * vec_len (rmt_locs) * 2);
-
- mp->is_add = is_add;
- lisp_eid_put_vat (&mp->rmt_eid, rmt_eid);
- lisp_eid_put_vat (&mp->lcl_eid, lcl_eid);
- mp->dp_table = clib_host_to_net_u32 (dp_table);
- mp->vni = clib_host_to_net_u32 (vni);
- mp->action = action;
-
- if (0 != rmt_locs && 0 != lcl_locs)
- {
- mp->loc_num = clib_host_to_net_u32 (vec_len (rmt_locs) * 2);
- clib_memcpy (mp->locs, lcl_locs,
- (sizeof (vl_api_gpe_locator_t) * vec_len (lcl_locs)));
-
- u32 offset = sizeof (vl_api_gpe_locator_t) * vec_len (lcl_locs);
- clib_memcpy (((u8 *) mp->locs) + offset, rmt_locs,
- (sizeof (vl_api_gpe_locator_t) * vec_len (rmt_locs)));
- }
- vec_free (lcl_locs);
- vec_free (rmt_locs);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_add_del_map_server (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_map_server_t *mp;
- u8 is_add = 1;
- u8 ipv4_set = 0;
- u8 ipv6_set = 0;
- ip4_address_t ipv4;
- ip6_address_t ipv6;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
- {
- ipv4_set = 1;
- }
- else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
- {
- ipv6_set = 1;
- }
- else
- break;
- }
-
- if (ipv4_set && ipv6_set)
- {
- errmsg ("both eid v4 and v6 addresses set");
- return -99;
- }
-
- if (!ipv4_set && !ipv6_set)
- {
- errmsg ("eid addresses not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ADD_DEL_MAP_SERVER, mp);
-
- mp->is_add = is_add;
- if (ipv6_set)
- {
- mp->ip_address.af = 1;
- clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
- }
- else
- {
- mp->ip_address.af = 0;
- clib_memcpy (mp->ip_address.un.ip4, &ipv4, sizeof (ipv4));
- }
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_add_del_map_server api_one_add_del_map_server
-
-static int
-api_one_add_del_map_resolver (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_map_resolver_t *mp;
- u8 is_add = 1;
- u8 ipv4_set = 0;
- u8 ipv6_set = 0;
- ip4_address_t ipv4;
- ip6_address_t ipv6;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "%U", unformat_ip4_address, &ipv4))
- {
- ipv4_set = 1;
- }
- else if (unformat (input, "%U", unformat_ip6_address, &ipv6))
- {
- ipv6_set = 1;
- }
- else
- break;
- }
-
- if (ipv4_set && ipv6_set)
- {
- errmsg ("both eid v4 and v6 addresses set");
- return -99;
- }
-
- if (!ipv4_set && !ipv6_set)
- {
- errmsg ("eid addresses not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ADD_DEL_MAP_RESOLVER, mp);
-
- mp->is_add = is_add;
- if (ipv6_set)
- {
- mp->ip_address.af = 1;
- clib_memcpy (mp->ip_address.un.ip6, &ipv6, sizeof (ipv6));
- }
- else
- {
- mp->ip_address.af = 0;
- clib_memcpy (mp->ip_address.un.ip6, &ipv4, sizeof (ipv4));
- }
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- 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)
-{
- unformat_input_t *input = vam->input;
- vl_api_gpe_enable_disable_t *mp;
- u8 is_set = 0;
- u8 is_enable = 1;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- is_enable = 0;
- }
- else
- break;
- }
-
- if (is_set == 0)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (GPE_ENABLE_DISABLE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_rloc_probe_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_rloc_probe_enable_disable_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- is_set = 1;
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_RLOC_PROBE_ENABLE_DISABLE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_rloc_probe_enable_disable api_one_rloc_probe_enable_disable
-
-static int
-api_one_map_register_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_map_register_enable_disable_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- is_set = 1;
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_MAP_REGISTER_ENABLE_DISABLE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_map_register_enable_disable api_one_map_register_enable_disable
-
-static int
-api_one_enable_disable (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_enable_disable_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- }
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ENABLE_DISABLE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_enable_disable api_one_enable_disable
-
-static int
-api_one_enable_disable_xtr_mode (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_enable_disable_xtr_mode_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- }
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ENABLE_DISABLE_XTR_MODE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_show_xtr_mode (vat_main_t * vam)
-{
- vl_api_one_show_xtr_mode_t *mp;
- int ret;
-
- /* Construct the API message */
- M (ONE_SHOW_XTR_MODE, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_enable_disable_pitr_mode (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_enable_disable_pitr_mode_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- }
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ENABLE_DISABLE_PITR_MODE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_show_pitr_mode (vat_main_t * vam)
-{
- vl_api_one_show_pitr_mode_t *mp;
- int ret;
-
- /* Construct the API message */
- M (ONE_SHOW_PITR_MODE, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_enable_disable_petr_mode (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_enable_disable_petr_mode_t *mp;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- }
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- /* Construct the API message */
- M (ONE_ENABLE_DISABLE_PETR_MODE, mp);
-
- mp->is_enable = is_enable;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_show_petr_mode (vat_main_t * vam)
-{
- vl_api_one_show_petr_mode_t *mp;
- int ret;
-
- /* Construct the API message */
- M (ONE_SHOW_PETR_MODE, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_map_register_state (vat_main_t * vam)
-{
- vl_api_show_one_map_register_state_t *mp;
- int ret;
-
- M (SHOW_ONE_MAP_REGISTER_STATE, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_map_register_state api_show_one_map_register_state
-
-static int
-api_show_one_rloc_probe_state (vat_main_t * vam)
-{
- vl_api_show_one_rloc_probe_state_t *mp;
- int ret;
-
- M (SHOW_ONE_RLOC_PROBE_STATE, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_rloc_probe_state api_show_one_rloc_probe_state
-
-static int
-api_one_add_del_ndp_entry (vat_main_t * vam)
-{
- vl_api_one_add_del_ndp_entry_t *mp;
- unformat_input_t *input = vam->input;
- u8 is_add = 1;
- u8 mac_set = 0;
- u8 bd_set = 0;
- u8 ip_set = 0;
- u8 mac[6] = { 0, };
- u8 ip6[16] = { 0, };
- u32 bd = ~0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "mac %U", unformat_ethernet_address, mac))
- mac_set = 1;
- else if (unformat (input, "ip %U", unformat_ip6_address, ip6))
- ip_set = 1;
- else if (unformat (input, "bd %d", &bd))
- bd_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!bd_set || !ip_set || (!mac_set && is_add))
- {
- errmsg ("Missing BD, IP or MAC!");
- return -99;
- }
-
- M (ONE_ADD_DEL_NDP_ENTRY, mp);
- mp->is_add = is_add;
- clib_memcpy (&mp->entry.mac, mac, 6);
- mp->bd = clib_host_to_net_u32 (bd);
- clib_memcpy (&mp->entry.ip6, ip6, sizeof (mp->entry.ip6));
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_add_del_l2_arp_entry (vat_main_t * vam)
-{
- vl_api_one_add_del_l2_arp_entry_t *mp;
- unformat_input_t *input = vam->input;
- u8 is_add = 1;
- u8 mac_set = 0;
- u8 bd_set = 0;
- u8 ip_set = 0;
- u8 mac[6] = { 0, };
- u32 ip4 = 0, bd = ~0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "mac %U", unformat_ethernet_address, mac))
- mac_set = 1;
- else if (unformat (input, "ip %U", unformat_ip4_address, &ip4))
- ip_set = 1;
- else if (unformat (input, "bd %d", &bd))
- bd_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!bd_set || !ip_set || (!mac_set && is_add))
- {
- errmsg ("Missing BD, IP or MAC!");
- return -99;
- }
-
- M (ONE_ADD_DEL_L2_ARP_ENTRY, mp);
- mp->is_add = is_add;
- clib_memcpy (&mp->entry.mac, mac, 6);
- mp->bd = clib_host_to_net_u32 (bd);
- clib_memcpy (mp->entry.ip4, &ip4, sizeof (mp->entry.ip4));
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_ndp_bd_get (vat_main_t * vam)
-{
- vl_api_one_ndp_bd_get_t *mp;
- int ret;
-
- M (ONE_NDP_BD_GET, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_ndp_entries_get (vat_main_t * vam)
-{
- vl_api_one_ndp_entries_get_t *mp;
- unformat_input_t *input = vam->input;
- u8 bd_set = 0;
- u32 bd = ~0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "bd %d", &bd))
- bd_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!bd_set)
- {
- errmsg ("Expected bridge domain!");
- return -99;
- }
-
- M (ONE_NDP_ENTRIES_GET, mp);
- mp->bd = clib_host_to_net_u32 (bd);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_l2_arp_bd_get (vat_main_t * vam)
-{
- vl_api_one_l2_arp_bd_get_t *mp;
- int ret;
-
- M (ONE_L2_ARP_BD_GET, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_l2_arp_entries_get (vat_main_t * vam)
-{
- vl_api_one_l2_arp_entries_get_t *mp;
- unformat_input_t *input = vam->input;
- u8 bd_set = 0;
- u32 bd = ~0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "bd %d", &bd))
- bd_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!bd_set)
- {
- errmsg ("Expected bridge domain!");
- return -99;
- }
-
- M (ONE_L2_ARP_ENTRIES_GET, mp);
- mp->bd = clib_host_to_net_u32 (bd);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_one_stats_enable_disable (vat_main_t * vam)
-{
- vl_api_one_stats_enable_disable_t *mp;
- unformat_input_t *input = vam->input;
- u8 is_set = 0;
- u8 is_enable = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "enable"))
- {
- is_set = 1;
- is_enable = 1;
- }
- else if (unformat (input, "disable"))
- {
- is_set = 1;
- }
- else
- break;
- }
-
- if (!is_set)
- {
- errmsg ("Value not set");
- return -99;
- }
-
- M (ONE_STATS_ENABLE_DISABLE, mp);
- mp->is_enable = is_enable;
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_stats_enable_disable (vat_main_t * vam)
-{
- vl_api_show_one_stats_enable_disable_t *mp;
- int ret;
-
- M (SHOW_ONE_STATS_ENABLE_DISABLE, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_map_request_mode (vat_main_t * vam)
-{
- vl_api_show_one_map_request_mode_t *mp;
- int ret;
-
- M (SHOW_ONE_MAP_REQUEST_MODE, mp);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_map_request_mode api_show_one_map_request_mode
-
-static int
-api_one_map_request_mode (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_map_request_mode_t *mp;
- u8 mode = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "dst-only"))
- mode = 0;
- else if (unformat (input, "src-dst"))
- mode = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- M (ONE_MAP_REQUEST_MODE, mp);
-
- mp->mode = mode;
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_lisp_map_request_mode api_one_map_request_mode
-
-/**
- * Enable/disable ONE proxy ITR.
- *
- * @param vam vpp API test context
- * @return return code
- */
-static int
-api_one_pitr_set_locator_set (vat_main_t * vam)
-{
- u8 ls_name_set = 0;
- unformat_input_t *input = vam->input;
- vl_api_one_pitr_set_locator_set_t *mp;
- u8 is_add = 1;
- u8 *ls_name = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "locator-set %s", &ls_name))
- ls_name_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!ls_name_set)
- {
- errmsg ("locator-set name not set!");
- return -99;
- }
-
- M (ONE_PITR_SET_LOCATOR_SET, mp);
-
- mp->is_add = is_add;
- clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
- vec_free (ls_name);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_lisp_pitr_set_locator_set api_one_pitr_set_locator_set
-
-static int
-api_one_nsh_set_locator_set (vat_main_t * vam)
-{
- u8 ls_name_set = 0;
- unformat_input_t *input = vam->input;
- vl_api_one_nsh_set_locator_set_t *mp;
- u8 is_add = 1;
- u8 *ls_name = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "ls %s", &ls_name))
- ls_name_set = 1;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!ls_name_set && is_add)
- {
- errmsg ("locator-set name not set!");
- return -99;
- }
-
- M (ONE_NSH_SET_LOCATOR_SET, mp);
-
- mp->is_add = is_add;
- clib_memcpy (mp->ls_name, ls_name, vec_len (ls_name));
- vec_free (ls_name);
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_pitr (vat_main_t * vam)
-{
- vl_api_show_one_pitr_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "lisp status:");
- }
-
- M (SHOW_ONE_PITR, mp);
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_pitr api_show_one_pitr
-
-static int
-api_one_use_petr (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_use_petr_t *mp;
- u8 is_add = 0;
- ip_address_t ip;
- int ret;
-
- clib_memset (&ip, 0, sizeof (ip));
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "disable"))
- is_add = 0;
- else
- if (unformat (input, "%U", unformat_ip4_address, &ip_addr_v4 (&ip)))
- {
- is_add = 1;
- ip_addr_version (&ip) = AF_IP4;
- }
- else
- if (unformat (input, "%U", unformat_ip6_address, &ip_addr_v6 (&ip)))
- {
- is_add = 1;
- ip_addr_version (&ip) = AF_IP6;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- M (ONE_USE_PETR, mp);
-
- mp->is_add = is_add;
- if (is_add)
- {
- mp->ip_address.af = ip_addr_version (&ip) == AF_IP4 ? 0 : 1;
- if (mp->ip_address.af)
- clib_memcpy (mp->ip_address.un.ip6, &ip, 16);
- else
- clib_memcpy (mp->ip_address.un.ip4, &ip, 4);
- }
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- return ret;
-}
-
-#define api_lisp_use_petr api_one_use_petr
-
-static int
-api_show_one_nsh_mapping (vat_main_t * vam)
-{
- vl_api_show_one_use_petr_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "local ONE NSH mapping:");
- }
-
- M (SHOW_ONE_NSH_MAPPING, mp);
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_use_petr (vat_main_t * vam)
-{
- vl_api_show_one_use_petr_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "Proxy-ETR status:");
- }
-
- M (SHOW_ONE_USE_PETR, mp);
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_use_petr api_show_one_use_petr
-
-/**
- * Add/delete mapping between vni and vrf
- */
-static int
-api_one_eid_table_add_del_map (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- 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;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- is_add = 0;
- else if (unformat (input, "vrf %d", &vrf))
- vrf_set = 1;
- else if (unformat (input, "bd_index %d", &bd_index))
- bd_index_set = 1;
- else if (unformat (input, "vni %d", &vni))
- vni_set = 1;
- else
- break;
- }
-
- if (!vni_set || (!vrf_set && !bd_index_set))
- {
- errmsg ("missing arguments!");
- return -99;
- }
-
- if (vrf_set && bd_index_set)
- {
- errmsg ("error: both vrf and bd entered!");
- return -99;
- }
-
- M (ONE_EID_TABLE_ADD_DEL_MAP, mp);
-
- mp->is_add = is_add;
- mp->vni = htonl (vni);
- mp->dp_table = vrf_set ? htonl (vrf) : htonl (bd_index);
- mp->is_l2 = bd_index_set;
-
- /* send */
- S (mp);
-
- /* wait for reply */
- W (ret);
- 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)
-{
- u32 *action = va_arg (*args, u32 *);
- u8 *s = 0;
-
- if (unformat (input, "%s", &s))
- {
- if (!strcmp ((char *) s, "no-action"))
- action[0] = 0;
- else if (!strcmp ((char *) s, "natively-forward"))
- action[0] = 1;
- else if (!strcmp ((char *) s, "send-map-request"))
- action[0] = 2;
- else if (!strcmp ((char *) s, "drop"))
- action[0] = 3;
- else
- {
- clib_warning ("invalid action: '%s'", s);
- action[0] = 3;
- }
- }
- else
- return 0;
-
- vec_free (s);
- return 1;
-}
-
-/**
- * Add/del remote mapping to/from ONE control plane
- *
- * @param vam vpp API test context
- * @return return code
- */
-static int
-api_one_add_del_remote_mapping (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- 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;
- u8 is_add = 1, del_all = 0, eid_set = 0, seid_set = 0;
- u32 action = ~0, p, w, data_len;
- ip4_address_t rloc4;
- ip6_address_t rloc6;
- vl_api_remote_locator_t *rlocs = 0, rloc, *curr_rloc = 0;
- int ret;
-
- clib_memset (&rloc, 0, sizeof (rloc));
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del-all"))
- {
- del_all = 1;
- }
- else if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "add"))
- {
- is_add = 1;
- }
- else if (unformat (input, "eid %U", unformat_lisp_eid_vat, eid))
- {
- eid_set = 1;
- }
- else if (unformat (input, "seid %U", unformat_lisp_eid_vat, seid))
- {
- seid_set = 1;
- }
- else if (unformat (input, "vni %d", &vni))
- {
- ;
- }
- else if (unformat (input, "p %d w %d", &p, &w))
- {
- if (!curr_rloc)
- {
- errmsg ("No RLOC configured for setting priority/weight!");
- return -99;
- }
- curr_rloc->priority = p;
- curr_rloc->weight = w;
- }
- else if (unformat (input, "rloc %U", unformat_ip4_address, &rloc4))
- {
- rloc.ip_address.af = 0;
- clib_memcpy (&rloc.ip_address.un.ip6, &rloc6, sizeof (rloc6));
- vec_add1 (rlocs, rloc);
- curr_rloc = &rlocs[vec_len (rlocs) - 1];
- }
- else if (unformat (input, "rloc %U", unformat_ip6_address, &rloc6))
- {
- rloc.ip_address.af = 1;
- clib_memcpy (&rloc.ip_address.un.ip4, &rloc4, sizeof (rloc4));
- vec_add1 (rlocs, rloc);
- curr_rloc = &rlocs[vec_len (rlocs) - 1];
- }
- else if (unformat (input, "action %U",
- unformat_negative_mapping_action, &action))
- {
- ;
- }
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (0 == eid_set)
- {
- errmsg ("missing params!");
- return -99;
- }
-
- if (is_add && (~0 == action) && 0 == vec_len (rlocs))
- {
- errmsg ("no action set for negative map-reply!");
- return -99;
- }
-
- data_len = vec_len (rlocs) * sizeof (vl_api_remote_locator_t);
-
- M2 (ONE_ADD_DEL_REMOTE_MAPPING, mp, data_len);
- mp->is_add = is_add;
- mp->vni = htonl (vni);
- mp->action = (u8) action;
- mp->is_src_dst = seid_set;
- mp->del_all = del_all;
- lisp_eid_put_vat (&mp->deid, eid);
- lisp_eid_put_vat (&mp->seid, seid);
-
- mp->rloc_num = clib_host_to_net_u32 (vec_len (rlocs));
- clib_memcpy (mp->rlocs, rlocs, data_len);
- vec_free (rlocs);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_add_del_remote_mapping api_one_add_del_remote_mapping
-
-/**
- * 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_one_add_del_adjacency (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_add_del_adjacency_t *mp;
- u32 vni = 0;
- u8 is_add = 1;
- int ret;
- lisp_eid_vat_t leid, reid;
-
- leid.type = reid.type = (u8) ~ 0;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "add"))
- {
- is_add = 1;
- }
- else if (unformat (input, "reid %U/%d", unformat_ip46_address,
- &reid.addr.ip, &reid.len))
- {
- reid.type = 0; /* ipv4 */
- }
- else if (unformat (input, "reid %U", unformat_ethernet_address,
- &reid.addr.mac))
- {
- reid.type = 1; /* mac */
- }
- else if (unformat (input, "leid %U/%d", unformat_ip46_address,
- &leid.addr.ip, &leid.len))
- {
- leid.type = 0; /* ipv4 */
- }
- else if (unformat (input, "leid %U", unformat_ethernet_address,
- &leid.addr.mac))
- {
- leid.type = 1; /* mac */
- }
- else if (unformat (input, "vni %d", &vni))
- {
- ;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if ((u8) ~ 0 == reid.type)
- {
- errmsg ("missing params!");
- return -99;
- }
-
- if (leid.type != reid.type)
- {
- errmsg ("remote and local EIDs are of different types!");
- return -99;
- }
-
- M (ONE_ADD_DEL_ADJACENCY, mp);
- mp->is_add = is_add;
- mp->vni = htonl (vni);
- lisp_eid_put_vat (&mp->leid, &leid);
- lisp_eid_put_vat (&mp->reid, &reid);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_add_del_adjacency api_one_add_del_adjacency
-
-uword
-unformat_gpe_encap_mode (unformat_input_t * input, va_list * args)
-{
- u32 *mode = va_arg (*args, u32 *);
-
- if (unformat (input, "lisp"))
- *mode = 0;
- else if (unformat (input, "vxlan"))
- *mode = 1;
- else
- return 0;
-
- return 1;
-}
-
-static int
-api_gpe_get_encap_mode (vat_main_t * vam)
-{
- vl_api_gpe_get_encap_mode_t *mp;
- int ret;
-
- /* Construct the API message */
- M (GPE_GET_ENCAP_MODE, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_gpe_set_encap_mode (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_gpe_set_encap_mode_t *mp;
- int ret;
- u32 mode = 0;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%U", unformat_gpe_encap_mode, &mode))
- ;
- else
- break;
- }
-
- /* Construct the API message */
- M (GPE_SET_ENCAP_MODE, mp);
-
- mp->is_vxlan = mode;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_lisp_gpe_add_del_iface (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_gpe_add_del_iface_t *mp;
- u8 action_set = 0, is_add = 1, is_l2 = 0, dp_table_set = 0, vni_set = 0;
- u32 dp_table = 0, vni = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "up"))
- {
- action_set = 1;
- is_add = 1;
- }
- else if (unformat (input, "down"))
- {
- action_set = 1;
- is_add = 0;
- }
- else if (unformat (input, "table_id %d", &dp_table))
- {
- dp_table_set = 1;
- }
- else if (unformat (input, "bd_id %d", &dp_table))
- {
- dp_table_set = 1;
- is_l2 = 1;
- }
- else if (unformat (input, "vni %d", &vni))
- {
- vni_set = 1;
- }
- else
- break;
- }
-
- if (action_set == 0)
- {
- errmsg ("Action not set");
- return -99;
- }
- if (dp_table_set == 0 || vni_set == 0)
- {
- errmsg ("vni and dp_table must be set");
- return -99;
- }
-
- /* Construct the API message */
- M (GPE_ADD_DEL_IFACE, mp);
-
- mp->is_add = is_add;
- mp->dp_table = clib_host_to_net_u32 (dp_table);
- mp->is_l2 = is_l2;
- mp->vni = clib_host_to_net_u32 (vni);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_map_register_fallback_threshold (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_map_register_fallback_threshold_t *mp;
- u32 value = 0;
- u8 is_set = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%u", &value))
- is_set = 1;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!is_set)
- {
- errmsg ("fallback threshold value is missing!");
- return -99;
- }
-
- M (ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp);
- mp->value = clib_host_to_net_u32 (value);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_map_register_fallback_threshold (vat_main_t * vam)
-{
- vl_api_show_one_map_register_fallback_threshold_t *mp;
- int ret;
-
- M (SHOW_ONE_MAP_REGISTER_FALLBACK_THRESHOLD, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-uword
-unformat_lisp_transport_protocol (unformat_input_t * input, va_list * args)
-{
- u32 *proto = va_arg (*args, u32 *);
-
- if (unformat (input, "udp"))
- *proto = 1;
- else if (unformat (input, "api"))
- *proto = 2;
- else
- return 0;
-
- return 1;
-}
-
-static int
-api_one_set_transport_protocol (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_set_transport_protocol_t *mp;
- u8 is_set = 0;
- u32 protocol = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%U", unformat_lisp_transport_protocol, &protocol))
- is_set = 1;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!is_set)
- {
- errmsg ("Transport protocol missing!");
- return -99;
- }
-
- M (ONE_SET_TRANSPORT_PROTOCOL, mp);
- mp->protocol = (u8) protocol;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_get_transport_protocol (vat_main_t * vam)
-{
- vl_api_one_get_transport_protocol_t *mp;
- int ret;
-
- M (ONE_GET_TRANSPORT_PROTOCOL, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_map_register_set_ttl (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- vl_api_one_map_register_set_ttl_t *mp;
- u32 ttl = 0;
- u8 is_set = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "%u", &ttl))
- is_set = 1;
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!is_set)
- {
- errmsg ("TTL value missing!");
- return -99;
- }
-
- M (ONE_MAP_REGISTER_SET_TTL, mp);
- mp->ttl = clib_host_to_net_u32 (ttl);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_map_register_ttl (vat_main_t * vam)
-{
- vl_api_show_one_map_register_ttl_t *mp;
- int ret;
-
- M (SHOW_ONE_MAP_REGISTER_TTL, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-/**
- * Add/del map request itr rlocs from ONE control plane and updates
- *
- * @param vam vpp API test context
- * @return return code
- */
-static int
-api_one_add_del_map_request_itr_rlocs (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- 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;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "del"))
- {
- is_add = 0;
- }
- else if (unformat (input, "%_%v%_", &locator_set_name))
- {
- locator_set_name_set = 1;
- }
- else
- {
- clib_warning ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (is_add && !locator_set_name_set)
- {
- errmsg ("itr-rloc is not set!");
- return -99;
- }
-
- if (is_add && vec_len (locator_set_name) > 64)
- {
- errmsg ("itr-rloc locator-set name too long");
- vec_free (locator_set_name);
- return -99;
- }
-
- M (ONE_ADD_DEL_MAP_REQUEST_ITR_RLOCS, mp);
- mp->is_add = is_add;
- if (is_add)
- {
- clib_memcpy (mp->locator_set_name, locator_set_name,
- vec_len (locator_set_name));
- }
- else
- {
- clib_memset (mp->locator_set_name, 0, sizeof (mp->locator_set_name));
- }
- vec_free (locator_set_name);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_add_del_map_request_itr_rlocs api_one_add_del_map_request_itr_rlocs
-
-static int
-api_one_locator_dump (vat_main_t * vam)
-{
- unformat_input_t *input = vam->input;
- 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;
- u32 ls_index = ~0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "ls_name %_%v%_", &ls_name))
- {
- is_name_set = 1;
- }
- else if (unformat (input, "ls_index %d", &ls_index))
- {
- is_index_set = 1;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!is_index_set && !is_name_set)
- {
- errmsg ("error: expected one of index or name!");
- return -99;
- }
-
- if (is_index_set && is_name_set)
- {
- errmsg ("error: only one param expected!");
- return -99;
- }
-
- if (vec_len (ls_name) > 62)
- {
- errmsg ("error: locator set name too long!");
- return -99;
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=16s%=16s%=16s", "locator", "priority", "weight");
- }
-
- M (ONE_LOCATOR_DUMP, mp);
- mp->is_index_set = is_index_set;
-
- if (is_index_set)
- mp->ls_index = clib_host_to_net_u32 (ls_index);
- else
- {
- vec_add1 (ls_name, 0);
- strncpy ((char *) mp->ls_name, (char *) ls_name,
- sizeof (mp->ls_name) - 1);
- }
-
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_locator_dump api_one_locator_dump
-
-static int
-api_one_locator_set_dump (vat_main_t * vam)
-{
- vl_api_one_locator_set_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- unformat_input_t *input = vam->input;
- u8 filter = 0;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "local"))
- {
- filter = 1;
- }
- else if (unformat (input, "remote"))
- {
- filter = 2;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=10s%=15s", "ls_index", "ls_name");
- }
-
- M (ONE_LOCATOR_SET_DUMP, mp);
-
- mp->filter = filter;
-
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_locator_set_dump api_one_locator_set_dump
-
-static int
-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_one_eid_table_map_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- /* Parse args required to build the message */
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "l2"))
- {
- is_l2 = 1;
- mode_set = 1;
- }
- else if (unformat (input, "l3"))
- {
- is_l2 = 0;
- mode_set = 1;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, input);
- return -99;
- }
- }
-
- if (!mode_set)
- {
- errmsg ("expected one of 'l2' or 'l3' parameter!");
- return -99;
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF");
- }
-
- M (ONE_EID_TABLE_MAP_DUMP, mp);
- mp->is_l2 = is_l2;
-
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_eid_table_map_dump api_one_eid_table_map_dump
-
-static int
-api_one_eid_table_vni_dump (vat_main_t * vam)
-{
- vl_api_one_eid_table_vni_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "VNI");
- }
-
- M (ONE_EID_TABLE_VNI_DUMP, mp);
-
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_eid_table_vni_dump api_one_eid_table_vni_dump
-
-static int
-api_one_eid_table_dump (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_one_eid_table_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- u8 filter = 0;
- int ret;
- u32 vni, t = 0;
- lisp_eid_vat_t eid;
- u8 eid_set = 0;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat
- (i, "eid %U/%d", unformat_ip46_address, &eid.addr.ip, &eid.len))
- {
- eid_set = 1;
- eid.type = 0;
- }
- else
- if (unformat (i, "eid %U", unformat_ethernet_address, &eid.addr.mac))
- {
- eid_set = 1;
- eid.type = 1;
- }
- else if (unformat (i, "eid %U", unformat_nsh_address, &eid.addr.nsh))
- {
- eid_set = 1;
- eid.type = 2;
- }
- else if (unformat (i, "vni %d", &t))
- {
- vni = t;
- }
- else if (unformat (i, "local"))
- {
- filter = 1;
- }
- else if (unformat (i, "remote"))
- {
- filter = 2;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%-35s%-20s%-30s%-20s%-20s%-10s%-20s", "EID",
- "type", "ls_index", "ttl", "authoritative", "key_id", "key");
- }
-
- M (ONE_EID_TABLE_DUMP, mp);
-
- mp->filter = filter;
- if (eid_set)
- {
- mp->eid_set = 1;
- mp->vni = htonl (vni);
- lisp_eid_put_vat (&mp->eid, &eid);
- }
-
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- 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)
-{
- unformat_input_t *i = vam->input;
- vl_api_gpe_fwd_entries_get_t *mp;
- u8 vni_set = 0;
- u32 vni = ~0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "vni %d", &vni))
- {
- vni_set = 1;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!vni_set)
- {
- errmsg ("vni not set!");
- return -99;
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%10s %10s %s %40s", "fwd_index", "dp_table",
- "leid", "reid");
- }
-
- M (GPE_FWD_ENTRIES_GET, mp);
- mp->vni = clib_host_to_net_u32 (vni);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define vl_api_gpe_native_fwd_rpaths_get_reply_t_endian vl_noop_handler
-#define vl_api_gpe_native_fwd_rpaths_get_reply_t_print vl_noop_handler
-#define vl_api_gpe_fwd_entry_vnis_get_reply_t_endian vl_noop_handler
-#define vl_api_gpe_fwd_entry_vnis_get_reply_t_print vl_noop_handler
-#define vl_api_gpe_fwd_entries_get_reply_t_endian vl_noop_handler
-#define vl_api_gpe_fwd_entries_get_reply_t_print vl_noop_handler
-#define vl_api_gpe_fwd_entry_path_details_t_endian vl_noop_handler
-#define vl_api_gpe_fwd_entry_path_details_t_print vl_noop_handler
-
-static int
-api_one_adjacencies_get (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_one_adjacencies_get_t *mp;
- u8 vni_set = 0;
- u32 vni = ~0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "vni %d", &vni))
- {
- vni_set = 1;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!vni_set)
- {
- errmsg ("vni not set!");
- return -99;
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%s %40s", "leid", "reid");
- }
-
- M (ONE_ADJACENCIES_GET, mp);
- mp->vni = clib_host_to_net_u32 (vni);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_adjacencies_get api_one_adjacencies_get
-
-static int
-api_gpe_native_fwd_rpaths_get (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_gpe_native_fwd_rpaths_get_t *mp;
- int ret;
- u8 ip_family_set = 0, is_ip4 = 1;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "ip4"))
- {
- ip_family_set = 1;
- is_ip4 = 1;
- }
- else if (unformat (i, "ip6"))
- {
- ip_family_set = 1;
- is_ip4 = 0;
- }
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!ip_family_set)
- {
- errmsg ("ip family not set!");
- return -99;
- }
-
- M (GPE_NATIVE_FWD_RPATHS_GET, mp);
- mp->is_ip4 = is_ip4;
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_gpe_fwd_entry_vnis_get (vat_main_t * vam)
-{
- vl_api_gpe_fwd_entry_vnis_get_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "VNIs");
- }
-
- M (GPE_FWD_ENTRY_VNIS_GET, mp);
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_gpe_add_del_native_fwd_rpath (vat_main_t * vam)
-{
- unformat_input_t *i = vam->input;
- vl_api_gpe_add_del_native_fwd_rpath_t *mp;
- int ret = 0;
- u8 is_add = 1, ip_set = 0, is_ip4 = 1;
- struct in_addr ip4;
- struct in6_addr ip6;
- u32 table_id = 0, nh_sw_if_index = ~0;
-
- clib_memset (&ip4, 0, sizeof (ip4));
- clib_memset (&ip6, 0, sizeof (ip6));
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "del"))
- is_add = 0;
- else if (unformat (i, "via %U %U", unformat_ip4_address, &ip4,
- api_unformat_sw_if_index, vam, &nh_sw_if_index))
- {
- ip_set = 1;
- is_ip4 = 1;
- }
- else if (unformat (i, "via %U %U", unformat_ip6_address, &ip6,
- api_unformat_sw_if_index, vam, &nh_sw_if_index))
- {
- ip_set = 1;
- is_ip4 = 0;
- }
- else if (unformat (i, "via %U", unformat_ip4_address, &ip4))
- {
- ip_set = 1;
- is_ip4 = 1;
- nh_sw_if_index = ~0;
- }
- else if (unformat (i, "via %U", unformat_ip6_address, &ip6))
- {
- ip_set = 1;
- is_ip4 = 0;
- nh_sw_if_index = ~0;
- }
- else if (unformat (i, "table %d", &table_id))
- ;
- else
- {
- errmsg ("parse error '%U'", format_unformat_error, i);
- return -99;
- }
- }
-
- if (!ip_set)
- {
- errmsg ("nh addr not set!");
- return -99;
- }
-
- M (GPE_ADD_DEL_NATIVE_FWD_RPATH, mp);
- mp->is_add = is_add;
- mp->table_id = clib_host_to_net_u32 (table_id);
- mp->nh_sw_if_index = clib_host_to_net_u32 (nh_sw_if_index);
- mp->nh_addr.af = is_ip4 ? 0 : 1;
- if (is_ip4)
- clib_memcpy (mp->nh_addr.un.ip4, &ip4, sizeof (ip4));
- else
- clib_memcpy (mp->nh_addr.un.ip6, &ip6, sizeof (ip6));
-
- /* send it... */
- S (mp);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_map_server_dump (vat_main_t * vam)
-{
- vl_api_one_map_server_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "Map server");
- }
-
- M (ONE_MAP_SERVER_DUMP, mp);
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_map_server_dump api_one_map_server_dump
-
-static int
-api_one_map_resolver_dump (vat_main_t * vam)
-{
- vl_api_one_map_resolver_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "Map resolver");
- }
-
- M (ONE_MAP_RESOLVER_DUMP, mp);
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_lisp_map_resolver_dump api_one_map_resolver_dump
-
-static int
-api_one_stats_flush (vat_main_t * vam)
-{
- vl_api_one_stats_flush_t *mp;
- int ret = 0;
-
- M (ONE_STATS_FLUSH, mp);
- S (mp);
- W (ret);
- return ret;
-}
-
-static int
-api_one_stats_dump (vat_main_t * vam)
-{
- vl_api_one_stats_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- int ret;
-
- M (ONE_STATS_DUMP, mp);
- /* send it... */
- S (mp);
-
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_show_one_status (vat_main_t * vam)
-{
- vl_api_show_one_status_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%-20s%-16s", "ONE status", "locator-set");
- }
-
- M (SHOW_ONE_STATUS, mp);
- /* send it... */
- S (mp);
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-#define api_show_lisp_status api_show_one_status
-
-static int
-api_lisp_gpe_fwd_entry_path_dump (vat_main_t * vam)
-{
- vl_api_gpe_fwd_entry_path_dump_t *mp;
- vl_api_control_ping_t *mp_ping;
- unformat_input_t *i = vam->input;
- u32 fwd_entry_index = ~0;
- int ret;
-
- while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (i, "index %d", &fwd_entry_index))
- ;
- else
- break;
- }
-
- if (~0 == fwd_entry_index)
- {
- errmsg ("no index specified!");
- return -99;
- }
-
- if (!vam->json_output)
- {
- print (vam->ofp, "first line");
- }
-
- M (GPE_FWD_ENTRY_PATH_DUMP, mp);
-
- /* send it... */
- S (mp);
- /* Use a control ping for synchronization */
- MPING (CONTROL_PING, mp_ping);
- S (mp_ping);
-
- /* Wait for a reply... */
- W (ret);
- return ret;
-}
-
-static int
-api_one_get_map_request_itr_rlocs (vat_main_t * vam)
-{
- vl_api_one_get_map_request_itr_rlocs_t *mp;
- int ret;
-
- if (!vam->json_output)
- {
- print (vam->ofp, "%=20s", "itr-rlocs:");
- }
-
- M (ONE_GET_MAP_REQUEST_ITR_RLOCS, mp);
- /* send it... */
- S (mp);
- /* Wait for a reply... */
- W (ret);
- 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)
{
@@ -20187,128 +15281,6 @@ _(get_node_graph, " ") \
_(sw_interface_clear_stats,"<intfc> | sw_if_index <nn>") \
_(ioam_enable, "[trace] [pow] [ppc <encap|decap>]") \
_(ioam_disable, "") \
-_(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_map_register_fallback_threshold, "<value>") \
-_(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_use_petr, "ip-address> | disable") \
-_(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_add_del_ndp_entry, "[del] mac <mac> bd <bd> ip6 <ip6>") \
-_(one_ndp_bd_get, "") \
-_(one_ndp_entries_get, "bd <bridge-domain>") \
-_(one_add_del_l2_arp_entry, "[del] mac <mac> bd <bd> ip <ip4>") \
-_(one_l2_arp_bd_get, "") \
-_(one_l2_arp_entries_get, "bd <bridge-domain>") \
-_(one_stats_enable_disable, "enable|disable") \
-_(show_one_stats_enable_disable, "") \
-_(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>") \
-_(one_nsh_set_locator_set, "[del] ls <locator-set-name>") \
-_(show_one_rloc_probe_state, "") \
-_(show_one_map_register_state, "") \
-_(show_one_status, "") \
-_(one_stats_dump, "") \
-_(one_stats_flush, "") \
-_(one_get_map_request_itr_rlocs, "") \
-_(one_map_register_set_ttl, "<ttl>") \
-_(one_set_transport_protocol, "udp|api") \
-_(one_get_transport_protocol, "") \
-_(one_enable_disable_xtr_mode, "enable|disable") \
-_(one_show_xtr_mode, "") \
-_(one_enable_disable_pitr_mode, "enable|disable") \
-_(one_show_pitr_mode, "") \
-_(one_enable_disable_petr_mode, "enable|disable") \
-_(one_show_petr_mode, "") \
-_(show_one_nsh_mapping, "") \
-_(show_one_pitr, "") \
-_(show_one_use_petr, "") \
-_(show_one_map_request_mode, "") \
-_(show_one_map_register_ttl, "") \
-_(show_one_map_register_fallback_threshold, "") \
-_(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> " \
- "iface <intf> | sw_if_index <sw_if_index> " \
- "p <priority> w <weight> [del]") \
-_(lisp_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>]") \
-_(lisp_add_del_map_resolver, "<ip4|6-addr> [del]") \
-_(lisp_add_del_map_server, "<ip4|6-addr> [del]") \
-_(lisp_enable_disable, "enable|disable") \
-_(lisp_map_register_enable_disable, "enable|disable") \
-_(lisp_rloc_probe_enable_disable, "enable|disable") \
-_(lisp_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]") \
-_(lisp_add_del_adjacency, "add|del vni <vni> reid <remote-eid> leid " \
- "<local-eid>") \
-_(lisp_pitr_set_locator_set, "locator-set <loc-set-name> | del") \
-_(lisp_use_petr, "<ip-address> | disable") \
-_(lisp_map_request_mode, "src-dst|dst-only") \
-_(lisp_add_del_map_request_itr_rlocs, "<loc-set-name> [del]") \
-_(lisp_eid_table_add_del_map, "[del] vni <vni> vrf <vrf>") \
-_(lisp_locator_set_dump, "[local | remote]") \
-_(lisp_locator_dump, "ls_index <index> | ls_name <name>") \
-_(lisp_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
- "[local] | [remote]") \
-_(lisp_eid_table_vni_dump, "") \
-_(lisp_eid_table_map_dump, "l2|l3") \
-_(lisp_map_resolver_dump, "") \
-_(lisp_map_server_dump, "") \
-_(lisp_adjacencies_get, "vni <vni>") \
-_(gpe_fwd_entry_vnis_get, "") \
-_(gpe_native_fwd_rpaths_get, "ip4 | ip6") \
-_(gpe_add_del_native_fwd_rpath, "[del] via <nh-ip-addr> [iface] " \
- "[table <table-id>]") \
-_(lisp_gpe_fwd_entries_get, "vni <vni>") \
-_(lisp_gpe_fwd_entry_path_dump, "index <fwd_entry_index>") \
-_(gpe_set_encap_mode, "lisp|vxlan") \
-_(gpe_get_encap_mode, "") \
-_(lisp_gpe_add_del_iface, "up|down") \
-_(lisp_gpe_enable_disable, "enable|disable") \
-_(lisp_gpe_add_del_fwd_entry, "reid <eid> [leid <eid>] vni <vni>" \
- "vrf/bd <dp_table> loc-pair <lcl_loc> <rmt_loc> w <weight>... [del]") \
-_(show_lisp_rloc_probe_state, "") \
-_(show_lisp_map_register_state, "") \
-_(show_lisp_status, "") \
-_(lisp_get_map_request_itr_rlocs, "") \
-_(show_lisp_pitr, "") \
-_(show_lisp_use_petr, "") \
-_(show_lisp_map_request_mode, "") \
_(af_packet_create, "name <host interface name> [hw_addr <mac>]") \
_(af_packet_delete, "name <host interface name>") \
_(af_packet_dump, "") \
diff --git a/src/vnet/CMakeLists.txt b/src/vnet/CMakeLists.txt
index 124af13f202..4c65d71f3b2 100644
--- a/src/vnet/CMakeLists.txt
+++ b/src/vnet/CMakeLists.txt
@@ -818,64 +818,6 @@ list(APPEND VNET_HEADERS
list(APPEND VNET_API_FILES vxlan-gpe/vxlan_gpe.api)
##############################################################################
-# LISP control plane: lisp-cp
-##############################################################################
-
-list(APPEND VNET_SOURCES
- lisp-cp/lisp_types.c
- lisp-cp/lisp_cp_dpo.c
- lisp-cp/control.c
- lisp-cp/gid_dictionary.c
- lisp-cp/lisp_msg_serdes.c
- lisp-cp/packets.c
- lisp-cp/one_cli.c
- lisp-cp/lisp_cli.c
- lisp-cp/one_api.c
- lisp-cp/lisp_api.c
- lisp-cp/lisp_types_api.c
-)
-
-list(APPEND VNET_HEADERS
- lisp-cp/lisp_types.h
- lisp-cp/packets.h
- lisp-cp/gid_dictionary.h
- lisp-cp/lisp_cp_messages.h
- lisp-cp/lisp_msg_serdes.h
- lisp-cp/control.h
- lisp-cp/lisp_types_api.h
-)
-
-list(APPEND VNET_API_FILES lisp-cp/lisp_types.api)
-list(APPEND VNET_API_FILES lisp-cp/lisp.api)
-list(APPEND VNET_API_FILES lisp-cp/one.api)
-
-##############################################################################
-# Tunnel protocol: lisp-gpe
-##############################################################################
-
-list(APPEND VNET_SOURCES
- lisp-gpe/lisp_gpe.c
- lisp-gpe/lisp_gpe_sub_interface.c
- lisp-gpe/lisp_gpe_adjacency.c
- lisp-gpe/lisp_gpe_tunnel.c
- lisp-gpe/lisp_gpe_fwd_entry.c
- lisp-gpe/lisp_gpe_tenant.c
- lisp-gpe/interface.c
- lisp-gpe/decap.c
- lisp-gpe/lisp_gpe_api.c
-)
-
-list(APPEND VNET_HEADERS
- lisp-gpe/lisp_gpe.h
- lisp-gpe/lisp_gpe_fwd_entry.h
- lisp-gpe/lisp_gpe_tenant.h
- lisp-gpe/lisp_gpe_packet.h
- lisp-gpe/lisp_gpe_error.def
-)
-
-list(APPEND VNET_API_FILES lisp-gpe/lisp_gpe.api)
-
-##############################################################################
# ipv6 segment routing
##############################################################################
diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c
index bda98b7417c..1403e67482c 100644
--- a/src/vnet/session/session_api.c
+++ b/src/vnet/session/session_api.c
@@ -988,7 +988,7 @@ send_session_rules_table_details (session_rules_table_t * srt, u8 fib_proto,
}
static void
-vl_api_session_rules_dump_t_handler (vl_api_one_map_server_dump_t * mp)
+vl_api_session_rules_dump_t_handler (vl_api_session_rules_dump_t * mp)
{
vl_api_registration_t *reg;
session_table_t *st;
diff --git a/src/vnet/vnet_all_api_h.h b/src/vnet/vnet_all_api_h.h
index 86edc88ac49..e48d4395436 100644
--- a/src/vnet/vnet_all_api_h.h
+++ b/src/vnet/vnet_all_api_h.h
@@ -46,9 +46,6 @@
#include <vnet/vxlan-gpe/vxlan_gpe.api.h>
#include <vnet/bfd/bfd.api.h>
#include <vnet/ipsec/ipsec.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/session/session.api.h>
#include <vnet/mpls/mpls.api.h>
#include <vnet/srv6/sr.api.h>
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index b17e7ded2b2..4a2c2cb7838 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -38,7 +38,6 @@
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
#include <vlibmemory/api.h>
-#include <vnet/lisp-cp/lisp_types.h>
#include <vnet/qos/qos_types.h>
#include <vnet/ethernet/ethernet.h>
@@ -2523,364 +2522,6 @@ static void *vl_api_ip_source_and_port_range_check_interface_add_del_t_print
FINISH;
}
-static void *vl_api_lisp_enable_disable_t_print
- (vl_api_lisp_enable_disable_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_enable_disable %s",
- mp->is_enable ? "enable" : "disable");
-
- FINISH;
-}
-
-static void *vl_api_gpe_add_del_iface_t_print
- (vl_api_gpe_add_del_iface_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: gpe_add_del_iface ");
-
- s = format (s, "%s ", mp->is_add ? "up" : "down");
- s = format (s, "vni %d ", mp->vni);
- s = format (s, "%s %d ", mp->is_l2 ? "bd_id" : "table_id", mp->dp_table);
-
- FINISH;
-}
-
-static void *vl_api_lisp_pitr_set_locator_set_t_print
- (vl_api_lisp_pitr_set_locator_set_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_pitr_set_locator_set ");
-
- if (mp->is_add)
- s = format (s, "locator-set %s ", mp->ls_name);
- else
- s = format (s, "del");
-
- FINISH;
-}
-
-static u8 *
-format_nsh_address_vat (u8 * s, va_list * args)
-{
- nsh_t *a = va_arg (*args, nsh_t *);
- return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si);
-}
-
-static u8 *
-format_lisp_flat_eid (u8 * s, va_list * args)
-{
- vl_api_eid_t *eid = va_arg (*args, vl_api_eid_t *);
-
- switch (eid->type)
- {
- case EID_TYPE_API_PREFIX:
- if (eid->address.prefix.address.af)
- return format (s, "%U/%d", format_ip6_address,
- eid->address.prefix.address.un.ip6,
- eid->address.prefix.len);
- return format (s, "%U/%d", format_ip4_address,
- eid->address.prefix.address.un.ip4,
- eid->address.prefix.len);
- case EID_TYPE_API_MAC:
- return format (s, "%U", format_ethernet_address, eid->address.mac);
- case EID_TYPE_API_NSH:
- return format (s, "%U", format_nsh_address_vat, eid->address.nsh);
- }
- return 0;
-}
-
-static void *vl_api_lisp_add_del_remote_mapping_t_print
- (vl_api_lisp_add_del_remote_mapping_t * mp, void *handle)
-{
- u8 *s;
- u32 rloc_num = 0;
-
- s = format (0, "SCRIPT: lisp_add_del_remote_mapping ");
-
- if (mp->del_all)
- s = format (s, "del-all ");
-
- s = format (s, "%s ", mp->is_add ? "add" : "del");
- s = format (s, "vni %d ", (mp->vni));
-
- s = format (s, "eid %U ", format_lisp_flat_eid, &mp->deid);
-
- if (mp->is_src_dst)
- {
- s = format (s, "seid %U ", format_lisp_flat_eid, &mp->seid);
- }
- rloc_num = (mp->rloc_num);
-
- if (0 == rloc_num)
- s = format (s, "action %d", mp->action);
-
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_adjacency_t_print
- (vl_api_lisp_add_del_adjacency_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_adjacency ");
-
- s = format (s, "%s ", mp->is_add ? "add" : "del");
- s = format (s, "vni %d ", (mp->vni));
- s = format (s, "reid %U leid %U ",
- format_lisp_flat_eid, &mp->reid, format_lisp_flat_eid,
- &mp->leid);
-
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_map_request_itr_rlocs_t_print
- (vl_api_lisp_add_del_map_request_itr_rlocs_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_map_request_itr_rlocs ");
-
- if (mp->is_add)
- s = format (s, "%s", mp->locator_set_name);
- else
- s = format (s, "del");
-
- FINISH;
-}
-
-static void *vl_api_lisp_eid_table_add_del_map_t_print
- (vl_api_lisp_eid_table_add_del_map_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_eid_table_add_del_map ");
-
- if (!mp->is_add)
- s = format (s, "del ");
-
- s = format (s, "vni %d ", (mp->vni));
- s = format (s, "%s %d ", mp->is_l2 ? "bd_index" : "vrf", (mp->dp_table));
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_local_eid_t_print
- (vl_api_lisp_add_del_local_eid_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_local_eid ");
-
- if (!mp->is_add)
- s = format (s, "del ");
-
- s = format (s, "vni %d ", (mp->vni));
- s = format (s, "eid %U ", format_lisp_flat_eid, &mp->eid);
- s = format (s, "locator-set %s ", mp->locator_set_name);
- if (mp->key.id)
- {
- u32 key_id = mp->key.id;
- s = format (s, "key-id %U", format_hmac_key_id, key_id);
- s = format (s, "secret-key %s", mp->key.key);
- }
- FINISH;
-}
-
-static void *vl_api_gpe_add_del_fwd_entry_t_print
- (vl_api_gpe_add_del_fwd_entry_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: gpe_add_del_fwd_entry TODO");
-
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_map_resolver_t_print
- (vl_api_lisp_add_del_map_resolver_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_map_resolver ");
-
- if (!mp->is_add)
- s = format (s, "del ");
-
- if (mp->ip_address.af)
- s = format (s, "%U ", format_ip6_address, mp->ip_address.un.ip6);
- else
- s = format (s, "%U ", format_ip4_address, mp->ip_address.un.ip4);
-
- FINISH;
-}
-
-static void *vl_api_gpe_enable_disable_t_print
- (vl_api_gpe_enable_disable_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: gpe_enable_disable ");
-
- s = format (s, "%s ", mp->is_enable ? "enable" : "disable");
-
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_locator_set_t_print
- (vl_api_lisp_add_del_locator_set_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_locator_set ");
-
- if (!mp->is_add)
- s = format (s, "del ");
-
- s = format (s, "locator-set %s ", mp->locator_set_name);
-
- FINISH;
-}
-
-static void *vl_api_lisp_add_del_locator_t_print
- (vl_api_lisp_add_del_locator_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_add_del_locator ");
-
- if (!mp->is_add)
- s = format (s, "del ");
-
- s = format (s, "locator-set %s ", mp->locator_set_name);
- s = format (s, "sw_if_index %d ", mp->sw_if_index);
- s = format (s, "p %d w %d ", mp->priority, mp->weight);
-
- FINISH;
-}
-
-static void *vl_api_lisp_locator_set_dump_t_print
- (vl_api_lisp_locator_set_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_locator_set_dump ");
- if (mp->filter == 1)
- s = format (s, "local");
- else if (mp->filter == 2)
- s = format (s, "remote");
-
- FINISH;
-}
-
-static void *vl_api_lisp_locator_dump_t_print
- (vl_api_lisp_locator_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_locator_dump ");
- if (mp->is_index_set)
- s = format (s, "ls_index %d", (mp->ls_index));
- else
- s = format (s, "ls_name %s", mp->ls_name);
-
- FINISH;
-}
-
-static void *vl_api_lisp_map_request_mode_t_print
- (vl_api_lisp_map_request_mode_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_map_request_mode ");
-
- s = mp->is_src_dst ? format (s, "src-dst") : format (s, "dst-only");
-
- FINISH;
-}
-
-static void *vl_api_lisp_eid_table_dump_t_print
- (vl_api_lisp_eid_table_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_eid_table_dump ");
-
- if (mp->eid_set)
- {
- s = format (s, "vni %d ", (mp->vni));
- s = format (s, "eid %U ", format_lisp_flat_eid, &mp->eid);
- switch (mp->filter)
- {
- case 1:
- s = format (s, "local ");
- break;
- case 2:
- s = format (s, "remote ");
- break;
- default:
- break;
- }
- }
- FINISH;
-}
-
-static void *vl_api_lisp_rloc_probe_enable_disable_t_print
- (vl_api_lisp_rloc_probe_enable_disable_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_rloc_probe_enable_disable ");
- if (mp->is_enable)
- s = format (s, "enable");
- else
- s = format (s, "disable");
-
- FINISH;
-}
-
-static void *vl_api_lisp_map_register_enable_disable_t_print
- (vl_api_lisp_map_register_enable_disable_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_map_register_enable_disable ");
- if (mp->is_enable)
- s = format (s, "enable");
- else
- s = format (s, "disable");
-
- FINISH;
-}
-
-static void *vl_api_lisp_adjacencies_get_t_print
- (vl_api_lisp_adjacencies_get_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_adjacencies_get ");
- s = format (s, "vni %d", (mp->vni));
-
- FINISH;
-}
-
-static void *vl_api_lisp_eid_table_map_dump_t_print
- (vl_api_lisp_eid_table_map_dump_t * mp, void *handle)
-{
- u8 *s;
-
- s = format (0, "SCRIPT: lisp_eid_table_map_dump ");
-
- if (mp->is_l2)
- s = format (s, "l2");
- else
- s = format (s, "l3");
-
- FINISH;
-}
-
static void *vl_api_ipsec_tunnel_if_add_del_t_print
(vl_api_ipsec_tunnel_if_add_del_t * mp, void *handle)
{
@@ -2923,6 +2564,13 @@ static void *vl_api_ipsec_tunnel_if_add_del_t_print
FINISH;
}
+/* static u8 * */
+/* format_nsh_address_vat (u8 * s, va_list * args) */
+/* { */
+/* nsh_t *a = va_arg (*args, nsh_t *); */
+/* return format (s, "SPI:%d SI:%d", clib_net_to_host_u32 (a->spi), a->si); */
+/* } */
+
static const char *policy_strs[] = {
"BYPASS",
"DISCARD",
@@ -3381,24 +3029,6 @@ static void * vl_api_ ## f ## _t_print \
foreach_no_print_function;
#undef _
-#define foreach_custom_print_no_arg_function \
-_(lisp_eid_table_vni_dump) \
-_(lisp_map_resolver_dump) \
-_(lisp_map_server_dump) \
-_(show_lisp_rloc_probe_state) \
-_(show_lisp_map_register_state) \
-_(show_lisp_map_request_mode)
-
-#define _(f) \
-static void * vl_api_ ## f ## _t_print \
- (vl_api_ ## f ## _t * mp, void * handle) \
-{ \
- u8 * s; \
- s = format (0, "SCRIPT: " #f ); \
- FINISH; \
-}
-foreach_custom_print_no_arg_function;
-#undef _
#define foreach_custom_print_function \
_(CREATE_LOOPBACK, create_loopback) \
_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
@@ -3525,34 +3155,6 @@ _(IP_SOURCE_AND_PORT_RANGE_CHECK_ADD_DEL, \
ip_source_and_port_range_check_add_del) \
_(IP_SOURCE_AND_PORT_RANGE_CHECK_INTERFACE_ADD_DEL, \
ip_source_and_port_range_check_interface_add_del) \
-_(LISP_ENABLE_DISABLE, lisp_enable_disable) \
-_(GPE_ENABLE_DISABLE, gpe_enable_disable) \
-_(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \
-_(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
-_(LISP_MAP_REQUEST_MODE, lisp_map_request_mode) \
-_(SHOW_LISP_MAP_REQUEST_MODE, show_lisp_map_request_mode) \
-_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping) \
-_(LISP_ADD_DEL_ADJACENCY, lisp_add_del_adjacency) \
-_(LISP_ADD_DEL_MAP_REQUEST_ITR_RLOCS, \
- lisp_add_del_map_request_itr_rlocs) \
-_(LISP_EID_TABLE_ADD_DEL_MAP, lisp_eid_table_add_del_map) \
-_(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid) \
-_(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \
-_(LISP_ADD_DEL_LOCATOR_SET, lisp_add_del_locator_set) \
-_(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver) \
-_(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator) \
-_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
-_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
-_(LISP_EID_TABLE_VNI_DUMP, lisp_eid_table_vni_dump) \
-_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
-_(LISP_MAP_SERVER_DUMP, lisp_map_server_dump) \
-_(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
-_(LISP_LOCATOR_DUMP, lisp_locator_dump) \
-_(LISP_ADJACENCIES_GET, lisp_adjacencies_get) \
-_(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state) \
-_(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state) \
-_(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable) \
-_(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable) \
_(IPSEC_INTERFACE_ADD_DEL_SPD, ipsec_interface_add_del_spd) \
_(IPSEC_SAD_ENTRY_ADD_DEL, ipsec_sad_entry_add_del) \
_(IPSEC_SPD_ADD_DEL, ipsec_spd_add_del) \
diff --git a/test/framework.py b/test/framework.py
index ba5f4014798..82d1c35fd7c 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -419,6 +419,8 @@ class VppTestCase(unittest.TestCase):
"plugins",
"{", "plugin", "dpdk_plugin.so", "{", "disable",
"}", "plugin", "rdma_plugin.so", "{", "disable",
+ "}", "plugin", "lisp_unittest_plugin.so", "{",
+ "enable",
"}", "plugin", "unittest_plugin.so", "{", "enable",
"}"] + cls.extra_vpp_plugin_config + ["}", ]