View Single Post
  #3  
Old 07-23-2019, 04:27 AM
Allan_D Allan_D is offline
Registered User
 
Join Date: Jul 2019
Posts: 3
Here is the script

The idea is i display routing instances , then using Get2() i copy the first column to an array.
Then i use a for loop. I list BGP peers for each routing instance and using Get() i grab the IP.
Then using the routing instance and peer IP i list routes sent/received.

The reason the strlines/vlines looks a mess is i tried to adapt the example from your guide to scripting , chapter 4.3


Code:
#$language = "VBScript"
#$interface = "1.0"

crt.Screen.Synchronous = True


Dim vWaitFors
'define array to contain ex instances - make it no larger than 150 , we dont expect more
'Dim strLines(150)
Dim vPeer


vWaitFors = Array("<redacted device name1><redacted device name2>")


' This script is very amateurish 

Sub Main
	crt.Screen.Send "screen-length disable" & chr(13)
	crt.Screen.WaitForStrings(vWaitFors)
	crt.Screen.Send "dis ip vpn | i ex" & chr(13)
	'assume capture starts at -68 row considering banners on idajump server and prompts while logging in before running script
	strLines = crt.Screen.Get2(-68,3, crt.Screen.Rows,10)
	vLines = Split(strLines, vbcrlf)
    For nIndex = 1 To UBound(vLines)
	crt.Screen.Send "dis bgp vpnv4 vpn & strLines(nIndex) & peer" & chr(13)
	'use get command to get peer
	vPeer = crt.Screen.Get(60,3,60,17) 
	'crt.Screen.Send "dis bgp vpnv4 vpn" & vLines & "routing-table peer" & vPeer & "received-routes " & chr(13)
	'crt.Screen.Send "dis bgp vpnv4 vpn" & vLines & "routing-table peer" & vPeer & "advertised-routes " & chr(13)
	
	crt.Screen.Send "dis bgp vpnv4 vpn "
	crt.Screen.Send vLines
	crt.Screen.Send " routing-table peer "
	crt.Screen.Send vPeer
	crt.Screen.Send " received-routes" 
	crt.Screen.Send chr(13)
	
	crt.Screen.Send "dis bgp vpnv4 vpn "
	crt.Screen.Send vLines
	crt.Screen.Send " routing-table peer "
	crt.Screen.Send vPeer
	crt.Screen.Send " advertised-routes" 
	crt.Screen.Send chr(13)
	
	
	
	next
	
    crt.Screen.WaitForStrings(vWaitFors)
	
	
End Sub
Reply With Quote