From d52e090a6a08b5cc1814174e0863536bd4090672 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Wed, 1 Oct 2008 11:44:33 -0700 Subject: Fix 2881: "show tech-support" should limit the output of "show ip route" --- functions/tech-support | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'functions') diff --git a/functions/tech-support b/functions/tech-support index 6974392..ffd01ff 100755 --- a/functions/tech-support +++ b/functions/tech-support @@ -161,8 +161,39 @@ sudo /sbin/iptables -t mangle -L -vn header \''iptables -t raw -L -vn'\' sudo /sbin/iptables -t raw -L -vn -header \''show ip route'\' -show ip route +function show_route_limit () +{ + NUM=$(show $1 route $2 | wc -l) + # subtract 3 lines of header + [ $NUM -gt 3 ] && NUM=$[$NUM - 3] + OUTPUT=$(echo show $1 route $2 \(total $NUM\)) + CMD="show $1 route $2" + if [ $3 -eq 0 ] + then + header $OUTPUT + vtysh -c "$CMD" + else + header "$OUTPUT- limit $3" + vtysh -c "$CMD" | head -n $3 + fi +} + +# +# show all connected/static, limit the output others and include a total +# +show_route_limit ip connected 0 +show_route_limit ip static 0 +show_route_limit ip rip 500 +show_route_limit ip ospf 500 +show_route_limit ip bgp 500 +show_route_limit ip '' 500 + +show_route_limit ipv6 connected 0 +show_route_limit ipv6 static 0 +show_route_limit ipv6 ripng 500 +show_route_limit ipv6 ospf6 500 +show_route_limit ipv6 bgp 500 +show_route_limit ipv6 '' 500 header $HOME/.bash_history cat $HOME/.bash_history -- cgit v1.2.3