From 6078935504c752afebefd8e570a6f29f6b05bcdb Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Sun, 2 Feb 2025 14:58:44 +0100 Subject: Various bird stuff (awk) --- other_scripts/bgpreport.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 other_scripts/bgpreport.sh (limited to 'other_scripts/bgpreport.sh') diff --git a/other_scripts/bgpreport.sh b/other_scripts/bgpreport.sh new file mode 100644 index 0000000..ae82b0c --- /dev/null +++ b/other_scripts/bgpreport.sh @@ -0,0 +1,19 @@ +#!/bin/bash +echo ""; + +/usr/sbin/birdcl -r s p | while read -r line; do + outp=$(echo "$line" | /usr/bin/awk -v print_info=0 -v pref='^p_' -f /root/bird2.awk) + if [[ -z "$outp" ]]; then + continue + fi + echo "$outp" + protocol=$(echo "$line" | awk -e '{ print $1; }') + outp=$(birdcl -r "show route where bgp_large_community ~ [(CLEARNET_ASN, LC_FILTERED, *)] protocol ${protocol} table t_myas_unfiltered count" | grep t_myas_unfiltered | grep -E -o "[1-9][0-9]* of [0-9]+ routes") + if [[ -n "$outp" ]]; then + echo "" + else + echo "" + fi +done + +echo "
Peertypestate
filtered ${outp}
no filtered routes
" -- cgit v1.2.3