Add a name to the creation of an IP and MPLS table
Change-Id: I4b4648831551519b2ffb6f93255d28a4b8726c22 Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:
committed by
Florin Coras
parent
49fe046e43
commit
2297af016d
@@ -94,8 +94,7 @@ format_fib_source (u8 * s, va_list * args)
|
||||
{
|
||||
fib_source_t source = va_arg (*args, int);
|
||||
|
||||
s = format (s, "\n src:%s ",
|
||||
fib_source_names[source]);
|
||||
s = format (s, "src:%s", fib_source_names[source]);
|
||||
|
||||
return (s);
|
||||
}
|
||||
@@ -125,8 +124,7 @@ format_fib_entry (u8 * s, va_list * args)
|
||||
|
||||
FOR_EACH_SRC_ADDED(fib_entry, src, source,
|
||||
({
|
||||
s = format (s, "\n src:%U ",
|
||||
format_fib_source, source);
|
||||
s = format (s, "\n %U", format_fib_source, source);
|
||||
s = fib_entry_src_format(fib_entry, source, s);
|
||||
s = format (s, " refs:%d ", src->fes_ref_count);
|
||||
if (FIB_ENTRY_FLAG_NONE != src->fes_entry_flags) {
|
||||
|
||||
@@ -1037,10 +1037,11 @@ fib_table_find (fib_protocol_t proto,
|
||||
return (~0);
|
||||
}
|
||||
|
||||
u32
|
||||
fib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t src)
|
||||
static u32
|
||||
fib_table_find_or_create_and_lock_i (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t src,
|
||||
const u8 *name)
|
||||
{
|
||||
fib_table_t *fib_table;
|
||||
fib_node_index_t fi;
|
||||
@@ -1062,13 +1063,42 @@ fib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
|
||||
fib_table = fib_table_get(fi, proto);
|
||||
|
||||
fib_table->ft_desc = format(NULL, "%U-VRF:%d",
|
||||
format_fib_protocol, proto,
|
||||
table_id);
|
||||
if (NULL == fib_table->ft_desc)
|
||||
{
|
||||
if (name && name[0])
|
||||
{
|
||||
fib_table->ft_desc = format(NULL, "%s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
fib_table->ft_desc = format(NULL, "%U-VRF:%d",
|
||||
format_fib_protocol, proto,
|
||||
table_id);
|
||||
}
|
||||
}
|
||||
|
||||
return (fi);
|
||||
}
|
||||
|
||||
u32
|
||||
fib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t src)
|
||||
{
|
||||
return (fib_table_find_or_create_and_lock_i(proto, table_id,
|
||||
src, NULL));
|
||||
}
|
||||
|
||||
u32
|
||||
fib_table_find_or_create_and_lock_w_name (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t src,
|
||||
const u8 *name)
|
||||
{
|
||||
return (fib_table_find_or_create_and_lock_i(proto, table_id,
|
||||
src, name));
|
||||
}
|
||||
|
||||
u32
|
||||
fib_table_create_and_lock (fib_protocol_t proto,
|
||||
fib_source_t src,
|
||||
|
||||
@@ -642,6 +642,31 @@ extern u32 fib_table_find_or_create_and_lock(fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t source);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Get the index of the FIB for a Table-ID. This DOES create the
|
||||
* FIB if it does not exist.
|
||||
*
|
||||
* @paran proto
|
||||
* The protocol of the FIB (and thus the entries therein)
|
||||
*
|
||||
* @param table-id
|
||||
* The Table-ID
|
||||
*
|
||||
* @return fib_index
|
||||
* The index of the FIB
|
||||
*
|
||||
* @param source
|
||||
* The ID of the client/source.
|
||||
*
|
||||
* @param name
|
||||
* The client is choosing the name they want the table to have
|
||||
*/
|
||||
extern u32 fib_table_find_or_create_and_lock_w_name(fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
fib_source_t source,
|
||||
const u8 *name);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Create a new table with no table ID. This means it does not get
|
||||
|
||||
@@ -8173,7 +8173,7 @@ lfib_test (void)
|
||||
/*
|
||||
* MPLS enable an interface so we get the MPLS table created
|
||||
*/
|
||||
mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
|
||||
mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API, NULL);
|
||||
mpls_sw_interface_enable_disable(&mpls_main,
|
||||
tm->hw[0]->sw_if_index,
|
||||
1, 1);
|
||||
|
||||
@@ -551,7 +551,7 @@ ip4_show_fib (vlib_main_t * vm,
|
||||
}
|
||||
}
|
||||
s = format (s, "]");
|
||||
vlib_cli_output (vm, "%V", s);
|
||||
vlib_cli_output (vm, "%v", s);
|
||||
vec_free(s);
|
||||
|
||||
/* Show summary? */
|
||||
|
||||
@@ -615,7 +615,7 @@ ip6_show_fib (vlib_main_t * vm,
|
||||
}
|
||||
}
|
||||
s = format (s, "]");
|
||||
vlib_cli_output (vm, "%V", s);
|
||||
vlib_cli_output (vm, "%v", s);
|
||||
vec_free(s);
|
||||
|
||||
/* Show summary? */
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
@param table_id - table ID associated with the route
|
||||
This table ID will apply to both the unicats
|
||||
and mlticast FIBs
|
||||
@param name - A client provided name/tag for the table. If this is
|
||||
not set by the client, then VPP will generate something
|
||||
meaningfull.
|
||||
*/
|
||||
autoreply define ip_table_add_del
|
||||
{
|
||||
@@ -35,6 +38,7 @@ autoreply define ip_table_add_del
|
||||
u32 table_id;
|
||||
u8 is_ipv6;
|
||||
u8 is_add;
|
||||
u8 name[64];
|
||||
};
|
||||
|
||||
/** \brief Dump IP fib table
|
||||
@@ -83,6 +87,7 @@ manual_endian manual_print define ip_fib_details
|
||||
{
|
||||
u32 context;
|
||||
u32 table_id;
|
||||
u8 table_name[64];
|
||||
u8 address_length;
|
||||
u8 address[4];
|
||||
u32 count;
|
||||
@@ -98,10 +103,10 @@ define ip6_fib_dump
|
||||
u32 context;
|
||||
};
|
||||
|
||||
/** \brief IP6 FIB table response
|
||||
/** \brief IP6 FIB table entry response
|
||||
@param table_id - IP6 fib table id
|
||||
@address_length - mask length
|
||||
@address - ip6 prefix
|
||||
@param address_length - mask length
|
||||
@param address - ip6 prefix
|
||||
@param count - the number of fib_path in path
|
||||
@param path - array of of fib_path structures
|
||||
*/
|
||||
@@ -109,6 +114,7 @@ manual_endian manual_print define ip6_fib_details
|
||||
{
|
||||
u32 context;
|
||||
u32 table_id;
|
||||
u8 table_name[64];
|
||||
u8 address_length;
|
||||
u8 address[16];
|
||||
u32 count;
|
||||
|
||||
@@ -184,7 +184,8 @@ void ip_del_all_interface_addresses (vlib_main_t * vm, u32 sw_if_index);
|
||||
extern vlib_node_registration_t ip4_inacl_node;
|
||||
extern vlib_node_registration_t ip6_inacl_node;
|
||||
|
||||
void ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api);
|
||||
void ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api,
|
||||
const u8 * name);
|
||||
|
||||
void ip_table_delete (fib_protocol_t fproto, u32 table_id, u8 is_api);
|
||||
|
||||
|
||||
@@ -180,7 +180,8 @@ copy_fib_next_hop (fib_route_path_encode_t * api_rpath, void *fp_arg)
|
||||
static void
|
||||
send_ip_fib_details (vpe_api_main_t * am,
|
||||
unix_shared_memory_queue_t * q,
|
||||
u32 table_id, fib_prefix_t * pfx,
|
||||
const fib_table_t * table,
|
||||
const fib_prefix_t * pfx,
|
||||
fib_route_path_encode_t * api_rpaths, u32 context)
|
||||
{
|
||||
vl_api_ip_fib_details_t *mp;
|
||||
@@ -196,7 +197,9 @@ send_ip_fib_details (vpe_api_main_t * am,
|
||||
mp->_vl_msg_id = ntohs (VL_API_IP_FIB_DETAILS);
|
||||
mp->context = context;
|
||||
|
||||
mp->table_id = htonl (table_id);
|
||||
mp->table_id = htonl (table->ft_table_id);
|
||||
memcpy (mp->table_name, table->ft_desc,
|
||||
clib_min (vec_len (table->ft_desc), sizeof (mp->table_name)));
|
||||
mp->address_length = pfx->fp_len;
|
||||
memcpy (mp->address, &pfx->fp_addr.ip4, sizeof (pfx->fp_addr.ip4));
|
||||
|
||||
@@ -295,9 +298,7 @@ vl_api_ip_fib_dump_t_handler (vl_api_ip_fib_dump_t * mp)
|
||||
fib_table = fib_table_get (fib_index, pfx.fp_proto);
|
||||
api_rpaths = NULL;
|
||||
fib_entry_encode (*lfeip, &api_rpaths);
|
||||
send_ip_fib_details (am, q,
|
||||
fib_table->ft_table_id, &pfx, api_rpaths,
|
||||
mp->context);
|
||||
send_ip_fib_details (am, q, fib_table, &pfx, api_rpaths, mp->context);
|
||||
vec_free (api_rpaths);
|
||||
}
|
||||
|
||||
@@ -744,7 +745,7 @@ vl_api_ip_table_add_del_t_handler (vl_api_ip_table_add_del_t * mp)
|
||||
|
||||
if (mp->is_add)
|
||||
{
|
||||
ip_table_create (fproto, table_id, 1);
|
||||
ip_table_create (fproto, table_id, 1, mp->name);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1124,7 +1125,8 @@ vl_api_ip_add_del_route_t_handler (vl_api_ip_add_del_route_t * mp)
|
||||
}
|
||||
|
||||
void
|
||||
ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api)
|
||||
ip_table_create (fib_protocol_t fproto,
|
||||
u32 table_id, u8 is_api, const u8 * name)
|
||||
{
|
||||
u32 fib_index, mfib_index;
|
||||
|
||||
@@ -1147,17 +1149,17 @@ ip_table_create (fib_protocol_t fproto, u32 table_id, u8 is_api)
|
||||
|
||||
if (~0 == fib_index)
|
||||
{
|
||||
fib_table_find_or_create_and_lock (fproto, table_id,
|
||||
(is_api ?
|
||||
FIB_SOURCE_API :
|
||||
FIB_SOURCE_CLI));
|
||||
fib_table_find_or_create_and_lock_w_name (fproto, table_id,
|
||||
(is_api ?
|
||||
FIB_SOURCE_API :
|
||||
FIB_SOURCE_CLI), name);
|
||||
}
|
||||
if (~0 == mfib_index)
|
||||
{
|
||||
mfib_table_find_or_create_and_lock (fproto, table_id,
|
||||
(is_api ?
|
||||
MFIB_SOURCE_API :
|
||||
MFIB_SOURCE_CLI));
|
||||
mfib_table_find_or_create_and_lock_w_name (fproto, table_id,
|
||||
(is_api ?
|
||||
MFIB_SOURCE_API :
|
||||
MFIB_SOURCE_CLI), name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -695,6 +695,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
|
||||
unformat_input_t _line_input, *line_input = &_line_input;
|
||||
clib_error_t *error = NULL;
|
||||
u32 table_id, is_add;
|
||||
u8 *name = NULL;
|
||||
|
||||
is_add = 1;
|
||||
table_id = ~0;
|
||||
@@ -711,6 +712,8 @@ vnet_ip_table_cmd (vlib_main_t * vm,
|
||||
is_add = 0;
|
||||
else if (unformat (line_input, "add"))
|
||||
is_add = 1;
|
||||
else if (unformat (line_input, "name %s", &name))
|
||||
;
|
||||
else
|
||||
{
|
||||
error = unformat_parse_error (line_input);
|
||||
@@ -732,7 +735,7 @@ vnet_ip_table_cmd (vlib_main_t * vm,
|
||||
{
|
||||
if (is_add)
|
||||
{
|
||||
ip_table_create (fproto, table_id, 0);
|
||||
ip_table_create (fproto, table_id, 0, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -422,10 +422,11 @@ mfib_table_find (fib_protocol_t proto,
|
||||
return (~0);
|
||||
}
|
||||
|
||||
u32
|
||||
mfib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t src)
|
||||
static u32
|
||||
mfib_table_find_or_create_and_lock_i (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t src,
|
||||
const u8 *name)
|
||||
{
|
||||
mfib_table_t *mfib_table;
|
||||
fib_node_index_t fi;
|
||||
@@ -445,13 +446,42 @@ mfib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
|
||||
mfib_table = mfib_table_get(fi, proto);
|
||||
|
||||
mfib_table->mft_desc = format(NULL, "%U-VRF:%d",
|
||||
format_fib_protocol, proto,
|
||||
table_id);
|
||||
if (NULL == mfib_table->mft_desc)
|
||||
{
|
||||
if (name && name[0])
|
||||
{
|
||||
mfib_table->mft_desc = format(NULL, "%s", name);
|
||||
}
|
||||
else
|
||||
{
|
||||
mfib_table->mft_desc = format(NULL, "%U-VRF:%d",
|
||||
format_fib_protocol, proto,
|
||||
table_id);
|
||||
}
|
||||
}
|
||||
|
||||
return (fi);
|
||||
}
|
||||
|
||||
u32
|
||||
mfib_table_find_or_create_and_lock (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t src)
|
||||
{
|
||||
return (mfib_table_find_or_create_and_lock_i(proto, table_id,
|
||||
src, NULL));
|
||||
}
|
||||
|
||||
u32
|
||||
mfib_table_find_or_create_and_lock_w_name (fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t src,
|
||||
const u8 *name)
|
||||
{
|
||||
return (mfib_table_find_or_create_and_lock_i(proto, table_id,
|
||||
src, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Table flush context. Store the indicies of matching FIB entries
|
||||
* that need to be removed.
|
||||
|
||||
@@ -322,6 +322,31 @@ extern u32 mfib_table_find_or_create_and_lock(fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t source);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
* Get the index of the FIB for a Table-ID. This DOES create the
|
||||
* FIB if it does not exist.
|
||||
*
|
||||
* @paran proto
|
||||
* The protocol of the FIB (and thus the entries therein)
|
||||
*
|
||||
* @param table-id
|
||||
* The Table-ID
|
||||
*
|
||||
* @return fib_index
|
||||
* The index of the FIB
|
||||
*
|
||||
* @param source
|
||||
* The ID of the client/source.
|
||||
*
|
||||
* @param name
|
||||
* The client is choosing the name they want the table to have
|
||||
*/
|
||||
extern u32 mfib_table_find_or_create_and_lock_w_name(fib_protocol_t proto,
|
||||
u32 table_id,
|
||||
mfib_source_t source,
|
||||
const u8 *name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
||||
@@ -1114,7 +1114,7 @@ mfib_test_i (fib_protocol_t PROTO,
|
||||
/*
|
||||
* MPLS enable an interface so we get the MPLS table created
|
||||
*/
|
||||
mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API);
|
||||
mpls_table_create(MPLS_FIB_DEFAULT_TABLE_ID, FIB_SOURCE_API, NULL);
|
||||
mpls_sw_interface_enable_disable(&mpls_main,
|
||||
tm->hw[0]->sw_if_index,
|
||||
1, 0);
|
||||
|
||||
@@ -141,6 +141,9 @@ manual_endian manual_print define mpls_tunnel_details
|
||||
@param context - sender context, to match reply w/ request
|
||||
@param mt_table_id - The MPLS table-id the route is added in
|
||||
@param mt_is_add - Is this a route add or delete
|
||||
@param mt_name - A client provided name/tag for the table. If this
|
||||
is not set by the client, then VPP will generate
|
||||
something meaningfull.
|
||||
*/
|
||||
autoreply define mpls_table_add_del
|
||||
{
|
||||
@@ -148,6 +151,7 @@ autoreply define mpls_table_add_del
|
||||
u32 context;
|
||||
u32 mt_table_id;
|
||||
u8 mt_is_add;
|
||||
u8 mt_name[64];
|
||||
};
|
||||
|
||||
/** \brief MPLS Route Add / del route
|
||||
@@ -227,6 +231,7 @@ manual_endian manual_print define mpls_fib_details
|
||||
{
|
||||
u32 context;
|
||||
u32 table_id;
|
||||
u8 table_name[64];
|
||||
u8 eos_bit;
|
||||
u32 label;
|
||||
u32 count;
|
||||
|
||||
@@ -544,6 +544,7 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
|
||||
unformat_input_t _line_input, *line_input = &_line_input;
|
||||
clib_error_t *error = NULL;
|
||||
u32 table_id, is_add;
|
||||
u8 *name = NULL;
|
||||
|
||||
is_add = 1;
|
||||
table_id = ~0;
|
||||
@@ -560,6 +561,8 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
|
||||
is_add = 0;
|
||||
else if (unformat (line_input, "add"))
|
||||
is_add = 1;
|
||||
else if (unformat (line_input, "name %s", &name))
|
||||
;
|
||||
else
|
||||
{
|
||||
error = unformat_parse_error (line_input);
|
||||
@@ -581,7 +584,7 @@ vnet_mpls_table_cmd (vlib_main_t * vm,
|
||||
{
|
||||
if (is_add)
|
||||
{
|
||||
mpls_table_create (table_id, 0);
|
||||
mpls_table_create (table_id, 0, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
#include <vnet/fib/fib_node.h>
|
||||
#include <vnet/adj/adj.h>
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
#define mpls_error(n,s) MPLS_ERROR_##n,
|
||||
#include <vnet/mpls/error.def>
|
||||
#undef mpls_error
|
||||
@@ -34,10 +35,11 @@ typedef enum {
|
||||
* @brief Definition of a callback for receiving MPLS interface state change
|
||||
* notifications
|
||||
*/
|
||||
typedef void (*mpls_interface_state_change_callback_t)(u32 sw_if_index,
|
||||
u32 is_enable);
|
||||
typedef void (*mpls_interface_state_change_callback_t) (u32 sw_if_index,
|
||||
u32 is_enable);
|
||||
|
||||
typedef struct {
|
||||
typedef struct
|
||||
{
|
||||
/* MPLS FIB index for each software interface */
|
||||
u32 *fib_index_by_sw_if_index;
|
||||
|
||||
@@ -55,12 +57,12 @@ typedef struct {
|
||||
u8 output_feature_arc_index;
|
||||
|
||||
/* IP4 enabled count by software interface */
|
||||
u8 * mpls_enabled_by_sw_if_index;
|
||||
u8 *mpls_enabled_by_sw_if_index;
|
||||
} mpls_main_t;
|
||||
|
||||
extern mpls_main_t mpls_main;
|
||||
|
||||
extern clib_error_t * mpls_feature_init(vlib_main_t * vm);
|
||||
extern clib_error_t *mpls_feature_init (vlib_main_t * vm);
|
||||
|
||||
format_function_t format_mpls_eos_bit;
|
||||
format_function_t format_mpls_unicast_header_net_byte_order;
|
||||
@@ -81,24 +83,28 @@ unformat_function_t unformat_mpls_header;
|
||||
unformat_function_t unformat_pg_mpls_header;
|
||||
|
||||
int mpls_sw_interface_enable_disable (mpls_main_t * mm,
|
||||
u32 sw_if_index,
|
||||
u8 is_enable,
|
||||
u8 is_api);
|
||||
u32 sw_if_index,
|
||||
u8 is_enable, u8 is_api);
|
||||
|
||||
u8 mpls_sw_interface_is_enabled (u32 sw_if_index);
|
||||
|
||||
int mpls_fib_reset_labels (u32 fib_id);
|
||||
|
||||
int
|
||||
mpls_dest_cmp(void * a1, void * a2);
|
||||
int mpls_dest_cmp (void *a1, void *a2);
|
||||
|
||||
int
|
||||
mpls_fib_index_cmp(void * a1, void * a2);
|
||||
int mpls_fib_index_cmp (void *a1, void *a2);
|
||||
|
||||
int
|
||||
mpls_label_cmp(void * a1, void * a2);
|
||||
int mpls_label_cmp (void *a1, void *a2);
|
||||
|
||||
void mpls_table_create(u32 table_id, u8 is_api);
|
||||
void mpls_table_delete(u32 table_id, u8 is_api);
|
||||
void mpls_table_create (u32 table_id, u8 is_api, const u8 * name);
|
||||
void mpls_table_delete (u32 table_id, u8 is_api);
|
||||
|
||||
#endif /* included_vnet_mpls_h */
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
||||
|
||||
@@ -92,7 +92,7 @@ vl_api_mpls_table_add_del_t_handler (vl_api_mpls_table_add_del_t * mp)
|
||||
vnm->api_errno = 0;
|
||||
|
||||
if (mp->mt_is_add)
|
||||
mpls_table_create (ntohl (mp->mt_table_id), 1);
|
||||
mpls_table_create (ntohl (mp->mt_table_id), 1, mp->mt_name);
|
||||
else
|
||||
mpls_table_delete (ntohl (mp->mt_table_id), 1);
|
||||
|
||||
@@ -258,7 +258,7 @@ vl_api_mpls_route_add_del_t_handler (vl_api_mpls_route_add_del_t * mp)
|
||||
}
|
||||
|
||||
void
|
||||
mpls_table_create (u32 table_id, u8 is_api)
|
||||
mpls_table_create (u32 table_id, u8 is_api, const u8 * name)
|
||||
{
|
||||
u32 fib_index;
|
||||
|
||||
@@ -276,10 +276,11 @@ mpls_table_create (u32 table_id, u8 is_api)
|
||||
|
||||
if (~0 == fib_index)
|
||||
{
|
||||
fib_table_find_or_create_and_lock (FIB_PROTOCOL_MPLS,
|
||||
table_id,
|
||||
(is_api ?
|
||||
FIB_SOURCE_API : FIB_SOURCE_CLI));
|
||||
fib_table_find_or_create_and_lock_w_name (FIB_PROTOCOL_MPLS,
|
||||
table_id,
|
||||
(is_api ?
|
||||
FIB_SOURCE_API :
|
||||
FIB_SOURCE_CLI), name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -424,7 +425,8 @@ vl_api_mpls_tunnel_dump_t_handler (vl_api_mpls_tunnel_dump_t * mp)
|
||||
static void
|
||||
send_mpls_fib_details (vpe_api_main_t * am,
|
||||
unix_shared_memory_queue_t * q,
|
||||
u32 table_id, u32 label, u32 eos,
|
||||
const fib_table_t * table,
|
||||
u32 label, u32 eos,
|
||||
fib_route_path_encode_t * api_rpaths, u32 context)
|
||||
{
|
||||
vl_api_mpls_fib_details_t *mp;
|
||||
@@ -440,7 +442,9 @@ send_mpls_fib_details (vpe_api_main_t * am,
|
||||
mp->_vl_msg_id = ntohs (VL_API_MPLS_FIB_DETAILS);
|
||||
mp->context = context;
|
||||
|
||||
mp->table_id = htonl (table_id);
|
||||
mp->table_id = htonl (table->ft_table_id);
|
||||
memcpy (mp->table_name, table->ft_desc,
|
||||
clib_min (vec_len (table->ft_desc), sizeof (mp->table_name)));
|
||||
mp->eos_bit = eos;
|
||||
mp->label = htonl (label);
|
||||
|
||||
@@ -512,8 +516,8 @@ vl_api_mpls_fib_dump_t_handler (vl_api_mpls_fib_dump_t * mp)
|
||||
api_rpaths = NULL;
|
||||
fib_entry_encode (*lfeip, &api_rpaths);
|
||||
send_mpls_fib_details (am, q,
|
||||
fib_table->ft_table_id,
|
||||
pfx.fp_label, pfx.fp_eos, api_rpaths, mp->context);
|
||||
fib_table, pfx.fp_label,
|
||||
pfx.fp_eos, api_rpaths, mp->context);
|
||||
vec_free (api_rpaths);
|
||||
}
|
||||
|
||||
|
||||
@@ -316,10 +316,10 @@ class TestIP6VrfMultiInst(VppTestCase):
|
||||
vrf_exist = False
|
||||
vrf_count = 0
|
||||
for ip6_fib_details in ip6_fib_dump:
|
||||
if ip6_fib_details[2] == vrf_id:
|
||||
if ip6_fib_details.table_id == vrf_id:
|
||||
if not vrf_exist:
|
||||
vrf_exist = True
|
||||
addr = inet_ntop(socket.AF_INET6, ip6_fib_details[4])
|
||||
addr = inet_ntop(socket.AF_INET6, ip6_fib_details.address)
|
||||
addrtype = in6_getAddrType(addr)
|
||||
vrf_count += 1 if addrtype == IPV6_ADDR_UNICAST else 0
|
||||
if not vrf_exist and vrf_count == 0:
|
||||
|
||||
Reference in New Issue
Block a user