diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-08-24 14:11:07 +0200 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2016-08-26 11:19:00 +0000 |
commit | c068179a6c8ce57428f4f8dda19fb2de6027fe8f (patch) | |
tree | a9e53efeb7f339b3679707e1b989d2e8315ace71 /vnet | |
parent | cc6ca8832cfd063b2f1b9b1b2809f31da0236f9d (diff) |
VPP-329: Add L2 support to lisp_eid_table_map_dump
Change-Id: Idfb115cd1f95394f4a4a569dc34c0488a1d58558
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r-- | vnet/vnet/lisp-cp/control.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/vnet/vnet/lisp-cp/control.c b/vnet/vnet/lisp-cp/control.c index d7ac3c52d2a..9941af3b01a 100644 --- a/vnet/vnet/lisp-cp/control.c +++ b/vnet/vnet/lisp-cp/control.c @@ -2005,12 +2005,42 @@ lisp_show_eid_table_map_command_fn (vlib_main_t * vm, vlib_cli_command_t * cmd) { hash_pair_t *p; + unformat_input_t _line_input, *line_input = &_line_input; lisp_cp_main_t *lcm = vnet_lisp_cp_get_main (); + uword *vni_table = 0; + u8 is_l2 = 0; + + /* Get a line of input. */ + if (!unformat_user (input, unformat_line_input, line_input)) + return 0; + + while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT) + { + if (unformat (line_input, "l2")) + { + vni_table = lcm->bd_id_by_vni; + is_l2 = 1; + } + else if (unformat (line_input, "l3")) + { + vni_table = lcm->table_id_by_vni; + is_l2 = 0; + } + else + return clib_error_return (0, "parse error: '%U'", + format_unformat_error, line_input); + } + + if (!vni_table) + { + vlib_cli_output (vm, "Error: expected l2|l3 param!\n"); + return 0; + } - vlib_cli_output (vm, "%=10s%=10s", "VNI", "VRF"); + vlib_cli_output (vm, "%=10s%=10s", "VNI", is_l2 ? "BD" : "VRF"); /* *INDENT-OFF* */ - hash_foreach_pair (p, lcm->table_id_by_vni, + hash_foreach_pair (p, vni_table, ({ vlib_cli_output (vm, "%=10d%=10d", p->key, p->value[0]); })); @@ -2022,7 +2052,7 @@ lisp_show_eid_table_map_command_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_CLI_COMMAND (lisp_show_eid_table_map_command) = { .path = "show lisp eid-table map", - .short_help = "show lisp eid-table vni to vrf mappings", + .short_help = "show lisp eid-table l2|l3", .function = lisp_show_eid_table_map_command_fn, }; /* *INDENT-ON* */ |