blob: a536e02b450af6e8ac958b86d277ba150c4fab56 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
kelvin-onlabbbe46482015-01-16 10:44:28 -08002"""
3Created on 26-Oct-2012
adminbae64d82013-08-01 10:50:15 -07004
kelvin-onlabbbe46482015-01-16 10:44:28 -08005author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
adminbae64d82013-08-01 10:50:15 -07006
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
kelvin-onlabbbe46482015-01-16 10:44:28 -080010 ( at your option ) any later version.
adminbae64d82013-08-01 10:50:15 -070011
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
kelvin-onlabbbe46482015-01-16 10:44:28 -080018 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070019
20
kelvin-onlabbbe46482015-01-16 10:44:28 -080021"""
adminbae64d82013-08-01 10:50:15 -070022import time
23import pexpect
kelvin-onlabbbe46482015-01-16 10:44:28 -080024import struct
25import fcntl
26import os
adminbae64d82013-08-01 10:50:15 -070027import sys
kelvin-onlabbbe46482015-01-16 10:44:28 -080028import signal
29import sys
30sys.path.append( "../" )
adminbae64d82013-08-01 10:50:15 -070031from drivers.common.clidriver import CLI
32
kelvin-onlabbbe46482015-01-16 10:44:28 -080033
34class RemoteSysDriver( CLI ):
adminbae64d82013-08-01 10:50:15 -070035 # The common functions for emulator included in emulatordriver
kelvin-onlabbbe46482015-01-16 10:44:28 -080036
37 def __init__( self ):
38 super( CLI, self ).__init__()
39
40 def connect( self, **connectargs ):
adminbae64d82013-08-01 10:50:15 -070041 for key in connectargs:
kelvin-onlabbbe46482015-01-16 10:44:28 -080042 vars( self )[ key ] = connectargs[ key ]
adminbae64d82013-08-01 10:50:15 -070043
kelvin-onlabbbe46482015-01-16 10:44:28 -080044 self.name = self.options[ 'name' ]
45
46 self.handle = super(
47 RemoteSysDriver,
48 self ).connect(
49 user_name=self.user_name,
50 ip_address=self.ip_address,
51 port=self.port,
52 pwd=self.pwd )
53 """
adminbae64d82013-08-01 10:50:15 -070054 if self.handle:
kelvin-onlabbbe46482015-01-16 10:44:28 -080055 self.execute( cmd= "\n",prompt= "\$|>|#",timeout= 10 )
56 self.execute( cmd= "ssh -l paxterra 10.128.4.1",prompt= "paxterra@10.128.4.1's password:",timeout= 10 )
57 self.execute( cmd= "\n",prompt= "paxterra@10.128.4.1's password:",timeout= 10 )
58 self.execute( cmd="0nLab_gu3st",prompt="\$",timeout=10 )
59 self.execute( cmd="cd TestON/bin/",prompt="\$",timeout=10 )
60 self.execute( cmd="./cli.py run Assert example 1",prompt="\$",timeout=10 )
61 self.execute( cmd= "\n",prompt= "$",timeout= 10 )
62 #self.execute( cmd="help",prompt=">",timeout=10 )
adminbae64d82013-08-01 10:50:15 -070063
kelvin-onlabbbe46482015-01-16 10:44:28 -080064 #self.execute( cmd="~.",prompt= ".*",timeout= 10 )
65 return main.TRUE
66 """