Package TestON :: Package drivers :: Package common :: Package cli :: Module remotesysdriver
[hide private]
[frames] | no frames]

Source Code for Module TestON.drivers.common.cli.remotesysdriver

 1  #!/usr/bin/env python 
 2  ''' 
 3  Created on 26-Oct-2012  
 4   
 5  @author: Anil Kumar (anilkumar.s@paxterrasolutions.com)       
 6  '''  
 7  import time 
 8  import pexpect 
 9  import struct, fcntl, os, sys, signal 
10  import sys 
11  sys.path.append("../") 
12  from drivers.common.clidriver import CLI 
13   
14 -class RemoteSysDriver(CLI):
15 # The common functions for emulator included in emulatordriver
16 - def __init__(self):
17 super(CLI, self).__init__()
18
19 - def connect(self,**connectargs):
20 for key in connectargs: 21 vars(self)[key] = connectargs[key] 22 23 self.name = self.options['name'] 24 25 self.handle = super(RemoteSysDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd) 26 if self.handle: 27 self.execute(cmd= "\r",prompt= "\$",timeout= 10) 28 self.execute(cmd= "ssh vyatta@192.164.56.81",prompt= "word:",timeout= 10) 29 self.execute(cmd = "vyatta",prompt = "\$",timeout = 10) 30 self.execute(cmd = "reboot",prompt = "(.*)",timeout = 10) 31 32 #self.execute(cmd = "~.",prompt= ".*",timeout= 10) 33 return main.TRUE
34