summaryrefslogtreecommitdiffstats
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
parent7e2c31aba2aa9c2ffbcce235a8cc3c673aba2d2e (diff)
BIER: fix support for longer bit-string lengths
Change-Id: I2421197b76be58099e5f8ed5554410adff202109 Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
-rw-r--r--src/vnet/api_errno.h3
-rw-r--r--src/vnet/bier/bier.api4
-rw-r--r--src/vnet/bier/bier_api.c103
-rw-r--r--src/vnet/bier/bier_disp_table.c2
-rw-r--r--src/vnet/bier/bier_imp.c2
-rw-r--r--src/vnet/bier/bier_imp.h23
-rw-r--r--src/vnet/bier/bier_lookup.c29
-rw-r--r--src/vnet/bier/bier_table.c37
-rw-r--r--src/vnet/bier/bier_test.c33
-rw-r--r--src/vnet/bier/bier_types.h62
-rw-r--r--src/vnet/dpo/replicate_dpo.c3
-rw-r--r--test/Makefile2
-rw-r--r--test/patches/scapy-2.3.3/bier.patch65
-rw-r--r--test/test_bier.py265
-rw-r--r--test/vpp_bier.py7
-rw-r--r--test/vpp_object.py7
-rw-r--r--test/vpp_papi_provider.py3
17 files changed, 391 insertions, 259 deletions
diff --git a/src/vnet/api_errno.h b/src/vnet/api_errno.h
index be2100a5c29..707fec4be2f 100644
--- a/src/vnet/api_errno.h
+++ b/src/vnet/api_errno.h
@@ -134,7 +134,8 @@ _(APP_CONNECT_FILTERED, -141, "Connect was filtered") \
_(ACL_IN_USE_INBOUND, -142, "Inbound ACL in use") \
_(ACL_IN_USE_OUTBOUND, -143, "Outbound ACL in use") \
_(INIT_FAILED, -144, "Initialization Failed") \
-_(NETLINK_ERROR, -145, "netlink error")
+_(NETLINK_ERROR, -145, "netlink error") \
+_(BIER_BSL_UNSUP, -146, "BIER bit-string-length unsupported")
typedef enum
{
diff --git a/src/vnet/bier/bier.api b/src/vnet/bier/bier.api
index 380d2973705..446863c8ee8 100644
--- a/src/vnet/bier/bier.api
+++ b/src/vnet/bier/bier.api
@@ -109,7 +109,9 @@ define bier_route_details
@param context - sender context, to match reply w/ request
@param bi_tbl_id - The BIER table-id used to forward post encap
@param bi_src - The source Bit-position in the encap.
- @param bi_n_bytes - The number of bytes in the following bit-string
+ @param bi_n_bytes - The number of bytes in the following bit-string.
+ VPP only supports BSL of 1024 and less, so this is
+ a u8 field.
@param bi_bytes - The bit-string represented as a byte array (MSB first)
*/
define bier_imp_add
diff --git a/src/vnet/bier/bier_api.c b/src/vnet/bier/bier_api.c
index 840c33b7a37..4b1d1c28781 100644
--- a/src/vnet/bier/bier_api.c
+++ b/src/vnet/bier/bier_api.c
@@ -73,34 +73,41 @@ vl_api_bier_table_add_del_t_handler (vl_api_bier_table_add_del_t * mp)
vnm = vnet_get_main ();
vnm->api_errno = 0;
- bier_table_id_t bti = {
- .bti_set = mp->bt_tbl_id.bt_set,
- .bti_sub_domain = mp->bt_tbl_id.bt_sub_domain,
- .bti_hdr_len = mp->bt_tbl_id.bt_hdr_len_id,
- .bti_type = BIER_TABLE_MPLS_SPF,
- .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
- };
-
- if (mp->bt_is_add)
+ if (mp->bt_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
{
- mpls_label_t label = ntohl(mp->bt_label);
-
- /*
- * convert acceptable 'don't want a label' values from
- * the API to the correct internal INVLID value
- */
- if ((0 == label) || (~0 == label))
- {
- label = MPLS_LABEL_INVALID;
- }
- bier_table_add_or_lock(&bti, label);
+ rv = VNET_API_ERROR_BIER_BSL_UNSUP;
}
else
{
- bier_table_unlock(&bti);
- }
+ bier_table_id_t bti = {
+ .bti_set = mp->bt_tbl_id.bt_set,
+ .bti_sub_domain = mp->bt_tbl_id.bt_sub_domain,
+ .bti_hdr_len = mp->bt_tbl_id.bt_hdr_len_id,
+ .bti_type = BIER_TABLE_MPLS_SPF,
+ .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
+ };
+
+ if (mp->bt_is_add)
+ {
+ mpls_label_t label = ntohl(mp->bt_label);
- rv = vnm->api_errno;
+ /*
+ * convert acceptable 'don't want a label' values from
+ * the API to the correct internal INVLID value
+ */
+ if ((0 == label) || (~0 == label))
+ {
+ label = MPLS_LABEL_INVALID;
+ }
+ bier_table_add_or_lock(&bti, label);
+ }
+ else
+ {
+ bier_table_unlock(&bti);
+ }
+
+ rv = vnm->api_errno;
+ }
REPLY_MACRO (VL_API_BIER_TABLE_ADD_DEL_REPLY);
}
@@ -161,10 +168,14 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
vnm = vnet_get_main ();
vnm->api_errno = 0;
-
bp = ntohl(mp->br_bp);
brpaths = NULL;
+ if (mp->br_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
+ {
+ rv = VNET_API_ERROR_BIER_BSL_UNSUP;
+ goto done;
+ }
if (0 == bp || bp > BIER_BP_MAX)
{
rv = -1;
@@ -242,9 +253,9 @@ vl_api_bier_route_add_del_t_handler (vl_api_bier_route_add_del_t * mp)
{
bier_table_route_remove(&bti, bp, brpaths);
}
+ vec_free(brpaths);
done:
- vec_free(brpaths);
rv = (rv == 0) ? vnm->api_errno : rv;
REPLY_MACRO (VL_API_BIER_ROUTE_ADD_DEL_REPLY);
@@ -333,26 +344,35 @@ vl_api_bier_imp_add_t_handler (vl_api_bier_imp_add_t * mp)
vnm = vnet_get_main ();
vnm->api_errno = 0;
- bier_table_id_t bti = {
- .bti_set = mp->bi_tbl_id.bt_set,
- .bti_sub_domain = mp->bi_tbl_id.bt_sub_domain,
- .bti_hdr_len = mp->bi_tbl_id.bt_hdr_len_id,
- .bti_type = BIER_TABLE_MPLS_SPF,
- .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
- };
- bier_bit_string_t bs = {
- .bbs_len = mp->bi_n_bytes,
- .bbs_buckets = mp->bi_bytes,
- };
-
- bii = bier_imp_add_or_lock(&bti, ntohs(mp->bi_src), &bs);
+ /*
+ * The BSL support by VPP is limited to the size of the
+ * available space in the vlib_buffer_t
+ */
+ if (mp->bi_tbl_id.bt_hdr_len_id >= BIER_HDR_LEN_2048)
+ {
+ rv = VNET_API_ERROR_BIER_BSL_UNSUP;
+ }
+ else
+ {
+ bier_table_id_t bti = {
+ .bti_set = mp->bi_tbl_id.bt_set,
+ .bti_sub_domain = mp->bi_tbl_id.bt_sub_domain,
+ .bti_hdr_len = mp->bi_tbl_id.bt_hdr_len_id,
+ .bti_type = BIER_TABLE_MPLS_SPF,
+ .bti_ecmp = BIER_ECMP_TABLE_ID_MAIN,
+ };
+ bier_bit_string_t bs = {
+ .bbs_len = mp->bi_n_bytes,
+ .bbs_buckets = mp->bi_bytes,
+ };
+
+ bii = bier_imp_add_or_lock(&bti, ntohs(mp->bi_src), &bs);
+ }
- /* *INDENT-OFF* */
REPLY_MACRO2 (VL_API_BIER_IMP_ADD_REPLY,
({
rmp->bi_index = ntohl (bii);
}));
- /* *INDENT-OM* */
}
static void
@@ -395,10 +415,9 @@ send_bier_imp_details (vl_api_registration_t * reg,
mp->bi_tbl_id.bt_sub_domain = bi->bi_tbl.bti_sub_domain;
mp->bi_tbl_id.bt_hdr_len_id = bi->bi_tbl.bti_hdr_len;
-
mp->bi_src = htons(bier_hdr_get_src_id(&copy));
mp->bi_n_bytes = n_bytes;
- memcpy(mp->bi_bytes, bi->bi_bits.bits, n_bytes);
+ memcpy(mp->bi_bytes, bi->bi_bits, n_bytes);
vl_api_send_msg (reg, (u8 *) mp);
}
diff --git a/src/vnet/bier/bier_disp_table.c b/src/vnet/bier/bier_disp_table.c
index db4a2a82d2b..c663286efcb 100644
--- a/src/vnet/bier/bier_disp_table.c
+++ b/src/vnet/bier/bier_disp_table.c
@@ -210,7 +210,7 @@ bier_disp_table_lookup_hton(index_t bdti,
{
bier_hdr_src_id_t src = bp;
- return (bier_disp_table_lookup(bdti, clib_host_to_net_u32(src)));
+ return (bier_disp_table_lookup(bdti, clib_host_to_net_u16(src)));
}
void
diff --git a/src/vnet/bier/bier_imp.c b/src/vnet/bier/bier_imp.c
index c51dede9c0a..bd934b77f16 100644
--- a/src/vnet/bier/bier_imp.c
+++ b/src/vnet/bier/bier_imp.c
@@ -157,7 +157,7 @@ format_bier_imp (u8* s, va_list *args)
bier_hdr_ntoh(&copy);
bier_bit_string_init(&bbs,
bier_hdr_get_len_id(&copy),
- bi->bi_bits.bits);
+ bi->bi_bits);
s = format(s, "\n%U%U",
format_white_space, indent,
diff --git a/src/vnet/bier/bier_imp.h b/src/vnet/bier/bier_imp.h
index fa53989fc93..5b21b06b12d 100644
--- a/src/vnet/bier/bier_imp.h
+++ b/src/vnet/bier/bier_imp.h
@@ -33,16 +33,6 @@
*/
typedef struct bier_imp_t_ {
/**
- * The BIER table into which to forward the post imposed packet
- */
- bier_table_id_t bi_tbl;
-
- /**
- * number of locks
- */
- u32 bi_locks;
-
- /**
* The DPO contirubted from the resolving BIER table.
* One per-IP protocol. This allows us to share a BIER imposition
* object for a IPv4 and IPv6 mfib path.
@@ -60,7 +50,18 @@ typedef struct bier_imp_t_ {
* largest header type so as the bitstring is on the same
* cacheline as the header.
*/
- bier_bit_mask_4096_t bi_bits;
+ u8 bi_bits[BIER_HDR_BUCKETS_1024];
+
+ /**
+ * The BIER table into which to forward the post imposed packet
+ */
+ bier_table_id_t bi_tbl;
+
+ /**
+ * number of locks
+ */
+ u32 bi_locks;
+
} bier_imp_t;
extern index_t bier_imp_add_or_lock(const bier_table_id_t *bt,
diff --git a/src/vnet/bier/bier_lookup.c b/src/vnet/bier/bier_lookup.c
index 817dcc6f3e8..4e544a3aca5 100644
--- a/src/vnet/bier/bier_lookup.c
+++ b/src/vnet/bier/bier_lookup.c
@@ -84,6 +84,7 @@ bier_lookup (vlib_main_t * vm,
u32 n_left_from, next_index, * from, * to_next;
bier_lookup_main_t *blm = &bier_lookup_main;
u32 thread_index = vlib_get_thread_index();
+ bier_bit_mask_bucket_t buckets_copy[BIER_HDR_BUCKETS_4096];
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
@@ -98,7 +99,6 @@ bier_lookup (vlib_main_t * vm,
while (n_left_from > 0 && n_left_to_next > 0)
{
- bier_bit_mask_bucket_t buckets_copy[BIER_HDR_BUCKETS_256];
u32 next0, bi0, n_bytes, bti0, bfmi0;
const bier_fmask_t *bfm0;
const bier_table_t *bt0;
@@ -199,6 +199,9 @@ bier_lookup (vlib_main_t * vm,
/*
* go to the next bit-position set
*/
+ vlib_node_increment_counter(
+ vm, node->node_index,
+ BIER_LOOKUP_ERROR_FMASK_UNRES, 1);
bucket = ((int*)bbs.bbs_buckets)[index];
continue;
}
@@ -210,19 +213,19 @@ bier_lookup (vlib_main_t * vm,
* Create the number of clones we need based on the number
* of fmasks we are sending to.
*/
- u8 num_cloned, clone;
+ u16 num_cloned, clone;
u32 n_clones;
n_clones = vec_len(blm->blm_fmasks[thread_index]);
if (PREDICT_TRUE(0 != n_clones))
{
- ASSERT(n_clones < 256);
num_cloned = vlib_buffer_clone(vm, bi0,
blm->blm_clones[thread_index],
- n_clones, 128);
+ n_clones,
+ n_bytes + 8);
- if (num_cloned != n_clones)
+ if (num_cloned != vec_len(blm->blm_fmasks[thread_index]))
{
vlib_node_increment_counter
(vm, node->node_index,
@@ -301,12 +304,12 @@ bier_lookup (vlib_main_t * vm,
}
}
- vlib_put_next_frame (vm, node, next_index, n_left_to_next);
+ vlib_put_next_frame(vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, bier_lookup_node.index,
- BIER_LOOKUP_ERROR_NONE,
- from_frame->n_vectors);
+ vlib_node_increment_counter(vm, bier_lookup_node.index,
+ BIER_LOOKUP_ERROR_NONE,
+ from_frame->n_vectors);
return (from_frame->n_vectors);
}
@@ -355,11 +358,11 @@ bier_lookup_module_init (vlib_main_t * vm)
thread_index++)
{
/*
- * 4096 is the most we will ever need to support
- * a Bit-Mask length of 4096
+ * 1024 is the most we will ever need to support
+ * a Bit-Mask length of 1024
*/
- vec_validate(blm->blm_fmasks[thread_index], 4095);
- vec_validate(blm->blm_clones[thread_index], 4095);
+ vec_validate(blm->blm_fmasks[thread_index], 1023);
+ vec_validate(blm->blm_clones[thread_index], 1023);
}
return 0;
diff --git a/src/vnet/bier/bier_table.c b/src/vnet/bier/bier_table.c
index 0f0f37677e9..80231fd8a72 100644
--- a/src/vnet/bier/bier_table.c
+++ b/src/vnet/bier/bier_table.c
@@ -562,20 +562,22 @@ bier_table_route_add (const bier_table_id_t *btid,
}
void
-bier_table_route_remove (const bier_table_id_t *bti,
+bier_table_route_remove (const bier_table_id_t *btid,
bier_bp_t bp,
fib_route_path_t *brps)
{
fib_route_path_t *brp = NULL;
+ index_t bfmi, bti, bei;
bier_table_t *bt;
- index_t bei;
+ u32 ii;
- bt = bier_table_find(bti);
+ bt = bier_table_find(btid);
if (NULL == bt) {
return;
}
+ bti = bier_table_get_index(bt);
bei = bier_table_lookup(bt, bp);
if (INDEX_INVALID == bei)
@@ -584,9 +586,34 @@ bier_table_route_remove (const bier_table_id_t *bti,
return;
}
- vec_foreach(brp, brps)
+ /*
+ * set the FIB index in the path to the BIER table index
+ */
+ vec_foreach_index(ii, brps)
{
- brp->frp_bier_fib_index = bier_table_get_index(bt);
+ brp = &brps[ii];
+ bfmi = bier_fmask_db_find(bti, brp);
+
+ if (INDEX_INVALID == bfmi)
+ {
+ /*
+ * no matching fmask, not a path we can remove
+ */
+ vec_del1(brps, ii);
+ continue;
+ }
+
+ /*
+ * then modify the path to resolve via this fmask object
+ * and use it to resolve the BIER entry.
+ */
+ brp->frp_flags = FIB_ROUTE_PATH_BIER_FMASK;
+ brp->frp_bier_fmask = bfmi;
+ }
+
+ if (0 == vec_len(brps))
+ {
+ return;
}
if (0 == bier_entry_path_remove(bei, brps))
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);
}
diff --git a/src/vnet/bier/bier_types.h b/src/vnet/bier/bier_types.h
index d484ba9ed03..ebddbe8d820 100644
--- a/src/vnet/bier/bier_types.h
+++ b/src/vnet/bier/bier_types.h
@@ -56,6 +56,11 @@ typedef enum bier_hdr_len_id_t_ {
BIER_HDR_LEN_256,
BIER_HDR_LEN_512,
BIER_HDR_LEN_1024,
+ /**
+ * Bit-string lengths greater than 1024 are not supported due to the
+ * limited about pf space available in a vlib_buffer_t to prepend a
+ * BIER header at imposition.
+ */
BIER_HDR_LEN_2048,
BIER_HDR_LEN_4096,
BIER_HDR_LEN_INVALID,
@@ -252,56 +257,6 @@ typedef enum bier_hdr_ctrl_sub_code_t_ {
typedef u8 bier_bit_mask_bucket_t;
/**
- * A BIER Bit-String value of length 64 bits.
- */
-typedef struct bier_bit_mask_64_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_64];
-} bier_bit_mask_64_t;
-
-/**
- * A BIER Bit-String value of length 128 bits.
- */
-typedef struct bier_bit_mask_128_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_128];
-} bier_bit_mask_128_t;
-
-/**
- * A BIER Bit-String value of length 256 bits.
- */
-typedef struct bier_bit_mask_256_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_256];
-} bier_bit_mask_256_t;
-
-/**
- * A BIER Bit-String value of length 512 bits.
- */
-typedef struct bier_bit_mask_512_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_512];
-} bier_bit_mask_512_t;
-
-/**
- * A BIER Bit-String value of length 1024 bits.
- */
-typedef struct bier_bit_mask_1024_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_1024];
-} bier_bit_mask_1024_t;
-
-/**
- * A BIER Bit-String value of length 2048 bits.
- */
-typedef struct bier_bit_mask_2048_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_2048];
-} bier_bit_mask_2048_t;
-
-/**
- * A BIER Bit-String value of length 4096 bits.
- */
-typedef struct bier_bit_mask_4096_t_ {
- bier_bit_mask_bucket_t bits[BIER_HDR_BUCKETS_4096];
-} bier_bit_mask_4096_t;
-
-
-/**
* 256 bits = 32 bytes
*/
#define BIER_BIT_MASK_NUM_BUCKETS 32
@@ -333,13 +288,6 @@ typedef struct bier_bit_string_t_ {
} bier_bit_string_t;
/**
- * A BIER Bit-mask value
- *
- * The size of this mask represents this platforms BIER capabilities
- */
-typedef bier_bit_mask_256_t bier_bit_mask_t;
-
-/**
* A bit positon
* as assigned to egress PEs
*/
diff --git a/src/vnet/dpo/replicate_dpo.c b/src/vnet/dpo/replicate_dpo.c
index ae045f6a431..95d7f9748ab 100644
--- a/src/vnet/dpo/replicate_dpo.c
+++ b/src/vnet/dpo/replicate_dpo.c
@@ -667,7 +667,8 @@ replicate_inline (vlib_main_t * vm,
vec_validate (rm->clones[thread_index], rep0->rep_n_buckets - 1);
- num_cloned = vlib_buffer_clone (vm, bi0, rm->clones[thread_index], rep0->rep_n_buckets, 128);
+ num_cloned = vlib_buffer_clone (vm, bi0, rm->clones[thread_index],
+ rep0->rep_n_buckets, 128);
if (num_cloned != rep0->rep_n_buckets)
{
diff --git a/test/Makefile b/test/Makefile
index 155325a9f17..dbb26973440 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -214,7 +214,7 @@ help:
@echo " V=[0|1|2] - set test verbosity level"
@echo " CACHE_OUTPUT=[0|1] - cache VPP stdout/stderr and log as one block after test finishes (default: 1)"
@echo " FAILFAST=[0|1] - fail fast if 1, complete all tests if 0"
- @echo " TIMEOUT=<timeout> - fail test suite if any single test takes longer than <timeout> to finish"
+ @echo " TIMEOUT=<timeout> - fail test suite if any single test takes longer than <timeout> (in seconds) to finish"
@echo " RETRIES=<n> - retry failed tests <n> times"
@echo " DEBUG=<type> - set VPP debugging kind"
@echo " DEBUG=core - detect coredump and load it in gdb on crash"
diff --git a/test/patches/scapy-2.3.3/bier.patch b/test/patches/scapy-2.3.3/bier.patch
index 50814d41315..82a881e9997 100644
--- a/test/patches/scapy-2.3.3/bier.patch
+++ b/test/patches/scapy-2.3.3/bier.patch
@@ -3,10 +3,10 @@ new file mode 100644
index 0000000..e173cdb
--- /dev/null
+++ b/scapy/contrib/bier.py
-@@ -0,0 +1,53 @@
+@@ -0,0 +1,58 @@
+# http://trac.secdev.org/scapy/ticket/31
+
-+# scapy.contrib.description = MPLS
++# scapy.contrib.description = BIER
+# scapy.contrib.status = loads
+
+from scapy.packet import *
@@ -14,44 +14,49 @@ index 0000000..e173cdb
+from scapy.layers.inet import IP, UDP
+from scapy.layers.inet6 import IPv6
+
++
+class BIERLength:
-+ BIER_LEN_64 = 0
-+ BIER_LEN_128 = 1
-+ BIER_LEN_256 = 2
++ BIER_LEN_64 = 0
++ BIER_LEN_128 = 1
++ BIER_LEN_256 = 2
++ BIER_LEN_512 = 3
++ BIER_LEN_1024 = 4
+
+
-+BIERnhcls = { 1: "MPLS",
-+ 2: "MPLS",
-+ 4: "IPv4",
-+ 5: "IPv6" }
++BIERnhcls = {1: "MPLS",
++ 2: "MPLS",
++ 4: "IPv4",
++ 5: "IPv6"}
+
+
+class BIFT(Packet):
-+ name = "BIFT"
-+ fields_desc = [ BitField("bsl", 0, 4),
-+ BitField("sd", 0, 8),
-+ BitField("set", 0, 8),
-+ BitField("cos", 0, 3),
-+ BitField("s", 1, 1),
-+ ByteField("ttl", 0) ]
++ name = "BIFT"
++ fields_desc = [BitField("bsl", 0, 4),
++ BitField("sd", 0, 8),
++ BitField("set", 0, 8),
++ BitField("cos", 0, 3),
++ BitField("s", 1, 1),
++ ByteField("ttl", 0)]
+
-+ def guess_payload_class(self, payload):
-+ return BIER
++ def guess_payload_class(self, payload):
++ return BIER
+
+
+class BIER(Packet):
-+ name = "BIER"
-+ fields_desc = [ BitField("id", 5, 4),
-+ BitField("version", 0, 4),
-+ BitField("length", 0, 4),
-+ BitField("entropy", 0, 20),
-+ BitField("OAM", 0, 2),
-+ BitField("RSV", 0, 2),
-+ BitField("DSCP", 0, 6),
-+ BitEnumField("Proto", 2, 6, BIERnhcls),
-+ ShortField("BFRID", 0),
-+ StrFixedLenField("BitString",
-+ chr(255)*32, 32) ]
++ name = "BIER"
++ fields_desc = [BitField("id", 5, 4),
++ BitField("version", 0, 4),
++ BitFieldLenField("length", BIERLength.BIER_LEN_256, 4,
++ length_of=lambda x:(x.BitString >> 8)),
++ BitField("entropy", 0, 20),
++ BitField("OAM", 0, 2),
++ BitField("RSV", 0, 2),
++ BitField("DSCP", 0, 6),
++ BitEnumField("Proto", 2, 6, BIERnhcls),
++ ShortField("BFRID", 0),
++ StrLenField("BitString",
++ "",
++ length_from=lambda x:(8 << x.length))]
+
+
+bind_layers(BIER, IP, Proto=4)
diff --git a/test/test_bier.py b/test/test_bier.py
index 03ae52abad4..a70dd0978cb 100644
--- a/test/test_bier.py
+++ b/test/test_bier.py
@@ -3,7 +3,7 @@
import unittest
import socket
-from framework import VppTestCase, VppTestRunner
+from framework import VppTestCase, VppTestRunner, running_extended_tests
from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsRoute, \
VppMplsTable, VppIpMRoute, VppMRoutePath, VppIpTable, \
MRouteEntryFlags, MRouteItfFlags, MPLS_LABEL_INVALID, DpoProto
@@ -66,13 +66,13 @@ class TestBier(VppTestCase):
i.admin_down()
super(TestBier, self).tearDown()
- def test_bier_midpoint(self):
+ def bier_midpoint(self, hdr_len_id, n_bytes, max_bp):
"""BIER midpoint"""
#
# Add a BIER table for sub-domain 0, set 0, and BSL 256
#
- bti = VppBierTableID(0, 0, BIERLength.BIER_LEN_256)
+ bti = VppBierTableID(0, 0, hdr_len_id)
bt = VppBierTable(self, bti, 77)
bt.add_vpp_config()
@@ -81,8 +81,7 @@ class TestBier(VppTestCase):
#
p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
MPLS(label=77, ttl=255) /
- BIER(length=BIERLength.BIER_LEN_256,
- BitString=chr(0)*64) /
+ BIER(length=hdr_len_id) /
IPv6(src=self.pg0.remote_ip6, dst=self.pg0.remote_ip6) /
UDP(sport=1234, dport=1234) /
Raw())
@@ -98,7 +97,7 @@ class TestBier(VppTestCase):
#
nh_routes = []
bier_routes = []
- for i in range(1, 256):
+ for i in range(1, max_bp+1):
nh = "10.0.%d.%d" % (i / 255, i % 255)
nh_routes.append(VppIpRoute(self, nh, 32,
[VppRoutePath(self.pg1.remote_ip4,
@@ -112,60 +111,92 @@ class TestBier(VppTestCase):
bier_routes[-1].add_vpp_config()
#
- # A packet with all bits set gets spat out to BP:1
- #
- p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
- MPLS(label=77, ttl=255) /
- BIER(length=BIERLength.BIER_LEN_256) /
- IPv6(src=self.pg0.remote_ip6, dst=self.pg0.remote_ip6) /
- UDP(sport=1234, dport=1234) /
- Raw())
- pkts = [p]
-
- self.pg0.add_stream(pkts)
- self.pg_enable_capture(self.pg_interfaces)
- self.pg_start()
-
- rx = self.pg1.get_capture(255)
-
- for rxp in rx:
- #
- # The packets are not required to be sent in bit-position order
- # when we setup the routes above we used the bit-position to
- # construct the out-label. so use that here to determine the BP
- #
- olabel = rxp[MPLS]
- bp = olabel.label - 2000
-
- blabel = olabel[MPLS].payload
- self.assertEqual(blabel.label, 100+bp)
- self.assertEqual(blabel.ttl, 254)
-
- bier_hdr = blabel[MPLS].payload
-
- self.assertEqual(bier_hdr.id, 5)
- self.assertEqual(bier_hdr.version, 0)
- self.assertEqual(bier_hdr.length, BIERLength.BIER_LEN_256)
- self.assertEqual(bier_hdr.entropy, 0)
- self.assertEqual(bier_hdr.OAM, 0)
- self.assertEqual(bier_hdr.RSV, 0)
- self.assertEqual(bier_hdr.DSCP, 0)
- self.assertEqual(bier_hdr.Proto, 5)
-
- # The bit-string should consist only of the BP given by i.
- i = 0
- bitstring = ""
- bpi = bp - 1
- while (i < bpi/8):
- bitstring = chr(0) + bitstring
- i += 1
- bitstring = chr(1 << bpi % 8) + bitstring
-
- while len(bitstring) < 32:
- bitstring = chr(0) + bitstring
-
- self.assertEqual(len(bitstring), len(bier_hdr.BitString))
- self.assertEqual(bitstring, bier_hdr.BitString)
+ # A packet with all bits set gets replicated once for each bit
+ #
+ pkt_sizes = [64, 1400]
+
+ for pkt_size in pkt_sizes:
+ p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
+ MPLS(label=77, ttl=255) /
+ BIER(length=hdr_len_id, BitString=chr(255)*n_bytes) /
+ IPv6(src=self.pg0.remote_ip6, dst=self.pg0.remote_ip6) /
+ UDP(sport=1234, dport=1234) /
+ Raw(chr(5) * pkt_size))
+ pkts = p
+
+ self.pg0.add_stream(pkts)
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ rx = self.pg1.get_capture(max_bp)
+
+ for rxp in rx:
+ #
+ # The packets are not required to be sent in bit-position order
+ # when we setup the routes above we used the bit-position to
+ # construct the out-label. so use that here to determine the BP
+ #
+ olabel = rxp[MPLS]
+ bp = olabel.label - 2000
+
+ blabel = olabel[MPLS].payload
+ self.assertEqual(blabel.label, 100+bp)
+ self.assertEqual(blabel.ttl, 254)
+
+ bier_hdr = blabel[MPLS].payload
+
+ self.assertEqual(bier_hdr.id, 5)
+ self.assertEqual(bier_hdr.version, 0)
+ self.assertEqual(bier_hdr.length, hdr_len_id)
+ self.assertEqual(bier_hdr.entropy, 0)
+ self.assertEqual(bier_hdr.OAM, 0)
+ self.assertEqual(bier_hdr.RSV, 0)
+ self.assertEqual(bier_hdr.DSCP, 0)
+ self.assertEqual(bier_hdr.Proto, 5)
+
+ # The bit-string should consist only of the BP given by i.
+ byte_array = ['\0'] * (n_bytes)
+ byte_val = chr(1 << (bp - 1) % 8)
+ byte_pos = n_bytes - (((bp - 1) / 8) + 1)
+ byte_array[byte_pos] = byte_val
+ bitstring = ''.join(byte_array)
+
+ self.assertEqual(len(bitstring), len(bier_hdr.BitString))
+ self.assertEqual(bitstring, bier_hdr.BitString)
+
+ #
+ # cleanup. not strictly necessary, but it's much quicker this way
+ # becuase the bier_fib_dump and ip_fib_dump will be empty when the
+ # auto-cleanup kicks in
+ #
+ for br in bier_routes:
+ br.remove_vpp_config()
+ for nhr in nh_routes:
+ nhr.remove_vpp_config()
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_midpoint_1024(self):
+ """BIER midpoint BSL:1024"""
+ self.bier_midpoint(BIERLength.BIER_LEN_1024, 128, 1024)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_midpoint_512(self):
+ """BIER midpoint BSL:512"""
+ self.bier_midpoint(BIERLength.BIER_LEN_512, 64, 512)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_midpoint_256(self):
+ """BIER midpoint BSL:256"""
+ self.bier_midpoint(BIERLength.BIER_LEN_256, 32, 256)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_midpoint_128(self):
+ """BIER midpoint BSL:128"""
+ self.bier_midpoint(BIERLength.BIER_LEN_128, 16, 128)
+
+ def test_bier_midpoint_64(self):
+ """BIER midpoint BSL:256"""
+ self.bier_midpoint(BIERLength.BIER_LEN_64, 8, 64)
def test_bier_head(self):
"""BIER head"""
@@ -292,6 +323,7 @@ class TestBier(VppTestCase):
#
bier_de_1 = VppBierDispEntry(self, bdt.id, 99,
BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+ DpoProto.DPO_PROTO_BIER,
"0.0.0.0", 0, rpf_id=8192)
bier_de_1.add_vpp_config()
@@ -313,7 +345,9 @@ class TestBier(VppTestCase):
#
p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
MPLS(label=77, ttl=255) /
- BIER(length=BIERLength.BIER_LEN_256, BFRID=99) /
+ BIER(length=BIERLength.BIER_LEN_256,
+ BitString=chr(255)*32,
+ BFRID=99) /
IP(src="1.1.1.1", dst="232.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw())
@@ -325,7 +359,9 @@ class TestBier(VppTestCase):
#
p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
MPLS(label=77, ttl=255) /
- BIER(length=BIERLength.BIER_LEN_256, BFRID=77) /
+ BIER(length=BIERLength.BIER_LEN_256,
+ BitString=chr(255)*32,
+ BFRID=77) /
IP(src="1.1.1.1", dst="232.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw())
@@ -337,6 +373,7 @@ class TestBier(VppTestCase):
#
bier_de_2 = VppBierDispEntry(self, bdt.id, 0,
BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+ DpoProto.DPO_PROTO_BIER,
"0.0.0.0", 0, rpf_id=8192)
bier_de_2.add_vpp_config()
@@ -345,22 +382,28 @@ class TestBier(VppTestCase):
#
self.send_and_expect(self.pg0, [p], self.pg1)
- def test_bier_e2e(self):
- """ BIER end-to-end """
+ def bier_e2e(self, hdr_len_id, n_bytes, max_bp):
+ """ BIER end-to-end"""
#
# Add a BIER table for sub-domain 0, set 0, and BSL 256
#
- bti = VppBierTableID(0, 0, BIERLength.BIER_LEN_256)
+ bti = VppBierTableID(0, 0, hdr_len_id)
bt = VppBierTable(self, bti, 77)
bt.add_vpp_config()
+ lowest = ['\0'] * (n_bytes)
+ lowest[-1] = chr(1)
+ highest = ['\0'] * (n_bytes)
+ highest[0] = chr(128)
+
#
- # Impostion Sets bit string 101010101....
- # sender 333
+ # Impostion Sets bit strings
#
- bi = VppBierImp(self, bti, 333, chr(0x5) * 32)
- bi.add_vpp_config()
+ bi_low = VppBierImp(self, bti, 333, lowest)
+ bi_low.add_vpp_config()
+ bi_high = VppBierImp(self, bti, 334, highest)
+ bi_high.add_vpp_config()
#
# Add a multicast route that will forward into the BIER doamin
@@ -375,8 +418,20 @@ class TestBier(VppTestCase):
VppMRoutePath(0xffffffff,
MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
proto=DpoProto.DPO_PROTO_BIER,
- bier_imp=bi.bi_index)])
+ bier_imp=bi_low.bi_index)])
route_ing_232_1_1_1.add_vpp_config()
+ route_ing_232_1_1_2 = VppIpMRoute(
+ self,
+ "0.0.0.0",
+ "232.1.1.2", 32,
+ MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
+ paths=[VppMRoutePath(self.pg0.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT),
+ VppMRoutePath(0xffffffff,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
+ proto=DpoProto.DPO_PROTO_BIER,
+ bier_imp=bi_high.bi_index)])
+ route_ing_232_1_1_2.add_vpp_config()
#
# disposition table 8
@@ -385,7 +440,7 @@ class TestBier(VppTestCase):
bdt.add_vpp_config()
#
- # BIER route in table that's for-us, resolving through
+ # BIER routes in table that are for-us, resolving through
# disp table 8.
#
bier_route_1 = VppBierRoute(self, bti, 1,
@@ -393,6 +448,11 @@ class TestBier(VppTestCase):
0xffffffff,
nh_table_id=8)])
bier_route_1.add_vpp_config()
+ bier_route_max = VppBierRoute(self, bti, max_bp,
+ [VppRoutePath("0.0.0.0",
+ 0xffffffff,
+ nh_table_id=8)])
+ bier_route_max.add_vpp_config()
#
# An entry in the disposition table for sender 333
@@ -400,11 +460,17 @@ class TestBier(VppTestCase):
#
bier_de_1 = VppBierDispEntry(self, bdt.id, 333,
BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+ DpoProto.DPO_PROTO_BIER,
"0.0.0.0", 10, rpf_id=8192)
bier_de_1.add_vpp_config()
+ bier_de_1 = VppBierDispEntry(self, bdt.id, 334,
+ BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+ DpoProto.DPO_PROTO_BIER,
+ "0.0.0.0", 10, rpf_id=8193)
+ bier_de_1.add_vpp_config()
#
- # Add a multicast route that will forward the traffic
+ # Add a multicast routes that will forward the traffic
# post-disposition
#
route_eg_232_1_1_1 = VppIpMRoute(
@@ -417,6 +483,16 @@ class TestBier(VppTestCase):
MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
route_eg_232_1_1_1.add_vpp_config()
route_eg_232_1_1_1.update_rpf_id(8192)
+ route_eg_232_1_1_2 = VppIpMRoute(
+ self,
+ "0.0.0.0",
+ "232.1.1.2", 32,
+ MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE,
+ table_id=10,
+ paths=[VppMRoutePath(self.pg1.sw_if_index,
+ MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)])
+ route_eg_232_1_1_2.add_vpp_config()
+ route_eg_232_1_1_2.update_rpf_id(8193)
#
# inject a packet in VRF-0. We expect it to be BIER encapped,
@@ -426,16 +502,48 @@ class TestBier(VppTestCase):
p = (Ether(dst=self.pg0.local_mac,
src=self.pg0.remote_mac) /
IP(src="1.1.1.1", dst="232.1.1.1") /
- UDP(sport=1234, dport=1234))
+ UDP(sport=1234, dport=1234) /
+ Raw(chr(5) * 32))
rx = self.send_and_expect(self.pg0, p*65, self.pg1)
- #
- # should be IP
- #
self.assertEqual(rx[0][IP].src, "1.1.1.1")
self.assertEqual(rx[0][IP].dst, "232.1.1.1")
+ p = (Ether(dst=self.pg0.local_mac,
+ src=self.pg0.remote_mac) /
+ IP(src="1.1.1.1", dst="232.1.1.2") /
+ UDP(sport=1234, dport=1234) /
+ Raw(chr(5) * 512))
+
+ rx = self.send_and_expect(self.pg0, p*65, self.pg1)
+ self.assertEqual(rx[0][IP].src, "1.1.1.1")
+ self.assertEqual(rx[0][IP].dst, "232.1.1.2")
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_e2e_1024(self):
+ """ BIER end-to-end BSL:1024"""
+ self.bier_e2e(BIERLength.BIER_LEN_1024, 128, 1024)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_e2e_512(self):
+ """ BIER end-to-end BSL:512"""
+ self.bier_e2e(BIERLength.BIER_LEN_512, 64, 512)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_e2e_256(self):
+ """ BIER end-to-end BSL:256"""
+ self.bier_e2e(BIERLength.BIER_LEN_256, 32, 256)
+
+ @unittest.skipUnless(running_extended_tests(), "part of extended tests")
+ def test_bier_e2e_128(self):
+ """ BIER end-to-end BSL:128"""
+ self.bier_e2e(BIERLength.BIER_LEN_128, 16, 128)
+
+ def test_bier_e2e_64(self):
+ """ BIER end-to-end BSL:64"""
+ self.bier_e2e(BIERLength.BIER_LEN_64, 8, 64)
+
def test_bier_head_o_udp(self):
"""BIER head over UDP"""
@@ -552,6 +660,7 @@ class TestBier(VppTestCase):
#
bier_de_1 = VppBierDispEntry(self, bdt.id, 99,
BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+ DpoProto.DPO_PROTO_BIER,
"0.0.0.0", 0, rpf_id=8192)
bier_de_1.add_vpp_config()
@@ -575,7 +684,9 @@ class TestBier(VppTestCase):
IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
UDP(sport=333, dport=8138) /
BIFT(sd=1, set=0, bsl=2, ttl=255) /
- BIER(length=BIERLength.BIER_LEN_256, BFRID=99) /
+ BIER(length=BIERLength.BIER_LEN_256,
+ BitString=chr(255)*32,
+ BFRID=99) /
IP(src="1.1.1.1", dst="232.1.1.1") /
UDP(sport=1234, dport=1234) /
Raw())
diff --git a/test/vpp_bier.py b/test/vpp_bier.py
index 328d4f03eb5..ef9a9ab75ec 100644
--- a/test/vpp_bier.py
+++ b/test/vpp_bier.py
@@ -219,11 +219,12 @@ class VppBierDispEntry(VppObject):
BIER Disposition Entry
"""
- def __init__(self, test, tbl_id, bp, payload_proto, nh, nh_tbl,
- rpf_id=~0):
+ def __init__(self, test, tbl_id, bp, payload_proto, nh_proto,
+ nh, nh_tbl, rpf_id=~0):
self._test = test
self.tbl_id = tbl_id
self.nh_tbl = nh_tbl
+ self.nh_proto = nh_proto
self.bp = bp
self.payload_proto = payload_proto
self.rpf_id = rpf_id
@@ -234,6 +235,7 @@ class VppBierDispEntry(VppObject):
self.tbl_id,
self.bp,
self.payload_proto,
+ self.nh_proto,
self.nh,
self.nh_tbl,
self.rpf_id,
@@ -245,6 +247,7 @@ class VppBierDispEntry(VppObject):
self.tbl_id,
self.bp,
self.payload_proto,
+ self.nh_proto,
self.nh,
self.nh_tbl,
self.rpf_id,
diff --git a/test/vpp_object.py b/test/vpp_object.py
index a1cf42fce35..088cc39ce0a 100644
--- a/test/vpp_object.py
+++ b/test/vpp_object.py
@@ -66,18 +66,17 @@ class VppObjectRegistry(object):
return
logger.info("REG: Removing VPP configuration for registered objects")
# remove the config in reverse order as there might be dependencies
+ failed = []
for obj in reversed(self._object_registry):
if obj.query_vpp_config():
logger.info("REG: Removing configuration for %s" % obj)
obj.remove_vpp_config()
+ if obj.query_vpp_config():
+ failed.append(obj)
else:
logger.info(
"REG: Skipping removal for %s, configuration not present" %
obj)
- failed = []
- for obj in self._object_registry:
- if obj.query_vpp_config():
- failed.append(obj)
self.unregister_all(logger)
if failed:
logger.error("REG: Couldn't remove configuration for object(s):")
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 087a14b7fad..fd6240576b3 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -2886,6 +2886,7 @@ class VppPapiProvider(object):
bdti,
bp,
payload_proto,
+ next_hop_afi,
next_hop,
next_hop_tbl_id=0,
next_hop_rpf_id=~0,
@@ -2900,7 +2901,7 @@ class VppPapiProvider(object):
'bde_n_paths': 1,
'bde_paths': [{'next_hop': next_hop,
'table_id': next_hop_tbl_id,
- 'afi': 0,
+ 'afi': next_hop_afi,
'rpf_id': next_hop_rpf_id,
'n_labels': 0,
'label_stack': [0]}],