View Single Post
  #5  
Old 06-03-2020, 02:35 AM
Amr_Wael Amr_Wael is offline
Registered User
 
Join Date: Jun 2020
Posts: 4
Hi Brenda,

Please find the code below, for the snapshot I am not sure why I can't post attachments so I will be sending this via mail

Code:
tab = crt.Session.ConnectInTab('/ssh2 /L ' + username + ' /PASSWORD ' + password + ' IP.Address')

tab.Activate()
tab.Screen.Synchronous = True

tab.Caption = Device_name


tab.Screen.WaitForString("Nmstel password: ")
tab.Screen.Send(password + '\n')
tab.Screen.WaitForString("#")
tab.Screen.Send("ssh " + vedge_username + "@" + Device_name + '\n')
Row0 = tab.Screen.CurrentRow <<<<<<<<<<<<<<<< Last correctly counted Row
tab.Screen.Send('! current row is '+ str(Row0) +'\n')
tab.Screen.WaitForString("password: ", 30)
tab.Screen.Send(vedge_password + '\n')
tab.Screen.WaitForString("#", 30)
tab.Screen.Send('screen-length 0'+ '\n')
tab.Screen.WaitForString("#", 30)
tab.Screen.Send('screen-width 256'+ '\n')
tab.Screen.WaitForString("#", 30)

def main():

  tab.Session.Log(False)
  tab.Session.LogFileName = os.path.expanduser('~\\Desktop\\Vedge_ATP\\' + Device_name + "\\" + "case1" + ".txt")
  tab.Session.Log(True)
  tab.Screen.Send('show system status'+ '\n')
  tab.Screen.WaitForString("#", 30)
  tab.Screen.Send('show hardware alarms'+ '\n')
  tab.Screen.WaitForString("#", 30)
  tab.Screen.Send('show interface description'+ '\n')
  tab.Screen.WaitForString("#", 30)
  Row1 = tab.Screen.CurrentRow >>>>>> This row has a value of 58
  tab.Screen.Send('! current row is '+ str(Row1) +'\n')
  tab.Screen.Send('show interface ge0/1'+ '\n')             
  tab.Screen.WaitForString("#", 30)  
  Row2 = tab.Screen.CurrentRow >>>>>> This row as well has a value of 58
  tab.Screen.Send('! current row is '+ str(Row2) +'\n')
  DuplexRows =  Row2 - Row1
  tab.Screen.Send("!" + str(DuplexRows)+ '\n')
  tab.Screen.WaitForString("#", 30)
main ()
Reply With Quote