aboutsummaryrefslogtreecommitdiffstats
path: root/vpp-api-test
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2016-07-04 11:43:11 +0200
committerFilip Tehlar <ftehlar@cisco.com>2016-07-07 08:13:47 +0200
commit1b1ee4f2e550d2cf98e5e5f718ad5543389c8c37 (patch)
treef1be22d0f6929819f7a7ca9cb5b775ce175dc635 /vpp-api-test
parent137c7c612641b5056bc20e64e8ef75df0c775629 (diff)
Add an option to dump details about specific LISP EID in API/CLI
Change-Id: Ie5e6751fd791e7ca728522632332abe442a1a75b Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vpp-api-test')
-rw-r--r--vpp-api-test/vat/api_format.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c
index 8c6cb66fea7..fea24684c6a 100644
--- a/vpp-api-test/vat/api_format.c
+++ b/vpp-api-test/vat/api_format.c
@@ -10966,8 +10966,34 @@ api_lisp_locator_set_dump(vat_main_t *vam)
static int
api_lisp_local_eid_table_dump(vat_main_t *vam)
{
+ unformat_input_t * i = vam->input;
vl_api_lisp_local_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;
+ u32 prefix_length = ~0, t, vni = 0;
+
+ while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) {
+ if (unformat (i, "eid %U/%d", unformat_ip4_address, &ip4, &t)) {
+ eid_set = 1;
+ eid_type = 0;
+ prefix_length = t;
+ } else if (unformat (i, "eid %U/%d", unformat_ip6_address, &ip6, &t)) {
+ eid_set = 1;
+ eid_type = 1;
+ prefix_length = t;
+ } else if (unformat (i, "eid %U", unformat_ethernet_address, mac)) {
+ eid_set = 1;
+ eid_type = 2;
+ } else if (unformat (i, "vni %d", &t))
+ vni = t;
+ else {
+ errmsg ("parse error '%U'", format_unformat_error, i);
+ return -99;
+ }
+ }
if (!vam->json_output) {
fformat(vam->ofp, "%=20s%=30s\n",
@@ -10975,6 +11001,29 @@ api_lisp_local_eid_table_dump(vat_main_t *vam)
}
M(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump);
+
+ if (eid_set) {
+ mp->eid_set = 1;
+ mp->vni = htonl (vni);
+ mp->eid_type = eid_type;
+ switch (eid_type) {
+ case 0:
+ mp->prefix_length = prefix_length;
+ clib_memcpy (mp->eid, &ip4, sizeof (ip4));
+ break;
+ case 1:
+ mp->prefix_length = prefix_length;
+ clib_memcpy (mp->eid, &ip6, sizeof (ip6));
+ break;
+ case 2:
+ clib_memcpy (mp->eid, mac, sizeof (mac));
+ break;
+ default:
+ errmsg ("unknown EID type %d!", eid_type);
+ return -99;
+ }
+ }
+
/* send it... */
S;