From f588f35d665425324af87378e09b40920e44a548 Mon Sep 17 00:00:00 2001 From: Pierre Pfister Date: Fri, 7 Oct 2016 16:31:57 +0100 Subject: Test: Add test case for Load Balancer plugin This adds a basic test for the four existing encap modes for the load balancer plugin. - ip4 over gre4 - ip4 over gre6 - ip6 over gre4 - ip6 over gre6 Apparently, scapy does not support GRE and IPv6 combinations. Hence, those tests do send packets through VPP, but only ip4 over gre4 output is actually parsed and verified. Change-Id: I7cedb0f88fd0788ee51b1428ddf9cff7c037511f Signed-off-by: Pierre Pfister --- plugins/lb-plugin/lb/lb.c | 4 +++- plugins/lb-plugin/lb/node.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/lb-plugin/lb/lb.c b/plugins/lb-plugin/lb/lb.c index 6af4697e..69bd660a 100644 --- a/plugins/lb-plugin/lb/lb.c +++ b/plugins/lb-plugin/lb/lb.c @@ -118,7 +118,9 @@ u8 *format_lb_vip (u8 * s, va_list * args) u8 *format_lb_as (u8 * s, va_list * args) { lb_as_t *as = va_arg (*args, lb_as_t *); - return format(s, "%U %s", format_ip46_address, &as->address, (as->flags & LB_AS_FLAGS_USED)?"used":"removed"); + return format(s, "%U %s", format_ip46_address, + &as->address, IP46_TYPE_ANY, + (as->flags & LB_AS_FLAGS_USED)?"used":"removed"); } u8 *format_lb_vip_detailed (u8 * s, va_list * args) diff --git a/plugins/lb-plugin/lb/node.c b/plugins/lb-plugin/lb/node.c index 77beaac9..82f0cb52 100644 --- a/plugins/lb-plugin/lb/node.c +++ b/plugins/lb-plugin/lb/node.c @@ -48,8 +48,16 @@ format_lb_trace (u8 * s, va_list * args) CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); CLIB_UNUSED (vlib_node_t * node) = va_arg (*args, vlib_node_t *); lb_trace_t *t = va_arg (*args, lb_trace_t *); - s = format(s, "lb vip[%d]: %U\n", t->vip_index, format_lb_vip, &lbm->vips[t->vip_index]); - s = format(s, "lb as[%d]: %U\n", t->as_index, format_lb_as, &lbm->ass[t->as_index]); + if (pool_is_free_index(lbm->vips, t->vip_index)) { + s = format(s, "lb vip[%d]: This VIP was freed since capture\n"); + } else { + s = format(s, "lb vip[%d]: %U\n", t->vip_index, format_lb_vip, &lbm->vips[t->vip_index]); + } + if (pool_is_free_index(lbm->ass, t->as_index)) { + s = format(s, "lb as[%d]: This AS was freed since capture\n"); + } else { + s = format(s, "lb as[%d]: %U\n", t->as_index, format_lb_as, &lbm->ass[t->as_index]); + } return s; } -- cgit 1.2.3-korg