summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vnet/vnet/lisp-cp/control.c38
-rw-r--r--vpp-api-test/vat/api_format.c518
-rw-r--r--vpp-api-test/vat/vat.h12
-rw-r--r--vpp/vpp-api/api.c53
-rw-r--r--vpp/vpp-api/vpe.api39
5 files changed, 542 insertions, 118 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c
index f966b3645de..4e955c4de47 100644
--- a/vnet/vnet/lisp-cp/control.c
+++ b/vnet/vnet/lisp-cp/control.c
@@ -1359,8 +1359,11 @@ format_eid_entry (u8 * s, va_list * args)
{
vnet_main_t * vnm = va_arg (*args, vnet_main_t *);
lisp_cp_main_t * lcm = va_arg (*args, lisp_cp_main_t *);
- gid_address_t * gid = va_arg (*args, gid_address_t *);
+ mapping_t * mapit = va_arg (*args, mapping_t *);
locator_set_t * ls = va_arg (*args, locator_set_t *);
+ gid_address_t * gid = &mapit->eid;
+ u32 ttl = mapit->ttl;
+ u8 aut = mapit->authoritative;
u32 * loc_index;
u8 first_line = 1;
u8 * loc;
@@ -1370,7 +1373,8 @@ format_eid_entry (u8 * s, va_list * args)
if (vec_len (ls->locator_indices) == 0)
{
- s = format (s, "%-35U%-20s", format_gid_address, gid, type);
+ s = format (s, "%-35U%-30s%-20u%-u", format_gid_address, gid,
+ type, ttl, aut);
}
else
{
@@ -1386,8 +1390,8 @@ format_eid_entry (u8 * s, va_list * args)
if (first_line)
{
- s = format (s, "%-35U%-20s%-v\n", format_gid_address,
- gid, type, loc);
+ s = format (s, "%-35U%-20s%-30v%-20u%-u\n", format_gid_address,
+ gid, type, loc, ttl, aut);
first_line = 0;
}
else
@@ -1408,6 +1412,7 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
u32 mi;
gid_address_t eid;
u8 print_all = 1;
+ u8 filter = 0;
memset (&eid, 0, sizeof(eid));
@@ -1419,12 +1424,17 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
{
if (unformat (line_input, "eid %U", unformat_gid_address, &eid))
print_all = 0;
+ else if (unformat (line_input, "local"))
+ filter = 1;
+ else if (unformat(line_input, "remote"))
+ filter = 2;
else
return clib_error_return (0, "parse error: '%U'",
format_unformat_error, line_input);
}
- vlib_cli_output (vm, "%-35s%-20s%-s", "EID", "type", "locators");
+ vlib_cli_output (vm, "%-35s%-20s%-30s%-20s%-s",
+ "EID", "type", "locators", "ttl", "autoritative");
if (print_all)
{
@@ -1432,8 +1442,13 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
({
locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
mapit->locator_set_index);
+ if (filter && !((1 == filter && ls->local) ||
+ (2 == filter && !ls->local)))
+ {
+ continue;
+ }
vlib_cli_output (vm, "%U", format_eid_entry, lcm->vnet_main,
- lcm, &mapit->eid, ls);
+ lcm, mapit, ls);
}));
}
else
@@ -1445,8 +1460,15 @@ lisp_show_eid_table_command_fn (vlib_main_t * vm,
mapit = pool_elt_at_index (lcm->mapping_pool, mi);
locator_set_t * ls = pool_elt_at_index (lcm->locator_set_pool,
mapit->locator_set_index);
- vlib_cli_output (vm, "%U", format_eid_entry, lcm->vnet_main,
- lcm, &mapit->eid, ls);
+
+ if (filter && !((1 == filter && ls->local) ||
+ (2 == filter && !ls->local)))
+ {
+ return 0;
+ }
+
+ vlib_cli_output (vm, "%U,", format_eid_entry, lcm->vnet_main,
+ lcm, mapit, ls);
}
return 0;
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 0b6cf7fd1b6..04f8799917c 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -2167,31 +2167,41 @@ vl_api_lisp_locator_set_details_t_handler_json (
}
static void
-vl_api_lisp_local_eid_table_details_t_handler (
- vl_api_lisp_local_eid_table_details_t *mp)
+vl_api_lisp_eid_table_details_t_handler (
+ vl_api_lisp_eid_table_details_t * mp)
{
vat_main_t *vam = &vat_main;
- u8 *prefix;
- u8 * (*format_eid)(u8 *, va_list *) = 0;
+ eid_table_t eid_table;
- switch (mp->eid_type)
- {
- case 0: format_eid = format_ip4_address; break;
- case 1: format_eid = format_ip6_address; break;
- case 2: format_eid = format_ethernet_address; break;
- default:
- errmsg ("unknown EID type %d!", mp->eid_type);
- return;
- }
-
- prefix = format(0, "[%d] %U/%d",
- clib_net_to_host_u32 (mp->vni),
- format_eid, mp->eid, mp->eid_prefix_len);
+ memset(&eid_table, 0, sizeof(eid_table));
+ eid_table.is_local = mp->is_local;
+ eid_table.locator_set_index = mp->locator_set_index;
+ eid_table.eid_type = mp->eid_type;
+ eid_table.vni = mp->vni;
+ eid_table.eid_prefix_len = mp->eid_prefix_len;
+ eid_table.ttl = mp->ttl;
+ eid_table.authoritative = mp->authoritative;
+ clib_memcpy(eid_table.eid, mp->eid, sizeof(eid_table.eid));
+ vec_add1(vam->eid_tables, eid_table);
+}
- fformat(vam->ofp, "%=20s%=30s\n",
- mp->locator_set_name, prefix);
+static void
+vl_api_lisp_eid_table_details_t_handler_json (
+ vl_api_lisp_eid_table_details_t * mp)
+{
+ vat_main_t *vam = &vat_main;
+ eid_table_t eid_table;
- vec_free(prefix);
+ memset(&eid_table, 0, sizeof(eid_table));
+ eid_table.is_local = mp->is_local;
+ eid_table.locator_set_index = mp->locator_set_index;
+ eid_table.eid_type = mp->eid_type;
+ eid_table.vni = mp->vni;
+ eid_table.eid_prefix_len = mp->eid_prefix_len;
+ eid_table.ttl = mp->ttl;
+ eid_table.authoritative = mp->authoritative;
+ clib_memcpy(eid_table.eid, mp->eid, sizeof(eid_table.eid));
+ vec_add1(vam->eid_tables, eid_table);
}
static void
@@ -2224,48 +2234,7 @@ vl_api_lisp_eid_table_map_details_t_handler_json (
vat_json_object_add_uint(node, "vni", clib_net_to_host_u32 (mp->vni));
}
-static void
-vl_api_lisp_local_eid_table_details_t_handler_json (
- vl_api_lisp_local_eid_table_details_t *mp)
-{
- vat_main_t *vam = &vat_main;
- vat_json_node_t *node = NULL;
- struct in6_addr ip6;
- struct in_addr ip4;
- u8 * s = 0;
- if (VAT_JSON_ARRAY != vam->json_tree.type) {
- ASSERT(VAT_JSON_NONE == vam->json_tree.type);
- 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, "locator-set", mp->locator_set_name);
- switch (mp->eid_type)
- {
- case 0:
- clib_memcpy(&ip4, mp->eid, sizeof(ip4));
- vat_json_object_add_ip4(node, "eid", ip4);
- vat_json_object_add_uint(node, "eid-prefix-len", mp->eid_prefix_len);
- break;
- case 1:
- clib_memcpy(&ip6, mp->eid, sizeof(ip6));
- vat_json_object_add_ip6(node, "eid", ip6);
- vat_json_object_add_uint(node, "eid-prefix-len", mp->eid_prefix_len);
- break;
- case 2:
- s = format (0, "%U", format_ethernet_address, mp->eid);
- vec_add1(s, 0);
- vat_json_object_add_string_copy(node, "eid", s);
- vec_free(s);
- break;
- default:
- errmsg ("unknown EID type %d!", mp->eid_type);
- return;
- }
- vat_json_object_add_uint(node, "vni", clib_net_to_host_u32 (mp->vni));
-}
static u8 *
format_decap_next (u8 * s, va_list * args)
@@ -3278,7 +3247,7 @@ _(LISP_EID_TABLE_ADD_DEL_MAP_REPLY, lisp_eid_table_add_del_map_reply) \
_(LISP_GPE_ADD_DEL_IFACE_REPLY, lisp_gpe_add_del_iface_reply) \
_(LISP_LOCATOR_SET_DETAILS, lisp_locator_set_details) \
_(LISP_LOCATOR_DETAILS, lisp_locator_details) \
-_(LISP_LOCAL_EID_TABLE_DETAILS, lisp_local_eid_table_details) \
+_(LISP_EID_TABLE_DETAILS, lisp_eid_table_details) \
_(LISP_EID_TABLE_MAP_DETAILS, lisp_eid_table_map_details) \
_(LISP_GPE_TUNNEL_DETAILS, lisp_gpe_tunnel_details) \
_(LISP_MAP_RESOLVER_DETAILS, lisp_map_resolver_details) \
@@ -11640,6 +11609,18 @@ lisp_locator_dump_send_msg(vat_main_t * vam, u32 locator_set_index, u8 filter)
W;
}
+static inline void
+clean_locator_set_message(vat_main_t * vam)
+{
+ locator_set_msg_t * ls = 0;
+
+ vec_foreach (ls, vam->locator_set_msg) {
+ vec_free(ls->locator_set_name);
+ }
+
+ vec_free(vam->locator_set_msg);
+}
+
static int
print_locator_in_locator_set(vat_main_t * vam, u8 filter)
{
@@ -11651,9 +11632,8 @@ print_locator_in_locator_set(vat_main_t * vam, u8 filter)
vec_foreach(ls, vam->locator_set_msg) {
ret = lisp_locator_dump_send_msg(vam, ls->locator_set_index, filter);
if (ret) {
- vec_free(ls->locator_set_name);
vec_free(vam->locator_msg);
- vec_free(vam->locator_set_msg);
+ clean_locator_set_message(vam);
return ret;
}
@@ -11683,11 +11663,10 @@ print_locator_in_locator_set(vat_main_t * vam, u8 filter)
fformat(vam->ofp, "%s", tmp_str);
vec_free(tmp_str);
- vec_free(ls->locator_set_name);
vec_free(vam->locator_msg);
}
- vec_free(vam->locator_set_msg);
+ clean_locator_set_message(vam);
return ret;
}
@@ -11966,16 +11945,381 @@ api_lisp_eid_table_map_dump(vat_main_t *vam)
}
static int
-api_lisp_local_eid_table_dump(vat_main_t *vam)
+get_locator_set(vat_main_t * vam)
+{
+ vl_api_lisp_locator_set_dump_t *mp;
+ f64 timeout = ~0;
+
+ M(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump);
+ /* send it... */
+ S;
+
+ /* Use a control ping for synchronization */
+ {
+ vl_api_noprint_control_ping_t * mp;
+ M(NOPRINT_CONTROL_PING, noprint_control_ping);
+ S;
+ }
+
+ /* Wait for a reply... */
+ W;
+
+ /* NOTREACHED */
+ return 0;
+}
+
+static inline u8 *
+format_eid_for_eid_table(vat_main_t *vam, u8 * str, eid_table_t * eid_table,
+ int *ret)
+{
+ u8 * (*format_eid)(u8 *, va_list *) = 0;
+
+ ASSERT(vam != NULL);
+ ASSERT(eid_table != NULL);
+
+ if (ret) {
+ *ret = 0;
+ }
+
+ switch (eid_table->eid_type)
+ {
+ case 0:
+ case 1:
+ format_eid = (eid_table->eid_type ? format_ip6_address :
+ format_ip4_address);
+ str = format(0, "[%d] %U/%d",
+ clib_net_to_host_u32 (eid_table->vni),
+ format_eid, eid_table->eid, eid_table->eid_prefix_len);
+ break;
+ case 2:
+ str = format(0, "[%d] %U",
+ clib_net_to_host_u32 (eid_table->vni),
+ format_ethernet_address, eid_table->eid);
+ break;
+ default:
+ errmsg ("unknown EID type %d!", eid_table->eid_type);
+ if (ret) {
+ *ret = -99;
+ }
+ return 0;
+ }
+
+ return str;
+}
+
+static inline u8 *
+format_locator_set_for_eid_table(vat_main_t * vam, u8 * str,
+ eid_table_t * eid_table)
+{
+ locator_set_msg_t * ls = 0;
+
+ ASSERT(vam != NULL);
+ ASSERT(eid_table != NULL);
+
+ if (eid_table->is_local) {
+ vec_foreach (ls, vam->locator_set_msg) {
+ if (ls->locator_set_index == eid_table->locator_set_index) {
+ str = format(0, "local(%s)", ls->locator_set_name);
+ return str;
+ }
+ }
+
+ str = format(0, "local(N/A)");
+ } else {
+ str = format(0, "remote");
+ }
+
+ return str;
+}
+
+static inline u8 *
+format_locator_for_eid_table(vat_main_t * vam, u8 * str,
+ eid_table_t * eid_table)
+{
+ locator_msg_t * loc = 0;
+ int first_line = 1;
+
+ ASSERT(vam != NULL);
+ ASSERT(eid_table != NULL);
+
+ vec_foreach(loc, vam->locator_msg) {
+ if (!first_line) {
+ if (loc->local) {
+ str = format(str, "%-55s%-d\n", " ", loc->sw_if_index);
+ } else {
+ str = format(str, "%=55s%-U\n", " ",
+ loc->is_ipv6 ? format_ip6_address :
+ format_ip4_address,
+ loc->ip_address);
+ }
+
+ continue;
+ }
+
+ if (loc->local) {
+ str = format(str, "%-30d%-20u%-u\n", loc->sw_if_index,
+ eid_table->ttl, eid_table->authoritative);
+ } else {
+ str = format(str, "%-30U%-20u%-u\n",
+ loc->is_ipv6 ? format_ip6_address :
+ format_ip4_address,
+ loc->ip_address, eid_table->ttl,
+ eid_table->authoritative);
+ }
+ first_line = 0;
+ }
+
+ return str;
+}
+
+static int
+print_lisp_eid_table_dump(vat_main_t * vam)
+{
+ eid_table_t * eid_table = 0;
+ u8 * tmp_str = 0, * tmp_str2 = 0;
+ int ret = 0;
+
+ ASSERT(vam != NULL);
+
+ ret = get_locator_set(vam);
+ if (ret) {
+ vec_free(vam->eid_tables);
+ return ret;
+ }
+
+ fformat(vam->ofp, "%-35s%-20s%-30s%-20s%-s\n", "EID", "type", "locators",
+ "ttl", "authoritative");
+
+ vec_foreach(eid_table, vam->eid_tables) {
+ ret = lisp_locator_dump_send_msg(vam, eid_table->locator_set_index, 0);
+ if (ret) {
+ vec_free(vam->locator_msg);
+ clean_locator_set_message(vam);
+ vec_free(vam->eid_tables);
+ return ret;
+ }
+
+ tmp_str2 = format_eid_for_eid_table(vam, tmp_str2, eid_table, &ret);
+ if (ret) {
+ vec_free(vam->locator_msg);
+ clean_locator_set_message(vam);
+ vec_free(vam->eid_tables);
+ return ret;
+ }
+
+ tmp_str = format(0, "%-35s", tmp_str2);
+ vec_free(tmp_str2);
+
+ tmp_str2 = format_locator_set_for_eid_table(vam, tmp_str2, eid_table);
+ tmp_str = format(tmp_str, "%-20s", tmp_str2);
+ vec_free(tmp_str2);
+
+ tmp_str2 = format_locator_for_eid_table(vam, tmp_str2, eid_table);
+ tmp_str = format(tmp_str, "%-s", tmp_str2);
+ vec_free(tmp_str2);
+
+ fformat(vam->ofp, "%s", tmp_str);
+ vec_free(tmp_str);
+ vec_free(vam->locator_msg);
+ }
+
+ clean_locator_set_message(vam);
+ vec_free(vam->eid_tables);
+
+ return ret;
+}
+
+static inline void
+json_locator_set_for_eid_table(vat_main_t * vam, vat_json_node_t * node,
+ eid_table_t * eid_table)
+{
+ locator_set_msg_t * ls = 0;
+ u8 * s = 0;
+
+ ASSERT(vam != NULL);
+ ASSERT(node != NULL);
+ ASSERT(eid_table != NULL);
+
+ if (eid_table->is_local) {
+ vec_foreach (ls, vam->locator_set_msg) {
+ if (ls->locator_set_index == eid_table->locator_set_index) {
+ vat_json_object_add_string_copy(node, "locator-set",
+ ls->locator_set_name);
+ return;
+ }
+ }
+
+ s = format(0, "N/A");
+ vec_add1(s, 0);
+ vat_json_object_add_string_copy(node, "locator-set", s);
+ vec_free(s);
+ } else {
+ s = format(0, "remote");
+ vec_add1(s, 0);
+ vat_json_object_add_string_copy(node, "locator-set", s);
+ vec_free(s);
+ }
+}
+
+static inline int
+json_eid_for_eid_table(vat_main_t * vam, vat_json_node_t * node,
+ eid_table_t * eid_table)
+{
+ u8 * s = 0;
+ struct in6_addr ip6;
+ struct in_addr ip4;
+
+ ASSERT(vam != NULL);
+ ASSERT(node != NULL);
+ ASSERT(eid_table != NULL);
+
+ switch (eid_table->eid_type)
+ {
+ case 0:
+ clib_memcpy(&ip4, eid_table->eid, sizeof(ip4));
+ vat_json_object_add_ip4(node, "eid", ip4);
+ vat_json_object_add_uint(node, "eid-prefix-len",
+ eid_table->eid_prefix_len);
+ break;
+ case 1:
+ clib_memcpy(&ip6, eid_table->eid, sizeof(ip6));
+ vat_json_object_add_ip6(node, "eid", ip6);
+ vat_json_object_add_uint(node, "eid-prefix-len",
+ eid_table->eid_prefix_len);
+ break;
+ case 2:
+ s = format (0, "%U", format_ethernet_address, eid_table->eid);
+ vec_add1(s, 0);
+ vat_json_object_add_string_copy(node, "eid", s);
+ vec_free(s);
+ break;
+ default:
+ errmsg ("unknown EID type %d!", eid_table->eid_type);
+ return -99;
+ }
+
+ return 0;
+}
+
+static inline void
+json_locator_for_eid_table(vat_main_t * vam, vat_json_node_t * node,
+ eid_table_t * eid_table)
+{
+ locator_msg_t * loc = 0;
+ vat_json_node_t * locator_array = 0;
+ vat_json_node_t * locator = 0;
+ struct in6_addr ip6;
+ struct in_addr ip4;
+
+ ASSERT(vam != NULL);
+ ASSERT(node != NULL);
+ ASSERT(eid_table != NULL);
+
+ locator_array = vat_json_object_add_list(node, "locator");
+ vec_foreach(loc, vam->locator_msg) {
+ locator = vat_json_array_add(locator_array);
+ vat_json_init_object(locator);
+ if (loc->local) {
+ vat_json_object_add_uint(locator, "locator-index",
+ loc->sw_if_index);
+ } else {
+ if (loc->is_ipv6) {
+ clib_memcpy(&ip6, loc->ip_address, sizeof(ip6));
+ vat_json_object_add_ip6(locator, "locator", ip6);
+ } else {
+ clib_memcpy(&ip4, loc->ip_address, sizeof(ip4));
+ vat_json_object_add_ip4(locator, "locator", ip4);
+ }
+ }
+ }
+}
+
+static int
+json_lisp_eid_table_dump(vat_main_t * vam)
+{
+ eid_table_t * eid_table;
+ vat_json_node_t * node = 0;
+ int ret = 0;
+
+ ASSERT(vam != NULL);
+
+ ret = get_locator_set(vam);
+ if (ret) {
+ vec_free(vam->eid_tables);
+ return ret;
+ }
+
+ if (!vec_len(vam->eid_tables)) {
+ /* just print [] */
+ vat_json_init_array(&vam->json_tree);
+ vat_json_print(vam->ofp, &vam->json_tree);
+ vam->json_tree.type = VAT_JSON_NONE;
+ return ret;
+ }
+
+ if (VAT_JSON_ARRAY != vam->json_tree.type) {
+ ASSERT(VAT_JSON_NONE == vam->json_tree.type);
+ vat_json_init_array(&vam->json_tree);
+ }
+
+ vec_foreach(eid_table, vam->eid_tables) {
+ ret = lisp_locator_dump_send_msg(vam, eid_table->locator_set_index, 0);
+ if (ret) {
+ vec_free(vam->locator_msg);
+ vec_free(vam->eid_tables);
+ clean_locator_set_message(vam);
+ vat_json_free(&vam->json_tree);
+ vam->json_tree.type = VAT_JSON_NONE;
+ return ret;
+ }
+
+ node = vat_json_array_add(&vam->json_tree);
+ vat_json_init_object(node);
+
+ vat_json_object_add_uint(node, "vni", eid_table->vni);
+
+ json_locator_set_for_eid_table(vam, node, eid_table);
+ ret = json_eid_for_eid_table(vam, node, eid_table);
+ if (ret) {
+ vec_free(vam->locator_msg);
+ vec_free(vam->eid_tables);
+ clean_locator_set_message(vam);
+ vat_json_free(&vam->json_tree);
+ vam->json_tree.type = VAT_JSON_NONE;
+ return ret;
+ }
+
+ json_locator_for_eid_table(vam, node, eid_table);
+
+ vat_json_object_add_uint(node, "ttl", eid_table->ttl);
+ vat_json_object_add_uint(node, "authoritative",
+ eid_table->authoritative);
+
+ vec_free(vam->locator_msg);
+ }
+
+ vat_json_print(vam->ofp, &vam->json_tree);
+ vat_json_free(&vam->json_tree);
+ vam->json_tree.type = VAT_JSON_NONE;
+
+ clean_locator_set_message(vam);
+ vec_free(vam->eid_tables);
+
+ return ret;
+}
+
+static int
+api_lisp_eid_table_dump(vat_main_t *vam)
{
unformat_input_t * i = vam->input;
- vl_api_lisp_local_eid_table_dump_t *mp;
+ vl_api_lisp_eid_table_dump_t *mp;
f64 timeout = ~0;
struct in_addr ip4;
struct in6_addr ip6;
u8 mac[6];
u8 eid_type = ~0, eid_set = 0;
u32 prefix_length = ~0, t, vni = 0;
+ u8 filter = 0;
while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
if (unformat (i, "eid %U/%d", unformat_ip4_address, &ip4, &t)) {
@@ -11989,21 +12333,21 @@ api_lisp_local_eid_table_dump(vat_main_t *vam)
} else if (unformat (i, "eid %U", unformat_ethernet_address, mac)) {
eid_set = 1;
eid_type = 2;
- } else if (unformat (i, "vni %d", &t))
+ } else if (unformat (i, "vni %d", &t)) {
vni = t;
- else {
+ } 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) {
- fformat(vam->ofp, "%=20s%=30s\n",
- "Locator-set", "Eid");
- }
-
- M(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump);
+ M(LISP_EID_TABLE_DUMP, lisp_eid_table_dump);
+ mp->filter = filter;
if (eid_set) {
mp->eid_set = 1;
mp->vni = htonl (vni);
@@ -12026,17 +12370,30 @@ api_lisp_local_eid_table_dump(vat_main_t *vam)
}
}
+ vam->noprint_msg = 1;
+
/* send it... */
S;
/* Use a control ping for synchronization */
{
- vl_api_control_ping_t * mp;
- M(CONTROL_PING, control_ping);
+ vl_api_noprint_control_ping_t * mp;
+ M(NOPRINT_CONTROL_PING, noprint_control_ping);
S;
}
+
/* Wait for a reply... */
- W;
+ W_L({
+ if (vam->noprint_msg) {
+ if (!vam->json_output) {
+ vam->retval = print_lisp_eid_table_dump(vam);
+ } else {
+ vam->retval = json_lisp_eid_table_dump(vam);
+ }
+ }
+
+ vam->noprint_msg = 0;
+ });
/* NOTREACHED */
return 0;
@@ -13601,7 +13958,8 @@ _(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, "[locator-set-index <ls-index> | " \
"locator-set <loc-set-name>] [local | remote]")\
-_(lisp_local_eid_table_dump, "") \
+_(lisp_eid_table_dump, "[eid <ipv4|ipv6>/<prefix> | <mac>] [vni] " \
+ "[local] | [remote]") \
_(lisp_eid_table_map_dump, "") \
_(lisp_gpe_tunnel_dump, "") \
_(lisp_map_resolver_dump, "") \
diff --git a/vpp-api-test/vat/vat.h b/vpp-api-test/vat/vat.h
index 684ad4c6a14..5f553bcb9f7 100644
--- a/vpp-api-test/vat/vat.h
+++ b/vpp-api-test/vat/vat.h
@@ -99,6 +99,17 @@ typedef struct {
} locator_msg_t;
typedef struct {
+ u32 locator_set_index;
+ u8 is_local;
+ u8 eid_type;
+ u32 vni;
+ u8 eid[16];
+ u8 eid_prefix_len;
+ u32 ttl;
+ u8 authoritative;
+} eid_table_t;
+
+typedef struct {
/* vpe input queue */
unix_shared_memory_queue_t * vl_input_queue;
@@ -189,6 +200,7 @@ typedef struct {
u8 noprint_msg;
locator_set_msg_t * locator_set_msg;
locator_msg_t * locator_msg;
+ eid_table_t * eid_tables;
} vat_main_t;
diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c
index c06045f702b..6796b57584f 100644
--- a/vpp/vpp-api/api.c
+++ b/vpp/vpp-api/api.c
@@ -341,7 +341,7 @@ _(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set) \
_(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_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump) \
+_(LISP_EID_TABLE_DUMP, lisp_eid_table_dump) \
_(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump) \
_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump) \
_(LISP_EID_TABLE_MAP_DUMP, lisp_eid_table_map_dump) \
@@ -5380,37 +5380,49 @@ vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t *mp)
}
static void
-send_lisp_local_eid_table_details (mapping_t *mapit,
+send_lisp_eid_table_details (mapping_t *mapit,
unix_shared_memory_queue_t *q,
- u32 context)
+ u32 context, u8 filter)
{
- vl_api_lisp_local_eid_table_details_t *rmp = NULL;
+ vl_api_lisp_eid_table_details_t *rmp = NULL;
lisp_cp_main_t * lcm = vnet_lisp_cp_get_main();
locator_set_t *ls = NULL;
gid_address_t *gid = NULL;
u8 * mac = 0;
ip_prefix_t *ip_prefix = NULL;
- u8 * str = NULL;
ls = pool_elt_at_index (lcm->locator_set_pool,
mapit->locator_set_index);
+
+ switch (filter) {
+ case 0:
+ break;
+ case 1:
+ if (!ls->local) {
+ return;
+ }
+ break;
+ case 2:
+ if (ls->local) {
+ return;
+ }
+ break;
+ default:
+ clib_warning("Filter error, unknown filter: %d\n", filter);
+ return;
+ }
+
gid = &mapit->eid;
ip_prefix = &gid_address_ippref(gid);
mac = gid_address_mac(gid);
rmp = vl_msg_api_alloc (sizeof (*rmp));
memset (rmp, 0, sizeof (*rmp));
- rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCAL_EID_TABLE_DETAILS);
- if (ls->local) {
- ASSERT(ls->name != NULL);
- strncpy((char *) rmp->locator_set_name,
- (char *) ls->name, ARRAY_LEN(rmp->locator_set_name) - 1);
- } else {
- str = format(0, "remote-%d", mapit->locator_set_index);
- strncpy((char *) rmp->locator_set_name, (char *) str,
- ARRAY_LEN(rmp->locator_set_name) - 1);
- vec_free(str);
- }
+ rmp->_vl_msg_id = ntohs(VL_API_LISP_EID_TABLE_DETAILS);
+ rmp->locator_set_index = mapit->locator_set_index;
+ rmp->is_local = ls->local;
+ rmp->ttl = mapit->ttl;
+ rmp->authoritative = mapit->authoritative;
switch (gid_address_type (gid))
{
@@ -5442,8 +5454,8 @@ send_lisp_local_eid_table_details (mapping_t *mapit,
}
static void
-vl_api_lisp_local_eid_table_dump_t_handler (
- vl_api_lisp_local_eid_table_dump_t *mp)
+vl_api_lisp_eid_table_dump_t_handler (
+ vl_api_lisp_eid_table_dump_t *mp)
{
u32 mi;
unix_shared_memory_queue_t * q = NULL;
@@ -5482,11 +5494,12 @@ vl_api_lisp_local_eid_table_dump_t_handler (
return;
mapit = pool_elt_at_index (lcm->mapping_pool, mi);
- send_lisp_local_eid_table_details(mapit, q, mp->context);
+ send_lisp_eid_table_details(mapit, q, mp->context, mp->filter);
} else {
pool_foreach (mapit, lcm->mapping_pool,
({
- send_lisp_local_eid_table_details(mapit, q, mp->context);
+ send_lisp_eid_table_details(mapit, q, mp->context,
+ mp->filter);
}));
}
}
diff --git a/vpp/vpp-api/vpe.api b/vpp/vpp-api/vpe.api
index 1b329e97c45..2019f3ae972 100644
--- a/vpp/vpp-api/vpe.api
+++ b/vpp/vpp-api/vpe.api
@@ -2581,22 +2581,35 @@ define lisp_locator_set_dump {
u8 filter;
};
-/** \brief LISP local eid table status
- @param locator_set_name - name of the locator_set
- @param eid_type - ip4, ip6 or l2 mac address
- @param eid - array of address bytes
- @param eid_prefix_len - prefix len
- */
-define lisp_local_eid_table_details {
+/** \brief Dump lisp eid-table
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
+ @param locator_set_index - index of locator_set
+ @param is_local - local if non-zero, else remote
+ @param eid_type:
+ 0 : ipv4
+ 1 : ipv6
+ 2 : mac
+ @param eid - EID can be ip4, ip6 or mac
+ @param prefix_len - prefix len
+ @param vni - virtual network instance
+ @param ttl - time to live
+ @param authoritative - authoritative
+*/
+
+define lisp_eid_table_details {
u32 context;
- u8 locator_set_name[64];
+ u32 locator_set_index;
+ u8 is_local;
u8 eid_type;
u32 vni;
u8 eid[16];
u8 eid_prefix_len;
+ u32 ttl;
+ u8 authoritative;
};
-/** \brief Request for local eid table summary status
+/** \brief Request for eid table summary status
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
@param eid_set - if non-zero request info about specific mapping
@@ -2609,8 +2622,13 @@ define lisp_local_eid_table_details {
1: EID is IPv6
2: EID is ethernet address
@param eid - endpoint identifier
+ @param filter - filter type;
+ Support values:
+ 0: all eid
+ 1: local eid
+ 2: remote eid
*/
-define lisp_local_eid_table_dump {
+define lisp_eid_table_dump {
u32 client_index;
u32 context;
u8 eid_set;
@@ -2618,6 +2636,7 @@ define lisp_local_eid_table_dump {
u32 vni;
u8 eid_type;
u8 eid[16];
+ u8 filter;
};
/** \brief Shows relationship between vni and vrf