diff options
| -rw-r--r-- | bgpd/bgp_evpn.c | 6 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_mh.c | 15 | ||||
| -rw-r--r-- | bgpd/bgp_evpn_mh.h | 2 | ||||
| -rw-r--r-- | bgpd/bgp_trace.h | 91 | ||||
| -rw-r--r-- | bgpd/bgpd.c | 3 | ||||
| -rw-r--r-- | doc/user/bgp.rst | 6 | ||||
| -rw-r--r-- | doc/user/ospfd.rst | 11 | ||||
| -rw-r--r-- | isisd/isis_cli.c | 9 | ||||
| -rw-r--r-- | isisd/isis_redist.c | 10 | ||||
| -rw-r--r-- | isisd/isisd.h | 8 | ||||
| -rw-r--r-- | lib/command_graph.h | 4 | ||||
| -rw-r--r-- | ospf6d/ospf6_flood.c | 1 | ||||
| -rw-r--r-- | ospf6d/ospf6_nssa.c | 16 | ||||
| -rw-r--r-- | python/clidef.py | 2 | ||||
| -rwxr-xr-x | tools/frr_babeltrace.py | 163 | ||||
| -rw-r--r-- | zebra/zebra_vty.c | 1 |
16 files changed, 316 insertions, 32 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 3219ae13b5..ea54c14222 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -54,6 +54,7 @@ #include "bgpd/bgp_mac.h" #include "bgpd/bgp_vty.h" #include "bgpd/bgp_nht.h" +#include "bgpd/bgp_trace.h" /* * Definitions and external declarations. @@ -653,6 +654,9 @@ static int bgp_zebra_send_remote_macip(struct bgp *bgp, struct bgpevpn *vpn, &p->prefix.macip_addr.mac, &p->prefix.macip_addr.ip, flags, seq, &remote_vtep_ip); + frrtrace(5, frr_bgp, evpn_mac_ip_zsend, add, vpn, p, remote_vtep_ip, + esi); + return zclient_send_message(zclient); } @@ -703,6 +707,8 @@ static int bgp_zebra_send_remote_vtep(struct bgp *bgp, struct bgpevpn *vpn, add ? "ADD" : "DEL", vpn->vni, &p->prefix.imet_addr.ip.ipaddr_v4); + frrtrace(3, frr_bgp, evpn_bum_vtep_zsend, add, vpn, p); + return zclient_send_message(zclient); } diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index 34094a0bde..9316d218a2 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -50,6 +50,7 @@ #include "bgpd/bgp_label.h" #include "bgpd/bgp_nht.h" #include "bgpd/bgp_mpath.h" +#include "bgpd/bgp_trace.h" static void bgp_evpn_local_es_down(struct bgp *bgp, struct bgp_evpn_es *es); @@ -1225,6 +1226,8 @@ static struct bgp_evpn_es_vtep *bgp_evpn_es_vtep_new(struct bgp_evpn_es *es, es_vtep->es = es; es_vtep->vtep_ip.s_addr = vtep_ip.s_addr; + inet_ntop(AF_INET, &es_vtep->vtep_ip, es_vtep->vtep_str, + sizeof(es_vtep->vtep_str)); listnode_init(&es_vtep->es_listnode, es_vtep); listnode_add_sort(es->es_vtep_list, &es_vtep->es_listnode); @@ -1301,6 +1304,8 @@ static int bgp_zebra_send_remote_es_vtep(struct bgp *bgp, zlog_debug("Tx %s Remote ESI %s VTEP %pI4", add ? "ADD" : "DEL", es->esi_str, &es_vtep->vtep_ip); + frrtrace(3, frr_bgp, evpn_mh_vtep_zsend, add, es, es_vtep); + return zclient_send_message(zclient); } @@ -2522,6 +2527,8 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, es_vrf->bgp_vrf->vrf_id, v4_nhg ? "v4_nhg" : "v6_nhg", nhg_id); + frrtrace(4, frr_bgp, evpn_mh_nhg_zsend, true, v4_nhg, nhg_id, es_vrf); + /* only the gateway ip changes for each NH. rest of the params * are constant */ @@ -2558,6 +2565,8 @@ static void bgp_evpn_l3nhg_zebra_add_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, zlog_debug("nhg %u vtep %pI4 l3-svi %d", api_nhg.id, &es_vtep->vtep_ip, es_vrf->bgp_vrf->l3vni_svi_ifindex); + + frrtrace(3, frr_bgp, evpn_mh_nh_zsend, nhg_id, es_vtep, es_vrf); } if (!api_nhg.nexthop_num) @@ -2603,6 +2612,10 @@ static void bgp_evpn_l3nhg_zebra_del_v4_or_v6(struct bgp_evpn_es_vrf *es_vrf, es_vrf->es->esi_str, es_vrf->bgp_vrf->vrf_id, v4_nhg ? "v4_nhg" : "v6_nhg", api_nhg.id); + + frrtrace(4, frr_bgp, evpn_mh_nhg_zsend, false, v4_nhg, api_nhg.id, + es_vrf); + zclient_nhg_send(zclient, ZEBRA_NHG_DEL, &api_nhg); } @@ -4202,6 +4215,8 @@ static void bgp_evpn_nh_zebra_update_send(struct bgp_evpn_nh *nh, bool add) nh->bgp_vrf->name, nh->nh_str); } + frrtrace(2, frr_bgp, evpn_mh_nh_rmac_zsend, add, nh); + zclient_send_message(zclient); } diff --git a/bgpd/bgp_evpn_mh.h b/bgpd/bgp_evpn_mh.h index 22a4215664..37a46c2f0e 100644 --- a/bgpd/bgp_evpn_mh.h +++ b/bgpd/bgp_evpn_mh.h @@ -145,6 +145,8 @@ struct bgp_evpn_es_vtep { struct bgp_evpn_es *es; /* parent ES */ struct in_addr vtep_ip; + char vtep_str[INET6_ADDRSTRLEN]; + uint32_t flags; /* Rxed a Type4 route from this PE */ #define BGP_EVPNES_VTEP_ESR (1 << 0) diff --git a/bgpd/bgp_trace.h b/bgpd/bgp_trace.h index 303e06c9c9..91a190722b 100644 --- a/bgpd/bgp_trace.h +++ b/bgpd/bgp_trace.h @@ -34,7 +34,11 @@ #include <lttng/tracepoint.h> #include "bgpd/bgpd.h" +#include "bgpd/bgp_attr.h" #include "lib/stream.h" +#include "bgpd/bgp_evpn_private.h" +#include "bgpd/bgp_evpn_mh.h" + /* clang-format off */ @@ -243,6 +247,93 @@ TRACEPOINT_EVENT( ) TRACEPOINT_LOGLEVEL(frr_bgp, bgp_dest_unlock, TRACE_INFO) +TRACEPOINT_EVENT( + frr_bgp, + evpn_mac_ip_zsend, + TP_ARGS(int, add, struct bgpevpn *, vpn, + const struct prefix_evpn *, pfx, + struct in_addr, vtep, esi_t *, esi), + TP_FIELDS( + ctf_string(action, add ? "add" : "del") + ctf_integer(vni_t, vni, vpn->vni) + ctf_array(unsigned char, mac, &pfx->prefix.macip_addr.mac, + sizeof(struct ethaddr)) + ctf_array(unsigned char, ip, &pfx->prefix.macip_addr.ip, + sizeof(struct ipaddr)) + ctf_integer_network_hex(unsigned int, vtep, vtep.s_addr) + ctf_array(unsigned char, esi, esi, sizeof(esi_t)) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_mac_ip_zsend, TRACE_INFO) + +TRACEPOINT_EVENT( + frr_bgp, + evpn_bum_vtep_zsend, + TP_ARGS(int, add, struct bgpevpn *, vpn, + const struct prefix_evpn *, pfx), + TP_FIELDS( + ctf_string(action, add ? "add" : "del") + ctf_integer(vni_t, vni, vpn->vni) + ctf_integer_network_hex(unsigned int, vtep, + pfx->prefix.imet_addr.ip.ipaddr_v4.s_addr) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_bum_vtep_zsend, TRACE_INFO) + +TRACEPOINT_EVENT( + frr_bgp, + evpn_mh_vtep_zsend, + TP_ARGS(bool, add, struct bgp_evpn_es *, es, + struct bgp_evpn_es_vtep *, es_vtep), + TP_FIELDS( + ctf_string(action, add ? "add" : "del") + ctf_string(esi, es->esi_str) + ctf_string(vtep, es_vtep->vtep_str) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_mh_vtep_zsend, TRACE_INFO) + +TRACEPOINT_EVENT( + frr_bgp, + evpn_mh_nhg_zsend, + TP_ARGS(bool, add, bool, type_v4, uint32_t, nhg_id, + struct bgp_evpn_es_vrf *, es_vrf), + TP_FIELDS( + ctf_string(action, add ? "add" : "del") + ctf_string(type, type_v4 ? "v4" : "v6") + ctf_integer(unsigned int, nhg, nhg_id) + ctf_string(esi, es_vrf->es->esi_str) + ctf_integer(int, vrf, es_vrf->bgp_vrf->vrf_id) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_mh_nhg_zsend, TRACE_INFO) + +TRACEPOINT_EVENT( + frr_bgp, + evpn_mh_nh_zsend, + TP_ARGS(uint32_t, nhg_id, struct bgp_evpn_es_vtep *, vtep, + struct bgp_evpn_es_vrf *, es_vrf), + TP_FIELDS( + ctf_integer(unsigned int, nhg, nhg_id) + ctf_string(vtep, vtep->vtep_str) + ctf_integer(int, svi, es_vrf->bgp_vrf->l3vni_svi_ifindex) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_mh_nh_zsend, TRACE_INFO) + +TRACEPOINT_EVENT( + frr_bgp, + evpn_mh_nh_rmac_zsend, + TP_ARGS(bool, add, struct bgp_evpn_nh *, nh), + TP_FIELDS( + ctf_string(action, add ? "add" : "del") + ctf_integer(int, vrf, nh->bgp_vrf->vrf_id) + ctf_string(nh, nh->nh_str) + ctf_array(unsigned char, rmac, &nh->rmac, + sizeof(struct ethaddr)) + ) +) +TRACEPOINT_LOGLEVEL(frr_bgp, evpn_nh_rmac_zsend, TRACE_INFO) /* clang-format on */ #include <lttng/tracepoint-event.h> diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index ec91e7e229..925af80cb7 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -6266,7 +6266,8 @@ static void peer_distribute_update(struct access_list *access) for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp)) { if (access->name) - update_group_policy_update(bgp, BGP_POLICY_FILTER_LIST, + update_group_policy_update(bgp, + BGP_POLICY_DISTRIBUTE_LIST, access->name, 0, 0); for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { FOREACH_AFI_SAFI (afi, safi) { diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst index 5c9d96e32b..d37c2b6682 100644 --- a/doc/user/bgp.rst +++ b/doc/user/bgp.rst @@ -2145,7 +2145,7 @@ Numbered Community Lists When number is used for BGP community list name, the number has special meanings. Community list number in the range from 1 and 99 is standard community list. Community list number in the range from 100 -to 199 is expanded community list. These community lists are called +to 500 is expanded community list. These community lists are called as numbered community lists. On the other hand normal community lists is called as named community lists. @@ -2154,10 +2154,10 @@ is called as named community lists. This command defines a new community list. The argument to (1-99) defines the list identifier. -.. clicmd:: bgp community-list (100-199) permit|deny COMMUNITY +.. clicmd:: bgp community-list (100-500) permit|deny COMMUNITY This command defines a new expanded community list. The argument to - (100-199) defines the list identifier. + (100-500) defines the list identifier. .. _bgp-community-alias: diff --git a/doc/user/ospfd.rst b/doc/user/ospfd.rst index 0122e2ac75..26675c27fd 100644 --- a/doc/user/ospfd.rst +++ b/doc/user/ospfd.rst @@ -691,13 +691,12 @@ Redistribution the 'always' keyword is given then the default is always advertised, even when there is no default present in the routing table. -.. clicmd:: distribute-list NAME out (kernel|connected|static|rip|ospf - - .. _ospf-distribute-list: +.. clicmd:: distribute-list NAME out <kernel|connected|static|rip|isis|bgp|eigrp|nhrp|table|vnc|babel|openfabric> + Apply the access-list filter, NAME, to redistributed routes of the given - type before allowing the routes to redistributed into OSPF + type before allowing the routes to be redistributed into OSPF (:ref:`ospf redistribution <ospf-redistribute>`). .. clicmd:: default-metric (0-16777214) @@ -954,8 +953,6 @@ Router Information Show Router Capabilities PCE parameters. -.. _debugging-ospf: - Segment Routing =============== @@ -1042,6 +1039,8 @@ TI-LFA requires a proper Segment Routing configuration. Note that so far only P2P interfaces are supported. +.. _debugging-ospf: + Debugging OSPF ============== diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index 70ec66fd7f..f48b142b1a 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1330,11 +1330,14 @@ void cli_show_isis_def_origin_ipv6(struct vty *vty, struct lyd_node *dnode, * XPath: /frr-isisd:isis/instance/redistribute */ DEFPY_YANG(isis_redistribute, isis_redistribute_cmd, - "[no] redistribute <ipv4|ipv6>$ip " PROTO_REDIST_STR - "$proto <level-1|level-2>$level [{metric (0-16777215)|route-map WORD}]", + "[no] redistribute <ipv4$ip " PROTO_IP_REDIST_STR "$proto|ipv6$ip " + PROTO_IP6_REDIST_STR "$proto> <level-1|level-2>$level" + "[{metric (0-16777215)|route-map WORD}]", NO_STR REDIST_STR "Redistribute IPv4 routes\n" - "Redistribute IPv6 routes\n" PROTO_REDIST_HELP + PROTO_IP_REDIST_HELP + "Redistribute IPv6 routes\n" + PROTO_IP6_REDIST_HELP "Redistribute into level-1\n" "Redistribute into level-2\n" "Metric for redistributed routes\n" diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c index 2f5e490da1..45d69bc352 100644 --- a/isisd/isis_redist.c +++ b/isisd/isis_redist.c @@ -543,12 +543,13 @@ void isis_redist_area_finish(struct isis_area *area) #ifdef FABRICD DEFUN (isis_redistribute, isis_redistribute_cmd, - "redistribute <ipv4|ipv6> " PROTO_REDIST_STR + "redistribute <ipv4 " PROTO_IP_REDIST_STR "|ipv6 " PROTO_IP6_REDIST_STR ">" " [{metric (0-16777215)|route-map WORD}]", REDIST_STR "Redistribute IPv4 routes\n" + PROTO_IP_REDIST_HELP "Redistribute IPv6 routes\n" - PROTO_REDIST_HELP + PROTO_IP6_REDIST_HELP "Metric for redistributed routes\n" "ISIS default metric\n" "Route map reference\n" @@ -599,12 +600,13 @@ DEFUN (isis_redistribute, DEFUN (no_isis_redistribute, no_isis_redistribute_cmd, - "no redistribute <ipv4|ipv6> " PROTO_REDIST_STR, + "no redistribute <ipv4 " PROTO_IP_REDIST_STR "|ipv6 " PROTO_IP6_REDIST_STR ">", NO_STR REDIST_STR "Redistribute IPv4 routes\n" + PROTO_IP_REDIST_HELP "Redistribute IPv6 routes\n" - PROTO_REDIST_HELP) + PROTO_IP6_REDIST_HELP) { int idx_afi = 2; int idx_protocol = 3; diff --git a/isisd/isisd.h b/isisd/isisd.h index 64fbf78a07..13f3475b70 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -46,7 +46,11 @@ static const bool fabricd = true; #define PROTO_NAME "openfabric" #define PROTO_HELP "OpenFabric routing protocol\n" #define PROTO_REDIST_STR FRR_REDIST_STR_FABRICD +#define PROTO_IP_REDIST_STR FRR_IP_REDIST_STR_FABRICD +#define PROTO_IP6_REDIST_STR FRR_IP6_REDIST_STR_FABRICD #define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_FABRICD +#define PROTO_IP_REDIST_HELP FRR_IP_REDIST_HELP_STR_FABRICD +#define PROTO_IP6_REDIST_HELP FRR_IP6_REDIST_HELP_STR_FABRICD #define ROUTER_NODE OPENFABRIC_NODE #else static const bool fabricd = false; @@ -54,7 +58,11 @@ static const bool fabricd = false; #define PROTO_NAME "isis" #define PROTO_HELP "IS-IS routing protocol\n" #define PROTO_REDIST_STR FRR_REDIST_STR_ISISD +#define PROTO_IP_REDIST_STR FRR_IP_REDIST_STR_ISISD +#define PROTO_IP6_REDIST_STR FRR_IP6_REDIST_STR_ISISD #define PROTO_REDIST_HELP FRR_REDIST_HELP_STR_ISISD +#define PROTO_IP_REDIST_HELP FRR_IP_REDIST_HELP_STR_ISISD +#define PROTO_IP6_REDIST_HELP FRR_IP6_REDIST_HELP_STR_ISISD #define ROUTER_NODE ISIS_NODE extern void isis_cli_init(void); #endif diff --git a/lib/command_graph.h b/lib/command_graph.h index c20c9874c2..86157f872e 100644 --- a/lib/command_graph.h +++ b/lib/command_graph.h @@ -79,11 +79,11 @@ enum { CMD_ATTR_NORMAL, CMD_ATTR_YANG, }; -/* Comamand token struct. */ +/* Command token struct. */ struct cmd_token { enum cmd_token_type type; // token type uint8_t attr; // token attributes - bool allowrepeat; // matcher allowed to match token repetively? + bool allowrepeat; // matcher allowed to match token repetitively? uint32_t refcnt; char *text; // token text diff --git a/ospf6d/ospf6_flood.c b/ospf6d/ospf6_flood.c index 186eac35a5..3a242575cd 100644 --- a/ospf6d/ospf6_flood.c +++ b/ospf6d/ospf6_flood.c @@ -288,7 +288,6 @@ void ospf6_install_lsa(struct ospf6_lsa *lsa) monotime(&now); if (!OSPF6_LSA_IS_MAXAGE(lsa)) { - lsa->expire = NULL; thread_add_timer(master, ospf6_lsa_expire, lsa, OSPF_LSA_MAXAGE + lsa->birth.tv_sec - now.tv_sec, diff --git a/ospf6d/ospf6_nssa.c b/ospf6d/ospf6_nssa.c index 2339d339f7..809768fb5c 100644 --- a/ospf6d/ospf6_nssa.c +++ b/ospf6d/ospf6_nssa.c @@ -304,24 +304,16 @@ void ospf6_abr_remove_unapproved_summaries(struct ospf6 *ospf6) type = htons(OSPF6_LSTYPE_INTER_ROUTER); for (ALL_LSDB_TYPED_ADVRTR(area->lsdb, type, ospf6->router_id, lsa)) { - if (CHECK_FLAG(lsa->flag, OSPF6_LSA_UNAPPROVED)) { - lsa->header->age = htons(OSPF_LSA_MAXAGE); - THREAD_OFF(lsa->refresh); - thread_execute(master, ospf6_lsa_expire, lsa, - 0); - } + if (CHECK_FLAG(lsa->flag, OSPF6_LSA_UNAPPROVED)) + ospf6_lsa_premature_aging(lsa); } /* Inter area prefix LSA */ type = htons(OSPF6_LSTYPE_INTER_PREFIX); for (ALL_LSDB_TYPED_ADVRTR(area->lsdb, type, ospf6->router_id, lsa)) { - if (CHECK_FLAG(lsa->flag, OSPF6_LSA_UNAPPROVED)) { - lsa->header->age = htons(OSPF_LSA_MAXAGE); - THREAD_OFF(lsa->refresh); - thread_execute(master, ospf6_lsa_expire, lsa, - 0); - } + if (CHECK_FLAG(lsa->flag, OSPF6_LSA_UNAPPROVED)) + ospf6_lsa_premature_aging(lsa); } } diff --git a/python/clidef.py b/python/clidef.py index a47cee2d6b..ba7c9072c5 100644 --- a/python/clidef.py +++ b/python/clidef.py @@ -435,6 +435,8 @@ if __name__ == "__main__": macros.load(os.path.join(basepath, "bgpd/bgp_vty.h")) # sigh :( macros["PROTO_REDIST_STR"] = "FRR_REDIST_STR_ISISD" + macros["PROTO_IP_REDIST_STR"] = "FRR_IP_REDIST_STR_ISISD" + macros["PROTO_IP6_REDIST_STR"] = "FRR_IP6_REDIST_STR_ISISD" errors = process_file(args.cfile, ofd, dumpfd, args.all_defun, macros) if errors != 0: diff --git a/tools/frr_babeltrace.py b/tools/frr_babeltrace.py new file mode 100755 index 0000000000..3058395758 --- /dev/null +++ b/tools/frr_babeltrace.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python3 +''' +Usage: frr_babeltrace.py trace_path + +FRR pushes data into lttng tracepoints in the least overhead way possible +i.e. as binary-data/crf_arrays. These traces need to be converted into pretty +strings for easy greping etc. This script is a babeltrace python plugin for +that pretty printing. + +Copyright (C) 2021 NVIDIA Corporation +Anuradha Karuppiah + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along +with this program; see the file COPYING; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +''' + +import ipaddress +import socket +import sys + +import babeltrace + +########################### common parsers - start ############################ +def print_ip_addr(field_val): + ''' + pretty print "struct ipaddr" + ''' + if field_val[0] == socket.AF_INET: + addr = [str(fv) for fv in field_val[4:8]] + return str(ipaddress.IPv4Address('.'.join(addr))) + + if field_val[0] == socket.AF_INET6: + tmp = ''.join('%02x' % fb for fb in field_val[4:]) + addr = [] + while tmp: + addr.append(tmp[:4]) + tmp = tmp[4:] + addr = ':'.join(addr) + return str(ipaddress.IPv6Address(addr)) + + if not field_val[0]: + return '' + + return field_val + + +def print_mac(field_val): + ''' + pretty print "u8 mac[6]" + ''' + return ':'.join('%02x' % fb for fb in field_val) + +def print_net_ipv4_addr(field_val): + ''' + pretty print ctf_integer_network ipv4 + ''' + return str(ipaddress.IPv4Address(field_val)) + +def print_esi(field_val): + ''' + pretty print ethernet segment id, esi_t + ''' + return ':'.join('%02x' % fb for fb in field_val) + +def get_field_list(event): + ''' + only fetch fields added via the TP, skip metadata etc. + ''' + return event.field_list_with_scope(babeltrace.CTFScope.EVENT_FIELDS) + +def parse_event(event, field_parsers): + ''' + Wild card event parser; doesn't make things any prettier + ''' + field_list = get_field_list(event) + field_info = {} + for field in field_list: + if field in field_parsers: + field_parser = field_parsers.get(field) + field_info[field] = field_parser(event.get(field)) + else: + field_info[field] = event.get(field) + print(event.name, field_info) +############################ common parsers - end ############################# + +############################ evpn parsers - start ############################# +def parse_frr_bgp_evpn_mac_ip_zsend(event): + ''' + bgp evpn mac-ip parser; raw format - + ctf_array(unsigned char, mac, &pfx->prefix.macip_addr.mac, + sizeof(struct ethaddr)) + ctf_array(unsigned char, ip, &pfx->prefix.macip_addr.ip, + sizeof(struct ipaddr)) + ctf_integer_network_hex(unsigned int, vtep, vtep.s_addr) + ctf_array(unsigned char, esi, esi, sizeof(esi_t)) + ''' + field_parsers = {'ip': print_ip_addr, + 'mac': print_mac, + 'esi': print_esi, + 'vtep': print_net_ipv4_addr} + + parse_event(event, field_parsers) + +def parse_frr_bgp_evpn_bum_vtep_zsend(event): + ''' + bgp evpn bum-vtep parser; raw format - + ctf_integer_network_hex(unsigned int, vtep, + pfx->prefix.imet_addr.ip.ipaddr_v4.s_addr) + + ''' + field_parsers = {'vtep': print_net_ipv4_addr} + + parse_event(event, field_parsers) + +def parse_frr_bgp_evpn_mh_nh_rmac_send(event): + ''' + bgp evpn nh-rmac parser; raw format - + ctf_array(unsigned char, rmac, &nh->rmac, sizeof(struct ethaddr)) + ''' + field_parsers = {'rmac': print_mac} + + parse_event(event, field_parsers) + +############################ evpn parsers - end ############################# + +def main(): + ''' + FRR lttng trace output parser; babel trace plugin + ''' + event_parsers = {'frr_bgp:evpn_mac_ip_zsend': + parse_frr_bgp_evpn_mac_ip_zsend, + 'frr_bgp:evpn_bum_vtep_zsend': + parse_frr_bgp_evpn_bum_vtep_zsend, + 'frr_bgp:evpn_mh_nh_rmac_zsend': + parse_frr_bgp_evpn_mh_nh_rmac_send} + + # get the trace path from the first command line argument + trace_path = sys.argv[1] + + # grab events + trace_collection = babeltrace.TraceCollection() + trace_collection.add_traces_recursive(trace_path, 'ctf') + + for event in trace_collection.events: + if event.name in event_parsers: + event_parser = event_parsers.get(event.name) + event_parser(event) + else: + parse_event(event, {}) + +if __name__ == '__main__': + main() diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 79087c5849..4b06e84788 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -965,6 +965,7 @@ static void vty_show_ip_route(struct vty *vty, struct route_node *rn, json_object_int_add(json_route, "internalNextHopActiveNum", nexthop_group_active_nexthop_num( &(re->nhe->nhg))); + json_object_int_add(json_route, "nexthopGroupId", re->nhe_id); json_object_string_add(json_route, "uptime", up_str); |
