diff options
author | Chirag Shah <chirag@nvidia.com> | 2024-11-25 17:58:25 +0100 |
---|---|---|
committer | Chirag Shah <chirag@nvidia.com> | 2024-11-25 18:00:03 +0100 |
commit | 814a89f6e51cdb27f695212774e711704b44f8cc (patch) | |
tree | bd70507613a9f056aa24930104ea5024caba4b1e /tools/frr_babeltrace.py | |
parent | tools: add helper function to print family (diff) | |
download | frr-814a89f6e51cdb27f695212774e711704b44f8cc.tar.xz frr-814a89f6e51cdb27f695212774e711704b44f8cc.zip |
tools: fix style check babletrace file
python3 -m black tools/frr_babeltrace.py
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Diffstat (limited to '')
-rwxr-xr-x | tools/frr_babeltrace.py | 54 |
1 files changed, 42 insertions, 12 deletions
diff --git a/tools/frr_babeltrace.py b/tools/frr_babeltrace.py index c3a22cd1e..7ace5d64b 100755 --- a/tools/frr_babeltrace.py +++ b/tools/frr_babeltrace.py @@ -18,6 +18,7 @@ import sys import babeltrace + ########################### common parsers - start ############################ def print_ip_addr(field_val): """ @@ -48,24 +49,28 @@ def print_mac(field_val): """ 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 @@ -103,6 +108,7 @@ def print_family_str(field_val): ############################ common parsers - end ############################# + ############################ evpn parsers - start ############################# def parse_frr_bgp_evpn_mac_ip_zsend(event): """ @@ -114,13 +120,16 @@ def parse_frr_bgp_evpn_mac_ip_zsend(event): 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} + 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 - @@ -132,6 +141,7 @@ def parse_frr_bgp_evpn_bum_vtep_zsend(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_nh_rmac_send(event): """ bgp evpn nh-rmac parser; raw format - @@ -141,17 +151,18 @@ def parse_frr_bgp_evpn_mh_nh_rmac_send(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_add_zrecv(event): """ bgp evpn local-es parser; raw format - ctf_array(unsigned char, esi, esi, sizeof(esi_t)) ctf_integer_network_hex(unsigned int, vtep, vtep.s_addr) """ - field_parsers = {"esi": print_esi, - "vtep": print_net_ipv4_addr} + field_parsers = {"esi": print_esi, "vtep": print_net_ipv4_addr} parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_del_zrecv(event): """ bgp evpn local-es parser; raw format - @@ -161,6 +172,7 @@ def parse_frr_bgp_evpn_mh_local_es_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_evi_add_zrecv(event): """ bgp evpn local-es-evi parser; raw format - @@ -170,6 +182,7 @@ def parse_frr_bgp_evpn_mh_local_es_evi_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_es_evi_del_zrecv(event): """ bgp evpn local-es-evi parser; raw format - @@ -179,6 +192,7 @@ def parse_frr_bgp_evpn_mh_local_es_evi_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_es_evi_vtep_add(event): """ bgp evpn remote ead evi remote vtep add; raw format - @@ -189,6 +203,7 @@ def parse_frr_bgp_evpn_mh_es_evi_vtep_add(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_es_evi_vtep_del(event): """ bgp evpn remote ead evi remote vtep del; raw format - @@ -199,6 +214,7 @@ def parse_frr_bgp_evpn_mh_es_evi_vtep_del(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_upd(event): """ bgp evpn local ead evi vtep; raw format - @@ -209,6 +225,7 @@ def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_upd(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_del(event): """ bgp evpn local ead evi vtep del; raw format - @@ -219,6 +236,7 @@ def parse_frr_bgp_evpn_mh_local_ead_es_evi_route_del(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_vni_add_zrecv(event): """ bgp evpn local-vni parser; raw format - @@ -230,6 +248,7 @@ def parse_frr_bgp_evpn_local_vni_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_l3vni_add_zrecv(event): """ bgp evpn local-l3vni parser; raw format - @@ -237,12 +256,15 @@ def parse_frr_bgp_evpn_local_l3vni_add_zrecv(event): ctf_array(unsigned char, svi_rmac, svi_rmac, sizeof(struct ethaddr)) ctf_array(unsigned char, vrr_rmac, vrr_rmac, sizeof(struct ethaddr)) """ - field_parsers = {"vtep": print_net_ipv4_addr, - "svi_rmac": print_mac, - "vrr_rmac": print_mac} + field_parsers = { + "vtep": print_net_ipv4_addr, + "svi_rmac": print_mac, + "vrr_rmac": print_mac, + } parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_macip_add_zrecv(event): """ bgp evpn local-mac-ip parser; raw format - @@ -256,6 +278,7 @@ def parse_frr_bgp_evpn_local_macip_add_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_local_macip_del_zrecv(event): """ bgp evpn local-mac-ip del parser; raw format - @@ -267,16 +290,20 @@ def parse_frr_bgp_evpn_local_macip_del_zrecv(event): parse_event(event, field_parsers) + def parse_frr_bgp_evpn_advertise_type5(event): """ local originated type-5 route """ - field_parsers = {"ip": print_ip_addr, - "rmac": print_mac, - "vtep": print_net_ipv4_addr} + field_parsers = { + "ip": print_ip_addr, + "rmac": print_mac, + "vtep": print_net_ipv4_addr, + } parse_event(event, field_parsers) + def parse_frr_bgp_evpn_withdraw_type5(event): """ local originated type-5 route withdraw @@ -285,8 +312,10 @@ def parse_frr_bgp_evpn_withdraw_type5(event): parse_event(event, field_parsers) + ############################ evpn parsers - end *############################# + def main(): """ FRR lttng trace output parser; babel trace plugin @@ -341,5 +370,6 @@ def main(): else: parse_event(event, {}) + if __name__ == "__main__": main() |