diff options
author | Neale Ranns <nranns@cisco.com> | 2018-06-04 17:10:18 -0700 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-06-06 00:35:08 +0000 |
commit | d9aa9ff03c85cda61e5df72190807ba11a417c8b (patch) | |
tree | ba2466bf38d61fad672258843a0db12a4fc4dab0 | |
parent | 2302d0dfa27a348d96a6c9a7d667bd910280a098 (diff) |
BIER CLI show commands; no crash on non-existant objects (VPP-1303)
DBGvpp# sh bier disp entry
DBGvpp# sh bier disp entry 0
No such BIER disp entry: 0
DBGvpp# sh bier disp table
DBGvpp# sh bier disp table 0
No such BIER disp table: 0
DBGvpp# sh bier disp table 11
No such BIER disp table: 11
DBGvpp#
DBGvpp# sh bier bift
no BIFT entries
DBGvpp# sh bier bift set 0
no BIFT entries
DBGvpp# sh bier bift set 0 sd 0 bsl 0
no BIFT entries
DBGvpp#
DBGvpp# sh bier fib
No BIER tables
DBGvpp# sh bier fib 0
DBGvpp# sh bier fib 0 4
DBGvpp# sh bier fmask
DBGvpp# sh bier fmask 2
No BIER f-mask 2
DBGvpp# sh bier imp
DBGvpp# sh bier imp 0
No such BIER imposition: 0
Change-Id: Ibadac3441dd8a6d1b96bd9ee4358e28498875b95
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 8f6e3218623ddbb836d6a47ed2678f8ab99f2471)
-rw-r--r-- | src/vnet/bier/bier_disp_entry.c | 11 | ||||
-rw-r--r-- | src/vnet/bier/bier_disp_table.c | 11 | ||||
-rw-r--r-- | src/vnet/bier/bier_imp.c | 11 |
3 files changed, 27 insertions, 6 deletions
diff --git a/src/vnet/bier/bier_disp_entry.c b/src/vnet/bier/bier_disp_entry.c index 2fe2e4ab909..2df8314dc09 100644 --- a/src/vnet/bier/bier_disp_entry.c +++ b/src/vnet/bier/bier_disp_entry.c @@ -375,8 +375,15 @@ show_bier_disp_entry (vlib_main_t * vm, } else { - vlib_cli_output(vm, "%U", format_bier_disp_entry, bdei, 1, - BIER_SHOW_DETAIL); + if (pool_is_free_index(bier_disp_entry_pool, bdei)) + { + vlib_cli_output(vm, "No such BIER disp entry: %d", bdei); + } + else + { + vlib_cli_output(vm, "%U", format_bier_disp_entry, bdei, 1, + BIER_SHOW_DETAIL); + } } return (NULL); } diff --git a/src/vnet/bier/bier_disp_table.c b/src/vnet/bier/bier_disp_table.c index c663286efcb..68edb088400 100644 --- a/src/vnet/bier/bier_disp_table.c +++ b/src/vnet/bier/bier_disp_table.c @@ -385,8 +385,15 @@ show_bier_disp_table (vlib_main_t * vm, } else { - vlib_cli_output(vm, "%U", format_bier_disp_table, bdti, 0, - BIER_SHOW_DETAIL); + if (pool_is_free_index(bier_disp_table_pool, bdti)) + { + vlib_cli_output(vm, "No such BIER disp table: %d", bdti); + } + else + { + vlib_cli_output(vm, "%U", format_bier_disp_table, bdti, 0, + BIER_SHOW_DETAIL); + } } return (NULL); } diff --git a/src/vnet/bier/bier_imp.c b/src/vnet/bier/bier_imp.c index bd934b77f16..0c87d1724b4 100644 --- a/src/vnet/bier/bier_imp.c +++ b/src/vnet/bier/bier_imp.c @@ -275,8 +275,15 @@ show_bier_imp (vlib_main_t * vm, } else { - vlib_cli_output(vm, "%U", format_bier_imp, bii, 1, - BIER_SHOW_DETAIL); + if (pool_is_free_index(bier_imp_pool, bii)) + { + vlib_cli_output(vm, "No such BIER imposition: %d", bii); + } + else + { + vlib_cli_output(vm, "%U", format_bier_imp, bii, 1, + BIER_SHOW_DETAIL); + } } return (NULL); } |