From 6cc6f9175c46d9a98db43f47da35119e2b59aa00 Mon Sep 17 00:00:00 2001 From: Andrej Kozemcak Date: Wed, 13 Jul 2016 13:01:01 +0200 Subject: Edit eid table dump - change output from eid table - add eid filter: all - dump all eid local - dump local eid remote - dump remote eid Change-Id: Ifaaad8abf44cf70c4c22d05252e501456f1f1083 Signed-off-by: Andrej Kozemcak --- vpp/vpp-api/api.c | 53 +++++++++++++++++++++++++++++++++-------------------- vpp/vpp-api/vpe.api | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 62 insertions(+), 30 deletions(-) (limited to 'vpp') diff --git a/vpp/vpp-api/api.c b/vpp/vpp-api/api.c index c06045f7..6796b575 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 1b329e97..2019f3ae 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 -- cgit 1.2.3-korg