From 4478d8edc35757c1da66e1c3c108af24940fbdd3 Mon Sep 17 00:00:00 2001 From: John Lo Date: Fri, 12 Jan 2018 17:15:25 -0500 Subject: Improve "show xxx tunnel" and "show int addr" output Improve "show xxx tunnel" output functions format_xxx_tunnel() for GRE, VXLAN, VXLAN-GPE, GENEVE and GTPU tunnels to make their output more consistent and provide better information. Improved the output of "show int addr" to make its info more consistent with tunnels and provide fib-index info. Change-Id: Icd4b5b85a5bec417f8ee19afea336c770ad3b4c5 Signed-off-by: John Lo --- src/vnet/vxlan/vxlan.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'src/vnet/vxlan/vxlan.c') diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index 5926062b8c6..edd8733741b 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -44,15 +44,10 @@ static u8 * format_decap_next (u8 * s, va_list * args) { u32 next_index = va_arg (*args, u32); - switch (next_index) - { - case VXLAN_INPUT_NEXT_DROP: - return format (s, "drop"); - case VXLAN_INPUT_NEXT_L2_INPUT: - return format (s, "l2"); - default: - return format (s, "index %d", next_index); - } + if (next_index == VXLAN_INPUT_NEXT_DROP) + return format (s, "drop"); + else + return format (s, "index %d", next_index); return s; } @@ -61,18 +56,20 @@ u8 * format_vxlan_tunnel (u8 * s, va_list * args) vxlan_tunnel_t * t = va_arg (*args, vxlan_tunnel_t *); vxlan_main_t * ngm = &vxlan_main; - s = format (s, "[%d] src %U dst %U vni %d sw_if_index %d ", + s = format (s, "[%d] src %U dst %U vni %d fib-idx %d sw-if-idx %d ", t - ngm->tunnels, format_ip46_address, &t->src, IP46_TYPE_ANY, format_ip46_address, &t->dst, IP46_TYPE_ANY, - t->vni, t->sw_if_index); + t->vni, t->encap_fib_index, t->sw_if_index); + + s = format (s, "encap-dpo-idx %d ", t->next_dpo.dpoi_index); + + if (PREDICT_FALSE (t->decap_next_index != VXLAN_INPUT_NEXT_L2_INPUT)) + s = format (s, "decap-next-%U ", format_decap_next, t->decap_next_index); - if (ip46_address_is_multicast (&t->dst)) - s = format (s, "mcast_sw_if_index %d ", t->mcast_sw_if_index); + if (PREDICT_FALSE (ip46_address_is_multicast (&t->dst))) + s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index); - s = format (s, "encap_fib_index %d fib_entry_index %d decap_next %U\n", - t->encap_fib_index, t->fib_entry_index, - format_decap_next, t->decap_next_index); return s; } -- cgit 1.2.3-korg