aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ethernet/mac_swap.c397
-rw-r--r--src/vnet/ip/ip4_test.c347
2 files changed, 0 insertions, 744 deletions
diff --git a/src/vnet/ethernet/mac_swap.c b/src/vnet/ethernet/mac_swap.c
deleted file mode 100644
index c0fec12e61e..00000000000
--- a/src/vnet/ethernet/mac_swap.c
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vlib/vlib.h>
-#include <vnet/pg/pg.h>
-#include <vnet/ethernet/ethernet.h>
-#include <vppinfra/error.h>
-#include <vnet/devices/pci/ige.h>
-#include <vnet/devices/pci/ixge.h>
-#include <vnet/devices/pci/ixgev.h>
-
-typedef struct
-{
- u32 cached_next_index;
- u32 cached_sw_if_index;
-
- /* Hash table to map sw_if_index to next node index */
- uword *next_node_index_by_sw_if_index;
-
- /* convenience */
- vlib_main_t *vlib_main;
- vnet_main_t *vnet_main;
-} mac_swap_main_t;
-
-typedef struct
-{
- u8 src[6];
- u8 dst[6];
- u32 sw_if_index;
- u32 next_index;
-} swap_trace_t;
-
-/* packet trace format function */
-static u8 *
-format_swap_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 *);
- swap_trace_t *t = va_arg (*args, swap_trace_t *);
-
- s = format (s, "SWAP: dst now %U src now %U sw_if_index %d next_index %d",
- format_ethernet_address, t->dst,
- format_ethernet_address, t->src, t->sw_if_index, t->next_index);
- return s;
-}
-
-#define foreach_hw_driver_next \
- _(IP4) \
- _(IP6) \
- _(ETHERNET)
-
-mac_swap_main_t mac_swap_main;
-
-static vlib_node_registration_t mac_swap_node;
-
-#define foreach_mac_swap_error \
-_(SWAPS, "mac addresses swapped")
-
-typedef enum
-{
-#define _(sym,str) MAC_SWAP_ERROR_##sym,
- foreach_mac_swap_error
-#undef _
- MAC_SWAP_N_ERROR,
-} mac_swap_error_t;
-
-static char *mac_swap_error_strings[] = {
-#define _(sym,string) string,
- foreach_mac_swap_error
-#undef _
-};
-
-/*
- * To drop a pkt and increment one of the previous counters:
- *
- * set b0->error = error_node->errors[RANDOM_ERROR_SAMPLE];
- * set next0 to a disposition index bound to "error-drop".
- *
- * To manually increment the specific counter MAC_SWAP_ERROR_SAMPLE:
- *
- * vlib_node_t *n = vlib_get_node (vm, mac_swap.index);
- * u32 node_counter_base_index = n->error_heap_index;
- * vlib_error_main_t * em = &vm->error_main;
- * em->counters[node_counter_base_index + MAC_SWAP_ERROR_SAMPLE] += 1;
- *
- */
-
-typedef enum
-{
- MAC_SWAP_NEXT_DROP,
- MAC_SWAP_N_NEXT,
-} mac_swap_next_t;
-
-static uword
-mac_swap_node_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
-{
- u32 n_left_from, *from, *to_next;
- mac_swap_next_t next_index;
- mac_swap_main_t *msm = &mac_swap_main;
- vlib_node_t *n = vlib_get_node (vm, mac_swap_node.index);
- u32 node_counter_base_index = n->error_heap_index;
- vlib_error_main_t *em = &vm->error_main;
-
- from = vlib_frame_vector_args (frame);
- n_left_from = frame->n_vectors;
- next_index = node->cached_next_index;
-
- while (n_left_from > 0)
- {
- u32 n_left_to_next;
-
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
-
- while (n_left_from >= 4 && n_left_to_next >= 2)
- {
- u32 bi0, bi1;
- vlib_buffer_t *b0, *b1;
- u32 next0, next1;
- u32 sw_if_index0, sw_if_index1;
- uword *p0, *p1;
- u64 tmp0a, tmp0b;
- u64 tmp1a, tmp1b;
- ethernet_header_t *h0, *h1;
-
-
- /* Prefetch next iteration. */
- {
- vlib_buffer_t *p2, *p3;
-
- p2 = vlib_get_buffer (vm, from[2]);
- p3 = vlib_get_buffer (vm, from[3]);
-
- vlib_prefetch_buffer_header (p2, LOAD);
- vlib_prefetch_buffer_header (p3, LOAD);
-
- CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE);
- CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE);
- }
-
- to_next[0] = bi0 = from[0];
- to_next[1] = bi1 = from[1];
- from += 2;
- to_next += 2;
- n_left_from -= 2;
- n_left_to_next -= 2;
-
- b0 = vlib_get_buffer (vm, bi0);
- b1 = vlib_get_buffer (vm, bi1);
-
- sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- next0 = msm->cached_next_index;
- sw_if_index1 = vnet_buffer (b1)->sw_if_index[VLIB_RX];
- next1 = msm->cached_next_index;
-
- if (PREDICT_FALSE (msm->cached_sw_if_index != sw_if_index0))
- {
- p0 =
- hash_get (msm->next_node_index_by_sw_if_index, sw_if_index0);
- if (p0 == 0)
- {
- vnet_hw_interface_t *hw0;
-
- hw0 = vnet_get_sup_hw_interface (msm->vnet_main,
- sw_if_index0);
-
- next0 = vlib_node_add_next (msm->vlib_main,
- mac_swap_node.index,
- hw0->output_node_index);
- hash_set (msm->next_node_index_by_sw_if_index,
- sw_if_index0, next0);
- }
- else
- next0 = p0[0];
- msm->cached_sw_if_index = sw_if_index0;
- msm->cached_next_index = next0;
- next1 = next0;
- }
- if (PREDICT_FALSE (msm->cached_sw_if_index != sw_if_index1))
- {
- p1 =
- hash_get (msm->next_node_index_by_sw_if_index, sw_if_index1);
- if (p1 == 0)
- {
- vnet_hw_interface_t *hw1;
-
- hw1 = vnet_get_sup_hw_interface (msm->vnet_main,
- sw_if_index1);
-
- next1 = vlib_node_add_next (msm->vlib_main,
- mac_swap_node.index,
- hw1->output_node_index);
- hash_set (msm->next_node_index_by_sw_if_index,
- sw_if_index1, next1);
- }
- else
- next1 = p1[0];
- msm->cached_sw_if_index = sw_if_index1;
- msm->cached_next_index = next1;
- }
-
- em->counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 2;
-
- /* reset buffer so we always point at the MAC hdr */
- vlib_buffer_reset (b0);
- vlib_buffer_reset (b1);
- h0 = vlib_buffer_get_current (b0);
- h1 = vlib_buffer_get_current (b1);
-
- /* Swap 2 x src and dst mac addresses using 8-byte load/stores */
- tmp0a = clib_net_to_host_u64 (((u64 *) (h0->dst_address))[0]);
- tmp1a = clib_net_to_host_u64 (((u64 *) (h1->dst_address))[0]);
- tmp0b = clib_net_to_host_u64 (((u64 *) (h0->src_address))[0]);
- tmp1b = clib_net_to_host_u64 (((u64 *) (h1->src_address))[0]);
- ((u64 *) (h0->dst_address))[0] = clib_host_to_net_u64 (tmp0b);
- ((u64 *) (h1->dst_address))[0] = clib_host_to_net_u64 (tmp1b);
- /* Move the ethertype from "b" to "a" */
- tmp0a &= ~(0xFFFF);
- tmp1a &= ~(0xFFFF);
- tmp0a |= tmp0b & 0xFFFF;
- ((u64 *) (h0->src_address))[0] = clib_host_to_net_u64 (tmp0a);
- tmp1a |= tmp1b & 0xFFFF;
- ((u64 *) (h1->src_address))[0] = clib_host_to_net_u64 (tmp1a);
-
- if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
- {
- if (b0->flags & VLIB_BUFFER_IS_TRACED)
- {
- swap_trace_t *t =
- vlib_add_trace (vm, node, b0, sizeof (*t));
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- t->sw_if_index = sw_if_index0;
- t->next_index = next0;
- }
- if (b1->flags & VLIB_BUFFER_IS_TRACED)
- {
- swap_trace_t *t =
- vlib_add_trace (vm, node, b1, sizeof (*t));
- clib_memcpy (t->src, h1->src_address, 6);
- clib_memcpy (t->dst, h1->dst_address, 6);
- t->sw_if_index = sw_if_index1;
- t->next_index = next1;
- }
- }
-
- vlib_validate_buffer_enqueue_x2 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, bi1, next0, next1);
- }
-
- while (n_left_from > 0 && n_left_to_next > 0)
- {
- u32 bi0;
- vlib_buffer_t *b0;
- u32 next0;
- u32 sw_if_index0;
- uword *p0;
- u64 tmp0a, tmp0b;
- ethernet_header_t *h0;
-
- bi0 = from[0];
- to_next[0] = bi0;
- from += 1;
- to_next += 1;
- n_left_from -= 1;
- n_left_to_next -= 1;
-
- b0 = vlib_get_buffer (vm, bi0);
-
- sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
- next0 = msm->cached_next_index;
-
- if (PREDICT_FALSE (msm->cached_sw_if_index != sw_if_index0))
- {
- p0 =
- hash_get (msm->next_node_index_by_sw_if_index, sw_if_index0);
- if (p0 == 0)
- {
- vnet_hw_interface_t *hw0;
-
- hw0 = vnet_get_sup_hw_interface (msm->vnet_main,
- sw_if_index0);
-
- next0 = vlib_node_add_next (msm->vlib_main,
- mac_swap_node.index,
- hw0->output_node_index);
- hash_set (msm->next_node_index_by_sw_if_index,
- sw_if_index0, next0);
- }
- else
- next0 = p0[0];
- msm->cached_sw_if_index = sw_if_index0;
- msm->cached_next_index = next0;
- }
-
- em->counters[node_counter_base_index + MAC_SWAP_ERROR_SWAPS] += 1;
-
- /* reset buffer so we always point at the MAC hdr */
- vlib_buffer_reset (b0);
- h0 = vlib_buffer_get_current (b0);
-
- /* Exchange src and dst, preserve the ethertype */
- tmp0a = clib_net_to_host_u64 (((u64 *) (h0->dst_address))[0]);
- tmp0b = clib_net_to_host_u64 (((u64 *) (h0->src_address))[0]);
- ((u64 *) (h0->dst_address))[0] = clib_host_to_net_u64 (tmp0b);
- tmp0a &= ~(0xFFFF);
- tmp0a |= tmp0b & 0xFFFF;
- ((u64 *) (h0->src_address))[0] = clib_host_to_net_u64 (tmp0a);
-
- /* ship it */
- if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)
- && (b0->flags & VLIB_BUFFER_IS_TRACED)))
- {
- swap_trace_t *t = vlib_add_trace (vm, node, b0, sizeof (*t));
- clib_memcpy (t->src, h0->src_address, 6);
- clib_memcpy (t->dst, h0->dst_address, 6);
- t->sw_if_index = sw_if_index0;
- t->next_index = next0;
- }
-
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
- }
-
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
- }
-
- return frame->n_vectors;
-}
-
-/* *INDENT-OFF* */
-VLIB_REGISTER_NODE (mac_swap_node,static) = {
- .function = mac_swap_node_fn,
- .name = "mac-swap",
- .vector_size = sizeof (u32),
- .format_trace = format_swap_trace,
- .type = VLIB_NODE_TYPE_INTERNAL,
-
- .n_errors = ARRAY_LEN(mac_swap_error_strings),
- .error_strings = mac_swap_error_strings,
-
- .n_next_nodes = MAC_SWAP_N_NEXT,
-
- /* edit / add dispositions here */
- .next_nodes = {
- [MAC_SWAP_NEXT_DROP] = "error-drop",
- },
-};
-/* *INDENT-ON* */
-
-clib_error_t *
-mac_swap_init (vlib_main_t * vm)
-{
- mac_swap_main_t *msm = &mac_swap_main;
-
- msm->next_node_index_by_sw_if_index = hash_create (0, sizeof (uword));
- msm->cached_next_index = (u32) ~ 0;
- msm->cached_sw_if_index = (u32) ~ 0;
- msm->vlib_main = vm;
- msm->vnet_main = vnet_get_main ();
-
- /* Driver RX nodes send pkts here... */
-#define _(a) ixge_set_next_node (IXGE_RX_NEXT_##a##_INPUT, "mac-swap");
- foreach_hw_driver_next
-#undef _
-#define _(a) ixgev_set_next_node (IXGEV_RX_NEXT_##a##_INPUT, "mac-swap");
- foreach_hw_driver_next
-#undef _
-#define _(a) ige_set_next_node (IGE_RX_NEXT_##a##_INPUT, "mac-swap");
- foreach_hw_driver_next
-#undef _
- return 0;
-}
-
-VLIB_INIT_FUNCTION (mac_swap_init);
-
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vnet/ip/ip4_test.c b/src/vnet/ip/ip4_test.c
deleted file mode 100644
index 73dabfdc23a..00000000000
--- a/src/vnet/ip/ip4_test.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Copyright (c) 2015 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <vnet/ip/ip.h>
-#include <vnet/ethernet/ethernet.h>
-
-/**
- * @file
- * @brief IPv4 FIB Tester.
- *
- * Not compiled in by default. IPv4 FIB tester. Add, probe, delete a bunch of
- * random routes / masks and make sure that the mtrie agrees with
- * the hash-table FIB.
- *
- * Manipulate the FIB by means of the debug CLI commands, to minimize
- * the chances of doing something idiotic.
- */
-
-/*
- * These routines need to be redeclared non-static elsewhere.
- *
- * Also: rename ip_route() -> vnet_ip_route_cmd() and add the usual
- * test_route_init() call to main.c
- */
-clib_error_t *vnet_ip_route_cmd (vlib_main_t * vm,
- unformat_input_t * input,
- vlib_cli_command_t * cmd_arg);
-
-int ip4_lookup_validate (ip4_address_t * a, u32 fib_index0);
-
-ip4_fib_t *find_fib_by_table_index_or_id (ip4_main_t * im,
- u32 table_index_or_id, u32 flags);
-
-/* Routes to insert/delete/probe in FIB */
-typedef struct
-{
- ip4_address_t address;
- u32 mask_width;
- u32 interface_id; /* not an xx_if_index */
-} test_route_t;
-
-typedef struct
-{
- /* Test routes in use */
- test_route_t *route_pool;
-
- /* Number of fake ethernets created */
- u32 test_interfaces_created;
-} test_main_t;
-
-test_main_t test_main;
-
-/* fake ethernet device class, distinct from "fake-ethX" */
-static u8 *
-format_test_interface_name (u8 * s, va_list * args)
-{
- u32 dev_instance = va_arg (*args, u32);
- return format (s, "test-eth%d", dev_instance);
-}
-
-static uword
-dummy_interface_tx (vlib_main_t * vm,
- vlib_node_runtime_t * node, vlib_frame_t * frame)
-{
- clib_warning ("you shouldn't be here, leaking buffers...");
- return frame->n_vectors;
-}
-
-/* *INDENT-OFF* */
-VNET_DEVICE_CLASS (test_interface_device_class,static) = {
- .name = "Test interface",
- .format_device_name = format_test_interface_name,
- .tx_function = dummy_interface_tx,
-};
-/* *INDENT-ON* */
-
-static clib_error_t *
-thrash (vlib_main_t * vm,
- unformat_input_t * main_input, vlib_cli_command_t * cmd_arg)
-{
- u32 seed = 0xdeaddabe;
- u32 niter = 10;
- u32 nroutes = 10;
- u32 ninterfaces = 4;
- f64 min_mask_bits = 7.0;
- f64 max_mask_bits = 32.0;
- u32 table_id = 11; /* my amp goes to 11 (use fib 11) */
- u32 table_index;
- int iter, i;
- u8 *cmd;
- test_route_t *tr;
- test_main_t *tm = &test_main;
- ip4_main_t *im = &ip4_main;
- vnet_main_t *vnm = vnet_get_main ();
- unformat_input_t cmd_input;
- f64 rf;
- u32 *masks = 0;
- u32 tmp;
- u32 hw_if_index;
- clib_error_t *error = 0;
- uword *p;
- unformat_input_t _line_input, *line_input = &_line_input;
- u8 hw_address[6];
- ip4_fib_t *fib;
- int verbose = 0;
-
- /* Precompute mask width -> mask vector */
- tmp = (u32) ~ 0;
- vec_validate (masks, 32);
- for (i = 32; i > 0; i--)
- {
- masks[i] = tmp;
- tmp <<= 1;
- }
-
- if (unformat_user (main_input, unformat_line_input, line_input))
- {
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (line_input, "seed %d", &seed))
- ;
- else if (unformat (line_input, "niter %d", &niter))
- ;
- else if (unformat (line_input, "nroutes %d", &nroutes))
- ;
- else if (unformat (line_input, "ninterfaces %d", &ninterfaces))
- ;
- else if (unformat (line_input, "min-mask-bits %d", &tmp))
- min_mask_bits = (f64) tmp;
- else if (unformat (line_input, "max-mask-bits %d", &tmp))
- max_mask_bits = (f64) tmp;
- else if (unformat (line_input, "verbose"))
- verbose = 1;
- else
- {
- error = clib_error_return (0, "unknown input `%U'",
- format_unformat_error, line_input);
- goto done;
- }
- }
- }
-
- /* Find or create FIB table 11 */
- fib = ip4_fib_find_or_create_fib_by_table_id (table_id);
-
- for (i = tm->test_interfaces_created; i < ninterfaces; i++)
- {
- vnet_hw_interface_t *hw;
- memset (hw_address, 0, sizeof (hw_address));
- hw_address[0] = 0xd0;
- hw_address[1] = 0x0f;
- hw_address[5] = i;
-
- error = ethernet_register_interface
- (vnm, test_interface_device_class.index, i /* instance */ ,
- hw_address, &hw_if_index,
- /* flag change */ 0);
-
- /* Fake interfaces use FIB table 11 */
- hw = vnet_get_hw_interface (vnm, hw_if_index);
- vec_validate (im->fib_index_by_sw_if_index, hw->sw_if_index);
- im->fib_index_by_sw_if_index[hw->sw_if_index] = fib->index;
- ip4_sw_interface_enable_disable (sw_if_index, 1);
- }
-
- tm->test_interfaces_created = ninterfaces;
-
- /* Find fib index corresponding to FIB id 11 */
- p = hash_get (im->fib_index_by_table_id, table_id);
- if (p == 0)
- {
- vlib_cli_output (vm, "Couldn't map fib id %d to fib index\n", table_id);
- goto done;
- }
- table_index = p[0];
-
- for (iter = 0; iter < niter; iter++)
- {
- /* Pick random routes to install */
- for (i = 0; i < nroutes; i++)
- {
- int j;
-
- pool_get (tm->route_pool, tr);
- memset (tr, 0, sizeof (*tr));
-
- again:
- rf = random_f64 (&seed);
- tr->mask_width = (u32) (min_mask_bits
- + rf * (max_mask_bits - min_mask_bits));
- tmp = random_u32 (&seed);
- tmp &= masks[tr->mask_width];
- tr->address.as_u32 = clib_host_to_net_u32 (tmp);
-
- /* We can't add the same address/mask twice... */
- for (j = 0; j < i; j++)
- {
- test_route_t *prev;
- prev = pool_elt_at_index (tm->route_pool, j);
- if ((prev->address.as_u32 == tr->address.as_u32)
- && (prev->mask_width == tr->mask_width))
- goto again;
- }
-
- rf = random_f64 (&seed);
- tr->interface_id = (u32) (rf * ninterfaces);
- }
-
- /* Add them */
- for (i = 0; i < nroutes; i++)
- {
- tr = pool_elt_at_index (tm->route_pool, i);
- cmd = format (0, "add table %d %U/%d via test-eth%d",
- table_id,
- format_ip4_address, &tr->address,
- tr->mask_width, tr->interface_id);
- vec_add1 (cmd, 0);
- if (verbose)
- fformat (stderr, "ip route %s\n", cmd);
- unformat_init_string (&cmd_input, (char *) cmd, vec_len (cmd) - 1);
- error = vnet_ip_route_cmd (vm, &cmd_input, cmd_arg);
- if (error)
- clib_error_report (error);
- unformat_free (&cmd_input);
- vec_free (cmd);
- }
- /* Probe them */
- for (i = 0; i < nroutes; i++)
- {
- tr = pool_elt_at_index (tm->route_pool, i);
- if (!ip4_lookup_validate (&tr->address, table_index))
- {
- if (verbose)
- fformat (stderr, "test lookup table %d %U\n",
- table_index, format_ip4_address, &tr->address);
-
- fformat (stderr, "FAIL-after-insert: %U/%d\n",
- format_ip4_address, &tr->address, tr->mask_width);
- }
- }
-
- /* Delete them */
- for (i = 0; i < nroutes; i++)
- {
- int j;
- tr = pool_elt_at_index (tm->route_pool, i);
- if (0)
- cmd = format (0, "del table %d %U/%d via test-eth%d",
- table_id,
- format_ip4_address, &tr->address,
- tr->mask_width, tr->interface_id);
- else
- cmd = format (0, "del table %d %U/%d",
- table_id,
- format_ip4_address, &tr->address, tr->mask_width);
- vec_add1 (cmd, 0);
- if (verbose)
- fformat (stderr, "ip route %s\n", cmd);
- unformat_init_string (&cmd_input, (char *) cmd, vec_len (cmd) - 1);
- error = vnet_ip_route_cmd (vm, &cmd_input, cmd_arg);
- if (error)
- clib_error_report (error);
- unformat_free (&cmd_input);
- vec_free (cmd);
-
- /* Make sure all undeleted routes still work */
- for (j = i + 1; j < nroutes; j++)
- {
- test_route_t *rr; /* remaining route */
- rr = pool_elt_at_index (tm->route_pool, j);
- if (!ip4_lookup_validate (&rr->address, table_index))
- {
- if (verbose)
- fformat (stderr, "test lookup table %d %U\n",
- table_index, format_ip4_address, &rr->address);
-
- fformat (stderr, "FAIL: %U/%d AWOL\n",
- format_ip4_address, &rr->address, rr->mask_width);
- fformat (stderr, " iter %d after %d of %d deletes\n",
- iter, i, nroutes);
- fformat (stderr, " last route deleted %U/%d\n",
- format_ip4_address, &tr->address, tr->mask_width);
- }
- }
- }
-
- pool_free (tm->route_pool);
- }
-
-done:
- unformat_free (line_input);
-
- return error;
-}
-
-/*?
- * This command in not in the build by default. It is an internal
- * command used to test the route functonality.
- *
- * Create test routes on IPv4 FIB table 11. Table will be created if it
- * does not exist.
- *
- * There are several optional attributes:
- * - If not provided, <seed> defaults to 0xdeaddabe.
- * - If not provided, <num-iter> defaults to 10.
- * - If not provided, <num-iface> defaults to 4.
- * - If not provided, <min-mask> defaults to 7.0.
- * - If not provided, <max-mask> defaults to 32.0.
- *
- * @cliexpar
- * Example of how to run:
- * @cliexcmd{test route}
-?*/
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (test_route_command, static) = {
- .path = "test route",
- .short_help = "test route [seed <seed-num>] [niter <num-iter>] [ninterfaces <num-iface>] [min-mask-bits <min-mask>] [max-mask-bits <max-mask>] [verbose]", .function = thrash,
- .function = thrash,
-};
-/* *INDENT-ON* */
-
-clib_error_t *
-test_route_init (vlib_main_t * vm)
-{
- return 0;
-}
-
-VLIB_INIT_FUNCTION (test_route_init);
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */