mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
bgpd: Fix enum, use API for log string
Suggested-by: Philippe Guibert <philippe.guibert@6wind.com> Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
This commit is contained in:
parent
783e95b8e8
commit
b7d08f5ab5
@ -99,7 +99,7 @@ struct overlay_index {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum pta_type {
|
enum pta_type {
|
||||||
PMSI_TNLTYPE_NO_INFO,
|
PMSI_TNLTYPE_NO_INFO = 0,
|
||||||
PMSI_TNLTYPE_RSVP_TE_P2MP,
|
PMSI_TNLTYPE_RSVP_TE_P2MP,
|
||||||
PMSI_TNLTYPE_MLDP_P2MP,
|
PMSI_TNLTYPE_MLDP_P2MP,
|
||||||
PMSI_TNLTYPE_PIM_SSM,
|
PMSI_TNLTYPE_PIM_SSM,
|
||||||
|
@ -159,10 +159,6 @@ static const struct message bgp_notify_capability_msg[] = {
|
|||||||
/* Origin strings. */
|
/* Origin strings. */
|
||||||
const char *bgp_origin_str[] = {"i", "e", "?"};
|
const char *bgp_origin_str[] = {"i", "e", "?"};
|
||||||
const char *bgp_origin_long_str[] = {"IGP", "EGP", "incomplete"};
|
const char *bgp_origin_long_str[] = {"IGP", "EGP", "incomplete"};
|
||||||
const char *pmsi_tnltype_str[] = {"No info", "RSVP-TE P2MP", "mLDP P2MP",
|
|
||||||
"PIM-SSM", "PIM-SM", "PIM-BIDIR",
|
|
||||||
"Ingress Replication", "mLDP MP2MP"};
|
|
||||||
|
|
||||||
|
|
||||||
/* Given a string return a pointer the corresponding peer structure */
|
/* Given a string return a pointer the corresponding peer structure */
|
||||||
static struct peer *bgp_find_peer(struct vty *vty, const char *peer_str)
|
static struct peer *bgp_find_peer(struct vty *vty, const char *peer_str)
|
||||||
|
@ -82,6 +82,20 @@
|
|||||||
extern const char *bgp_origin_str[];
|
extern const char *bgp_origin_str[];
|
||||||
extern const char *bgp_origin_long_str[];
|
extern const char *bgp_origin_long_str[];
|
||||||
|
|
||||||
|
/* PMSI strings. */
|
||||||
|
#define PMSI_TNLTYPE_STR_NO_INFO "No info"
|
||||||
|
#define PMSI_TNLTYPE_STR_DEFAULT PMSI_TNLTYPE_STR_NO_INFO
|
||||||
|
static const struct message bgp_pmsi_tnltype_str[] = {
|
||||||
|
{PMSI_TNLTYPE_NO_INFO, PMSI_TNLTYPE_STR_NO_INFO},
|
||||||
|
{PMSI_TNLTYPE_RSVP_TE_P2MP, "RSVP-TE P2MP"},
|
||||||
|
{PMSI_TNLTYPE_MLDP_P2MP, "mLDP P2MP"},
|
||||||
|
{PMSI_TNLTYPE_PIM_SSM, "PIM-SSM"},
|
||||||
|
{PMSI_TNLTYPE_PIM_SM, "PIM-SM"},
|
||||||
|
{PMSI_TNLTYPE_PIM_BIDIR, "PIM-BIDIR"},
|
||||||
|
{PMSI_TNLTYPE_INGR_REPL, "Ingress Replication"},
|
||||||
|
{PMSI_TNLTYPE_MLDP_MP2MP, "mLDP MP2MP"},
|
||||||
|
{0}};
|
||||||
|
|
||||||
struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
|
struct bgp_node *bgp_afi_node_get(struct bgp_table *table, afi_t afi,
|
||||||
safi_t safi, struct prefix *p,
|
safi_t safi, struct prefix *p,
|
||||||
struct prefix_rd *prd)
|
struct prefix_rd *prd)
|
||||||
@ -7791,16 +7805,19 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
|
|||||||
|
|
||||||
/* Line 10 display PMSI tunnel attribute, if present */
|
/* Line 10 display PMSI tunnel attribute, if present */
|
||||||
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
|
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_PMSI_TUNNEL)) {
|
||||||
|
const char *str = lookup_msg(bgp_pmsi_tnltype_str,
|
||||||
|
attr->pmsi_tnl_type,
|
||||||
|
PMSI_TNLTYPE_STR_DEFAULT);
|
||||||
|
|
||||||
if (json_paths) {
|
if (json_paths) {
|
||||||
json_pmsi = json_object_new_object();
|
json_pmsi = json_object_new_object();
|
||||||
json_object_string_add(
|
json_object_string_add(json_pmsi,
|
||||||
json_pmsi, "tunnelType",
|
"tunnelType", str);
|
||||||
pmsi_tnltype_str[attr->pmsi_tnl_type]);
|
|
||||||
json_object_object_add(json_path, "pmsi",
|
json_object_object_add(json_path, "pmsi",
|
||||||
json_pmsi);
|
json_pmsi);
|
||||||
} else
|
} else
|
||||||
vty_out(vty, " PMSI Tunnel Type: %s\n",
|
vty_out(vty, " PMSI Tunnel Type: %s\n",
|
||||||
pmsi_tnltype_str[attr->pmsi_tnl_type]);
|
str);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user