aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrej Kozemcak <akozemca@cisco.com>2016-05-02 12:14:33 +0200
committerDave Barach <openvpp@barachs.net>2016-05-05 11:46:10 +0000
commita9edd85e4cb35fd55c515dbfbad37aecd28c1431 (patch)
tree5e3b18b82beea727d9445a19fcbcec7962813ffc
parentfdff1e6ed540f2a04792fb64e04b0c7862dc2b8c (diff)
ONE-2: Add new LISP dump API for lisp gpe
API: lisp_gpe_enable_disable_dump Change-Id: I1c8e78f00f9a3f99c1f2f54884af565292e4ccf8 Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.c11
-rw-r--r--vnet/vnet/lisp-gpe/lisp_gpe.h3
-rw-r--r--vpp-api-test/vat/api_format.c66
-rw-r--r--vpp/api/api.c34
-rw-r--r--vpp/api/vpe.api18
5 files changed, 130 insertions, 2 deletions
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.c b/vnet/vnet/lisp-gpe/lisp_gpe.c
index 6ccc5f0d32e..4c39bf97cae 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.c
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.c
@@ -445,6 +445,14 @@ VLIB_CLI_COMMAND (show_lisp_gpe_tunnel_command, static) = {
.function = show_lisp_gpe_tunnel_command_fn,
};
+u8
+vnet_lisp_gpe_enable_disable_status(void)
+{
+ lisp_gpe_main_t * lgm = &lisp_gpe_main;
+
+ return lgm->is_en;
+}
+
clib_error_t *
vnet_lisp_gpe_enable_disable (vnet_lisp_gpe_enable_disable_args_t * a)
{
@@ -471,6 +479,8 @@ vnet_lisp_gpe_enable_disable (vnet_lisp_gpe_enable_disable_args_t * a)
{
/* ask cp to re-add ifaces and defaults */
}
+
+ lgm->is_en = 1;
}
else
{
@@ -509,6 +519,7 @@ vnet_lisp_gpe_enable_disable (vnet_lisp_gpe_enable_disable_args_t * a)
vnet_lisp_gpe_add_del_iface(ai, 0);
}
vec_free(table_ids);
+ lgm->is_en = 0;
}
return 0;
diff --git a/vnet/vnet/lisp-gpe/lisp_gpe.h b/vnet/vnet/lisp-gpe/lisp_gpe.h
index 329083af631..cba779525a8 100644
--- a/vnet/vnet/lisp-gpe/lisp_gpe.h
+++ b/vnet/vnet/lisp-gpe/lisp_gpe.h
@@ -158,6 +158,7 @@ typedef struct lisp_gpe_main
ip6_main_t * im6;
ip_lookup_main_t * lm4;
ip_lookup_main_t * lm6;
+ u8 is_en;
} lisp_gpe_main_t;
lisp_gpe_main_t lisp_gpe_main;
@@ -195,6 +196,8 @@ typedef struct
u32 vni; /* host byte order */
} vnet_lisp_gpe_add_del_iface_args_t;
+u8
+vnet_lisp_gpe_enable_disable_status(void);
void
vnet_lisp_gpe_add_del_iface (vnet_lisp_gpe_add_del_iface_args_t *a,
u32 * hw_if_indexp);
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 548959edb3b..c36e0591b39 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -2113,6 +2113,36 @@ vl_api_lisp_map_resolver_details_t_handler_json (
}
}
+static void
+vl_api_lisp_gpe_enable_disable_status_details_t_handler
+(vl_api_lisp_gpe_enable_disable_status_details_t *mp)
+{
+ vat_main_t *vam = &vat_main;
+
+ fformat(vam->ofp, "%=20s\n",
+ mp->is_en ? "enable" : "disable");
+}
+
+static void
+vl_api_lisp_gpe_enable_disable_status_details_t_handler_json
+(vl_api_lisp_gpe_enable_disable_status_details_t *mp)
+{
+ vat_main_t *vam = &vat_main;
+ vat_json_node_t *node = NULL;
+ u8 *str = NULL;
+
+ str = format(0, "%s", mp->is_en ? "enable" : "disable");
+
+ 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, "lisp_gpe", str);
+}
+
#define vl_api_vnet_ip4_fib_counters_t_endian vl_noop_handler
#define vl_api_vnet_ip4_fib_counters_t_print vl_noop_handler
#define vl_api_vnet_ip6_fib_counters_t_endian vl_noop_handler
@@ -2379,7 +2409,9 @@ _(LISP_GPE_ADD_DEL_IFACE_REPLY, lisp_gpe_add_del_iface_reply) \
_(LISP_LOCATOR_SET_DETAILS, lisp_locator_set_details) \
_(LISP_LOCAL_EID_TABLE_DETAILS, lisp_local_eid_table_details) \
_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
-_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details)
+_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
+_(LISP_GPE_ENABLE_DISABLE_STATUS_DETAILS, \
+ lisp_gpe_enable_disable_status_details)
/* M: construct, but don't yet send a message */
@@ -10300,6 +10332,35 @@ api_lisp_map_resolver_dump(vat_main_t *vam)
return 0;
}
+static int
+api_lisp_gpe_enable_disable_status_dump(vat_main_t *vam)
+{
+ vl_api_lisp_gpe_enable_disable_status_dump_t *mp;
+ f64 timeout = ~0;
+
+ if (!vam->json_output) {
+ fformat(vam->ofp, "%=20s\n",
+ "lisp gpe");
+ }
+
+ M(LISP_GPE_ENABLE_DISABLE_STATUS_DUMP,
+ lisp_gpe_enable_disable_status_dump);
+ /* send it... */
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_control_ping_t * mp;
+ M(CONTROL_PING, control_ping);
+ S;
+ }
+ /* Wait for a reply... */
+ W;
+
+ /* NOTREACHED */
+ return 0;
+}
+
static int q_or_quit (vat_main_t * vam)
{
longjmp (vam->jump_buf, 1);
@@ -10792,7 +10853,8 @@ _(lisp_gpe_add_del_iface, "up|down") \
_(lisp_locator_set_dump, "") \
_(lisp_local_eid_table_dump, "") \
_(lisp_gpe_tunnel_dump, "") \
-_(lisp_map_resolver_dump, "")
+_(lisp_map_resolver_dump, "") \
+_(lisp_gpe_enable_disable_status_dump, "")
/* List of command functions, CLI names map directly to functions */
#define foreach_cli_function \
diff --git a/vpp/api/api.c b/vpp/api/api.c
index e33e24d25ea..18c00bd3d22 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -331,6 +331,8 @@ _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump) \
_(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
+_(LISP_GPE_ENABLE_DISABLE_STATUS_DUMP, \
+ lisp_gpe_enable_disable_status_dump) \
_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)
#define QUOTE_(x) #x
@@ -5171,6 +5173,38 @@ vl_api_lisp_map_resolver_dump_t_handler (
}
+static void
+send_lisp_gpe_enable_disable_details (unix_shared_memory_queue_t *q,
+ u32 context)
+{
+ vl_api_lisp_gpe_enable_disable_status_details_t *rmp = NULL;
+ u8 is_en;
+
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ memset (rmp, 0, sizeof (*rmp));
+ rmp->_vl_msg_id = ntohs(VL_API_LISP_GPE_ENABLE_DISABLE_STATUS_DETAILS);
+
+ is_en = vnet_lisp_gpe_enable_disable_status();
+ rmp->is_en = is_en;
+ rmp->context = context;
+
+ vl_msg_api_send_shmem (q, (u8 *)&rmp);
+}
+
+static void
+vl_api_lisp_gpe_enable_disable_status_dump_t_handler
+(vl_api_lisp_gpe_enable_disable_status_dump_t *mp)
+{
+ unix_shared_memory_queue_t * q = NULL;
+
+ q = vl_api_client_index_to_input_queue (mp->client_index);
+ if (q == 0) {
+ return;
+ }
+
+ send_lisp_gpe_enable_disable_details(q, mp->context);
+}
+
static void
vl_api_interface_name_renumber_t_handler (vl_api_interface_name_renumber_t *mp)
{
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index 9d0f6b7f469..6ecb15fb710 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -2460,6 +2460,24 @@ define lisp_map_resolver_dump {
u32 context;
};
+/** \brief Status of lisp-gpe protocol, enable or disable
+ @param context - sender context, to match reply w/ request
+ @param is_en - enable protocol if non-zero, else disable
+*/
+manual_java define lisp_gpe_enable_disable_status_details {
+ u32 context;
+ u8 is_en;
+};
+
+/** \brief Request for lisp-gpe protocol status
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+*/
+define lisp_gpe_enable_disable_status_dump {
+ u32 client_index;
+ u32 context;
+};
+
/* Gross kludge, DGMS */
define interface_name_renumber {
u32 client_index;