Skip to content

Commit

Permalink
tools: add helper function to print family
Browse files Browse the repository at this point in the history
Ticket: #4127810
Testing:
2024-11-20T01:52:10.073 frr_zebra:netlink_neigh_update_msg_encode
{'mac': '00:00:00:00:00:00', 'ip': '27.0.0.4', 'nhg': 0, 'flags': 2,
'state': 192, 'family': 'bridge', 'type': 0, 'op': 23}

Signed-off-by: Chirag Shah <[email protected]>
  • Loading branch information
chiragshah6 committed Nov 21, 2024
1 parent 1635a26 commit 1ad2479
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tools/frr_babeltrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ def parse_event(event, field_parsers):
else:
field_info[field] = event.get(field)
print(event.name, field_info)

def print_family_str(field_val):
"""
pretty print kernel family to string
"""
if field_val == socket.AF_INET:
cmd_str = "ipv4"
elif field_val == socket.AF_INET6:
cmd_str = "ipv6"
elif field_val == socket.AF_BRIDGE:
cmd_str = "bridge"
elif field_val == 128: # RTNL_FAMILY_IPMR:
cmd_str = "ipv4MR"
elif field_val == 129: # RTNL_FAMILY_IP6MR:
cmd_str = "ipv6MR"
else:
cmd_str = "Invalid family"

return cmd_str


############################ common parsers - end #############################

############################ evpn parsers - start #############################
Expand Down

0 comments on commit 1ad2479

Please sign in to comment.