blob: 79fbf1c55a0d8f426849ad120df058cbf5c130e5 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
2'''
3Created on 26-Oct-2012
4
5@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
6
7 TestON is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 TestON is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with TestON. If not, see <http://www.gnu.org/licenses/>.
19
20
21'''
22import time
23import pexpect
24import struct, fcntl, os, sys, signal
25import sys
26sys.path.append("../")
27from drivers.common.clidriver import CLI
28
29class RemoteTestBedDriver(CLI):
30 # The common functions for emulator included in RemoteTestBedDriver
31 def __init__(self):
32 super(CLI, self).__init__()
33
34 def connect(self,**connectargs):
35 for key in connectargs:
36 vars(self)['vm_'+key] = connectargs[key]
37
38 remote_user_name = main.componentDictionary[self.name]['remote_user_name']
39 remote_ip_address = main.componentDictionary[self.name]['remote_ip_address']
40 remote_port = main.componentDictionary[self.name]['remote_port']
41 remote_pwd = main.componentDictionary[self.name]['remote_pwd']
42
43 self.handle = super(RemoteTestBedDriver,self).connect(user_name = remote_user_name,
44 ip_address = remote_ip_address,
45 port = remote_port, pwd = remote_pwd)
46
47 if self.handle:
Jon Hallf89c8552014-04-02 13:14:06 -070048 self.execute(cmd= "\n",prompt= "\$|>|#",timeout= 10)
adminbae64d82013-08-01 10:50:15 -070049 self.execute(cmd= "SET CYGWIN=notty",prompt= "\$|>|#",timeout= 10)
Jon Hallf89c8552014-04-02 13:14:06 -070050 self.execute(cmd= "\n",prompt= "\$|>|#",timeout= 10)
adminbae64d82013-08-01 10:50:15 -070051 main.log.info("ssh "+self.vm_user_name+'@'+self.vm_ip_address)
52 self.execute(cmd= "ssh "+self.vm_user_name+'@'+self.vm_ip_address,prompt= "(.*)",timeout= 10)
Jon Hallf89c8552014-04-02 13:14:06 -070053 self.execute(cmd= "\n",prompt= "assword:",timeout= 10)
adminbae64d82013-08-01 10:50:15 -070054 self.execute(cmd = self.vm_pwd,prompt = "\$",timeout = 10)
55
56 return self.handle
57 else :
58 return main.FALSE