Skip to content

Commit

Permalink
Resolved rc!=0 problem by replacing fgrep with awk. Added ipv4 filter…
Browse files Browse the repository at this point in the history
…ing to get only v4 peers in case of show ip bgp neighbors
  • Loading branch information
saurabhab committed Mar 16, 2023
1 parent f0a9f4f commit 9d53b50
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,12 @@ save_bgp_neighbor() {
local timeout_cmd="timeout --foreground ${TIMEOUT_MIN}m"
local asic_id=${1:-""}
local ns=$(get_vtysh_namespace $asic_id)

neighbor_list_v4=$(${timeout_cmd} vtysh $ns -c "show ip bgp neighbors" | grep "BGP neighbor is" | awk -F '[, ]' '{print $4}')
neighbor_list_v4=$(${timeout_cmd} vtysh $ns -c "show ip bgp neighbors" | grep "BGP neighbor is" | awk -F '[, ]' '{print $4}' | awk /\\./)
for word in $neighbor_list_v4; do
save_cmd "vtysh $ns -c \"show ip bgp neighbors $word advertised-routes\"" "ip.bgp.neighbor.$word.adv$asic_id"
save_cmd "vtysh $ns -c \"show ip bgp neighbors $word routes\"" "ip.bgp.neighbor.$word.rcv$asic_id"
done
neighbor_list_v6=$(vtysh $ns -c "show bgp ipv6 neighbors" | grep "BGP neighbor is" | awk -F '[, ]' '{print $4}' | fgrep ':')
neighbor_list_v6=$(vtysh $ns -c "show bgp ipv6 neighbors" | grep "BGP neighbor is" | awk -F '[, ]' '{print $4}' | awk /:/)
for word in $neighbor_list_v6; do
save_cmd "vtysh $ns -c \"show bgp ipv6 neighbors $word advertised-routes\"" "ipv6.bgp.neighbor.$word.adv$asic_id"
save_cmd "vtysh $ns -c \"show bgp ipv6 neighbors $word routes\"" "ipv6.bgp.neighbor.$word.rcv$asic_id"
Expand Down

0 comments on commit 9d53b50

Please sign in to comment.