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 (#2756)

Co-authored-by: Saurabh Ghorpade <saghorpa@cisco.com>
  • Loading branch information
saurabh17g and saurabhab authored Mar 27, 2023
1 parent 10f31ea commit 824680e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,12 @@ save_bgp_neighbor() {
local asic_id=${1:-""}
local ns=$(get_vtysh_namespace $asic_id)

neighbor_list_v4=$(${timeout_cmd} bash -c "vtysh $ns -c 'show ip bgp neighbors' | grep 'BGP neighbor is' | awk -F '[, ]' '{print \$4}'")
neighbor_list_v4=$(${timeout_cmd} bash -c "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=$(${timeout_cmd} bash -c "vtysh $ns -c 'show bgp ipv6 neighbors' | grep 'BGP neighbor is' | awk -F '[, ]' '{print \$4}' | fgrep ':'")
neighbor_list_v6=$(${timeout_cmd} bash -c "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 824680e

Please sign in to comment.