BIER: fix support for longer bit-string lengths

Change-Id: I2421197b76be58099e5f8ed5554410adff202109
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
This commit is contained in:
Neale Ranns
2018-01-31 11:35:41 -08:00
committed by Damjan Marion
parent 7e2c31aba2
commit f051072f85
17 changed files with 380 additions and 248 deletions
+2 -1
View File
@@ -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
{
+3 -1
View File
@@ -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
+60 -41
View File
@@ -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,
};
rv = vnm->api_errno;
if (mp->bt_is_add)
{
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);
}
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,
};
/*
* 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);
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);
}
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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,
+12 -11
View File
@@ -32,16 +32,6 @@
* The BIER imposition object
*/
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
@@ -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,
+16 -13
View File
@@ -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;
+32 -5
View File
@@ -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))
+22 -11
View File
@@ -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);
}
+5 -57
View File
@@ -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,
@@ -251,56 +256,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
*/
@@ -332,13 +287,6 @@ typedef struct bier_bit_string_t_ {
bier_bit_mask_bucket_t *bbs_buckets;
} 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
+2 -1
View File
@@ -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)
{
+1 -1
View File
@@ -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"
+35 -30
View File
@@ -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)
+178 -67
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -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,
+3 -4
View File
@@ -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):")
+2 -1
View File
@@ -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]}],