summaryrefslogtreecommitdiffstats
path: root/src/vnet/bier/bier_test.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-01-31 11:35:41 -0800
committerDamjan Marion <dmarion.lists@gmail.com>2018-02-06 12:44:08 +0000
commitf051072f8518097cbce1a8a20510c4e43cb7167c (patch)
tree7d113687fff867ee46013612b3d1693f0cc2aee8 /src/vnet/bier/bier_test.c
parent7e2c31aba2aa9c2ffbcce235a8cc3c673aba2d2e (diff)
BIER: fix support for longer bit-string lengths
Change-Id: I2421197b76be58099e5f8ed5554410adff202109 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Diffstat (limited to 'src/vnet/bier/bier_test.c')
-rw-r--r--src/vnet/bier/bier_test.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/vnet/bier/bier_test.c b/src/vnet/bier/bier_test.c
index 0fbca7e7b9b..2c13abc2aea 100644
--- a/src/vnet/bier/bier_test.c
+++ b/src/vnet/bier/bier_test.c
@@ -310,7 +310,7 @@ bier_test_mpls_spf (void)
.as_u32 = clib_host_to_net_u32(0x01010101),
},
};
- fib_route_path_t *paths_1_1_1_1 = NULL;
+ fib_route_path_t *paths_1_1_1_1 = NULL, *input_paths_1_1_1_1;
fib_route_path_t path_1_1_1_1 = {
.frp_addr = nh_1_1_1_1,
.frp_bier_fib_index = bti,
@@ -325,7 +325,8 @@ bier_test_mpls_spf (void)
};
index_t bei_1;
- bier_table_route_add(&bt_0_0_0_256, 1, paths_1_1_1_1);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_add(&bt_0_0_0_256, 1, input_paths_1_1_1_1);
bei_1 = bier_table_lookup(bier_table_get(bti), 1);
BIER_TEST((INDEX_INVALID != bei_1), "BP:1 present");
@@ -477,7 +478,8 @@ bier_test_mpls_spf (void)
*/
index_t bei_2;
- bier_table_route_add(&bt_0_0_0_256, 2, paths_1_1_1_1);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_add(&bt_0_0_0_256, 2, input_paths_1_1_1_1);
bei_2 = bier_table_lookup(bier_table_get(bti), 2);
bier_entry_contribute_forwarding(bei_2, &dpo_bei);
@@ -498,13 +500,14 @@ bier_test_mpls_spf (void)
.fp_len = 32,
.fp_proto = FIB_PROTOCOL_IP4,
};
- fib_route_path_t *paths_1_1_1_2 = NULL, path_1_1_1_2 = {
+ fib_route_path_t *paths_1_1_1_2 = NULL, *input_paths_1_1_1_2, path_1_1_1_2 = {
.frp_addr = nh_1_1_1_2,
.frp_bier_fib_index = bti,
.frp_sw_if_index = ~0,
};
vec_add1(path_1_1_1_2.frp_label_stack, 501);
vec_add1(paths_1_1_1_2, path_1_1_1_2);
+ input_paths_1_1_1_2 = vec_dup(paths_1_1_1_2);
index_t bei_3;
mpls_label_t *out_lbl_101 = NULL;
@@ -520,7 +523,7 @@ bier_test_mpls_spf (void)
1,
out_lbl_101,
FIB_ROUTE_PATH_FLAG_NONE);
- bier_table_route_add(&bt_0_0_0_256, 3, paths_1_1_1_2);
+ bier_table_route_add(&bt_0_0_0_256, 3, input_paths_1_1_1_2);
bei_3 = bier_table_lookup(bier_table_get(bti), 3);
BIER_TEST((INDEX_INVALID != bei_3), "BP:3 present");
@@ -562,7 +565,8 @@ bier_test_mpls_spf (void)
* Load-balance BP:3 over both next-hops
*/
paths_1_1_1_1[0] = path_1_1_1_1;
- bier_table_route_add(&bt_0_0_0_256, 3, paths_1_1_1_1);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_add(&bt_0_0_0_256, 3, input_paths_1_1_1_1);
BIER_TEST(bier_test_validate_entry(bei_3, 2,
&dpo_o_bfm_1_1_1_1,
@@ -630,7 +634,8 @@ bier_test_mpls_spf (void)
/*
* remove the original 1.1.1.2 fmask from BP:3
*/
- bier_table_route_remove(&bt_0_0_0_256, 3, paths_1_1_1_2);
+ input_paths_1_1_1_2 = vec_dup(paths_1_1_1_2);
+ bier_table_route_remove(&bt_0_0_0_256, 3, input_paths_1_1_1_2);
bier_entry_contribute_forwarding(bei_3, &dpo_bei);
BIER_TEST((dpo_bei.dpoi_index == bfmi_1_1_1_1),
"BP:3 stacks on fmask 1.1.1.1");
@@ -648,10 +653,14 @@ bier_test_mpls_spf (void)
/*
* remove the routes added
*/
- bier_table_route_remove(&bt_0_0_0_256, 2, paths_1_1_1_1);
- bier_table_route_remove(&bt_0_0_0_256, 3, paths_1_1_1_2);
- bier_table_route_remove(&bt_0_0_0_256, 3, paths_1_1_1_1);
- bier_table_route_remove(&bt_0_0_0_256, 1, paths_1_1_1_1);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_remove(&bt_0_0_0_256, 2, input_paths_1_1_1_1);
+ input_paths_1_1_1_2 = vec_dup(paths_1_1_1_2);
+ bier_table_route_remove(&bt_0_0_0_256, 3, input_paths_1_1_1_2);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_remove(&bt_0_0_0_256, 3, input_paths_1_1_1_1);
+ input_paths_1_1_1_1 = vec_dup(paths_1_1_1_1);
+ bier_table_route_remove(&bt_0_0_0_256, 1, input_paths_1_1_1_1);
/*
* delete the table
@@ -685,6 +694,8 @@ bier_test_mpls_spf (void)
vec_free(paths_1_1_1_1);
vec_free(paths_1_1_1_2);
+ vec_free(input_paths_1_1_1_1);
+ vec_free(input_paths_1_1_1_2);
return (0);
}