aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-06-17 08:43:55 +0000
committerNeale Ranns <neale@graphiant.com>2021-06-21 07:20:57 +0000
commit5b71bf3f850df25e80cf156e59fe2b496fd950b8 (patch)
tree024f05c688798a9b8fb1222a6d8ce687428ec226 /src/plugins
parent6973c73131f68630bf5ede3a78583f3d69f0392e (diff)
fib: Add unit test for RR source using covers labels
Type: test UT for patch: 4fc68ee Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I96fac9a6407a7f3ebeecc5e68a7683e541063de7
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/unittest/fib_test.c70
1 files changed, 69 insertions, 1 deletions
diff --git a/src/plugins/unittest/fib_test.c b/src/plugins/unittest/fib_test.c
index c6291fb2658..76b675bca83 100644
--- a/src/plugins/unittest/fib_test.c
+++ b/src/plugins/unittest/fib_test.c
@@ -503,8 +503,9 @@ fib_test_validate_lb_v (const load_balance_t *lb,
FIB_TEST_LB((vnet_mpls_uc_get_label(hdr) ==
exp->label_o_adj.label),
- "bucket %d stacks on label %d",
+ "bucket %d stacks on label %d not %d",
bucket,
+ vnet_mpls_uc_get_label(hdr),
exp->label_o_adj.label);
FIB_TEST_LB((vnet_mpls_uc_get_s(hdr) ==
@@ -7391,6 +7392,73 @@ fib_test_label (void)
fib_table_entry_delete_index(fei, FIB_SOURCE_API);
/*
+ * A prefix with outgoing labels. We'll RR source a /32 it covers
+ * and test that the RR source picks up the out-going labels
+ */
+ fib_prefix_t pfx_100_s_8 = {
+ .fp_len = 8,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x64000000),
+ },
+ };
+ fib_test_lb_bucket_t l_100_eos_o_10_10_10_1 = {
+ .type = FT_LB_LABEL_O_ADJ,
+ .label_o_adj = {
+ .adj = ai_mpls_10_10_11_1,
+ .label = 1602,
+ .eos = MPLS_EOS,
+ },
+ };
+ fib_mpls_label_t *l1602 = NULL, fml1602 = {
+ .fml_value = 1602,
+ };
+ vec_add1(l1602, fml1602);
+ fei = fib_table_entry_update_one_path(fib_index,
+ &pfx_100_s_8,
+ FIB_SOURCE_API,
+ FIB_ENTRY_FLAG_NONE,
+ DPO_PROTO_IP4,
+ &nh_10_10_11_1,
+ tm->hw[1]->sw_if_index,
+ ~0, // invalid fib index
+ 1,
+ l1602,
+ FIB_ROUTE_PATH_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l_100_eos_o_10_10_10_1),
+ "100.0.0.0/8 LB 1 buckets via: lbl 101 "
+ "adj 10.10.11.1");
+
+ fib_prefix_t pfx_100_1_1_1_s_32 = {
+ .fp_len = 32,
+ .fp_proto = FIB_PROTOCOL_IP4,
+ .fp_addr = {
+ .ip4.as_u32 = clib_host_to_net_u32(0x64010101),
+ },
+ };
+
+ fei = fib_table_entry_special_add(fib_index,
+ &pfx_100_1_1_1_s_32,
+ FIB_SOURCE_RR,
+ FIB_ENTRY_FLAG_NONE);
+
+ FIB_TEST(!fib_test_validate_entry(fei,
+ FIB_FORW_CHAIN_TYPE_UNICAST_IP4,
+ 1,
+ &l_100_eos_o_10_10_10_1),
+ "100.1.1.1/32 LB 1 buckets via: "
+ "adj 10.10.11.1");
+
+ fib_table_entry_delete(fib_index,
+ &pfx_100_s_8,
+ FIB_SOURCE_API);
+ fib_table_entry_delete_index(fei, FIB_SOURCE_RR);
+
+ /*
* cleanup
*/
fib_table_entry_delete(fib_index,