admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 2 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 3 | Created on 24-Oct-2012 |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 4 | |
| 5 | author:s: Anil Kumar ( anilkumar.s@paxterrasolutions.com ), |
| 6 | Raghav Kashyap( raghavkashyap@paxterrasolutions.com ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 7 | |
| 8 | |
| 9 | TestON is free software: you can redistribute it and/or modify |
| 10 | it under the terms of the GNU General Public License as published by |
| 11 | the Free Software Foundation, either version 2 of the License, or |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 12 | ( at your option ) any later version. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 13 | |
| 14 | TestON is distributed in the hope that it will be useful, |
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | GNU General Public License for more details. |
| 18 | |
| 19 | You should have received a copy of the GNU General Public License |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 20 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 21 | |
| 22 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 23 | |
| 24 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 25 | import pexpect |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 26 | import struct |
| 27 | import fcntl |
| 28 | import os |
| 29 | import sys |
| 30 | import signal |
| 31 | import sys |
| 32 | import re |
| 33 | sys.path.append( "../" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 34 | |
| 35 | from drivers.component import Component |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 36 | |
| 37 | |
| 38 | class CLI( Component ): |
| 39 | |
| 40 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 41 | This will define common functions for CLI included. |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 42 | """ |
| 43 | def __init__( self ): |
| 44 | super( Component, self ).__init__() |
| 45 | |
| 46 | def connect( self, **connectargs ): |
| 47 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 48 | Connection will establish to the remote host using ssh. |
| 49 | It will take user_name ,ip_address and password as arguments<br> |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 50 | and will return the handle. |
| 51 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 52 | for key in connectargs: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 53 | vars( self )[ key ] = connectargs[ key ] |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 54 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 55 | connect_result = super( CLI, self ).connect() |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 56 | ssh_newkey = 'Are you sure you want to continue connecting' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 57 | refused = "ssh: connect to host " + \ |
| 58 | self.ip_address + " port 22: Connection refused" |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 59 | if self.port: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 60 | self.handle = pexpect.spawn( |
| 61 | 'ssh -p ' + |
| 62 | self.port + |
| 63 | ' ' + |
| 64 | self.user_name + |
| 65 | '@' + |
| 66 | self.ip_address, |
Jon Hall | 9aaba88 | 2015-01-19 15:05:15 -0800 | [diff] [blame] | 67 | env={ "TERM": "xterm-mono" }, |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 68 | maxread=50000 ) |
| 69 | else: |
| 70 | self.handle = pexpect.spawn( |
| 71 | 'ssh -X ' + |
| 72 | self.user_name + |
| 73 | '@' + |
| 74 | self.ip_address, |
Jon Hall | 9aaba88 | 2015-01-19 15:05:15 -0800 | [diff] [blame] | 75 | env={ "TERM": "xterm-mono" }, |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 76 | maxread=1000000, |
| 77 | timeout=60 ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 78 | |
| 79 | self.handle.logfile = self.logfile_handler |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 80 | i = 5 |
| 81 | while i == 5: |
| 82 | i = self.handle.expect( [ |
acsmars | e2be32c | 2015-06-29 16:16:28 -0700 | [diff] [blame] | 83 | ssh_newkey, |
Jon Hall | 05f8868 | 2015-06-09 14:57:53 -0700 | [diff] [blame] | 84 | 'password:|Password:', |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 85 | pexpect.EOF, |
| 86 | pexpect.TIMEOUT, |
| 87 | refused, |
| 88 | 'teston>', |
| 89 | '>|#|\$' ], |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 90 | 120 ) |
acsmars | 32de0bc | 2015-06-30 09:57:12 -0700 | [diff] [blame] | 91 | if i == 0: # Accept key, then expect either a password prompt or access |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 92 | main.log.info( "ssh key confirmation received, send yes" ) |
| 93 | self.handle.sendline( 'yes' ) |
acsmars | 32de0bc | 2015-06-30 09:57:12 -0700 | [diff] [blame] | 94 | i = 5 # Run the loop again |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 95 | continue |
| 96 | if i == 1: # Password required |
Jon Hall | 6360493 | 2015-02-26 17:09:50 -0800 | [diff] [blame] | 97 | if self.pwd: |
| 98 | main.log.info( |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 99 | "ssh connection asked for password, gave password" ) |
Jon Hall | 6360493 | 2015-02-26 17:09:50 -0800 | [diff] [blame] | 100 | else: |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 101 | main.log.info( "Server asked for password, but none was " |
| 102 | "given in the .topo file. Trying " |
| 103 | "no password.") |
| 104 | self.pwd = "" |
| 105 | self.handle.sendline( self.pwd ) |
| 106 | j = self.handle.expect( [ |
| 107 | '>|#|\$', |
| 108 | 'password:|Password:', |
| 109 | pexpect.EOF, |
| 110 | pexpect.TIMEOUT ], |
| 111 | 120 ) |
| 112 | if j != 0: |
| 113 | main.log.error( "Incorrect Password" ) |
| 114 | return main.FALSE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 115 | elif i == 2: |
| 116 | main.log.error( "Connection timeout" ) |
| 117 | return main.FALSE |
| 118 | elif i == 3: # timeout |
| 119 | main.log.error( |
| 120 | "No route to the Host " + |
| 121 | self.user_name + |
| 122 | "@" + |
| 123 | self.ip_address ) |
| 124 | return main.FALSE |
| 125 | elif i == 4: |
| 126 | main.log.error( |
| 127 | "ssh: connect to host " + |
| 128 | self.ip_address + |
| 129 | " port 22: Connection refused" ) |
| 130 | return main.FALSE |
| 131 | elif i == 6: |
| 132 | main.log.info( "Password not required logged in" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 133 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 134 | self.handle.sendline( "" ) |
| 135 | self.handle.expect( '>|#|\$' ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 136 | return self.handle |
| 137 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 138 | def disconnect( self ): |
| 139 | result = super( CLI, self ).disconnect( self ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 140 | result = main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 141 | # self.execute( cmd="exit",timeout=120,prompt="(.*)" ) |
| 142 | |
| 143 | def execute( self, **execparams ): |
| 144 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 145 | It facilitates the command line execution of a given command. It has arguments as : |
| 146 | cmd => represents command to be executed, |
| 147 | prompt => represents expect command prompt or output, |
| 148 | timeout => timeout for command execution, |
| 149 | more => to provide a key press if it is on. |
| 150 | |
| 151 | It will return output of command exection. |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 152 | """ |
| 153 | result = super( CLI, self ).execute( self ) |
admin | aef0055 | 2014-05-08 09:18:36 -0700 | [diff] [blame] | 154 | defaultPrompt = '.*[$>\#]' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 155 | args = utilities.parse_args( [ |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 156 | "CMD", |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 157 | "TIMEOUT", |
| 158 | "PROMPT", |
| 159 | "MORE" ], |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 160 | **execparams ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 161 | |
| 162 | expectPrompt = args[ "PROMPT" ] if args[ "PROMPT" ] else defaultPrompt |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 163 | self.LASTRSP = "" |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 164 | timeoutVar = args[ "TIMEOUT" ] if args[ "TIMEOUT" ] else 10 |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 165 | cmd = '' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 166 | if args[ "CMD" ]: |
| 167 | cmd = args[ "CMD" ] |
| 168 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 169 | return 0 |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 170 | if args[ "MORE" ] is None: |
| 171 | args[ "MORE" ] = " " |
| 172 | self.handle.sendline( cmd ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 173 | self.lastCommand = cmd |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 174 | index = self.handle.expect( [ |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 175 | expectPrompt, |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 176 | "--More--", |
| 177 | 'Command not found.', |
| 178 | pexpect.TIMEOUT, |
| 179 | "^:$" ], |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 180 | timeout=timeoutVar ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 181 | if index == 0: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 182 | self.LASTRSP = self.LASTRSP + \ |
| 183 | self.handle.before + self.handle.after |
| 184 | main.log.info( |
| 185 | "Executed :" + str( |
| 186 | cmd ) + " \t\t Expected Prompt '" + str( |
| 187 | expectPrompt) + "' Found" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 188 | elif index == 1: |
| 189 | self.LASTRSP = self.LASTRSP + self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 190 | self.handle.send( args[ "MORE" ] ) |
| 191 | main.log.info( |
| 192 | "Found More screen to go , Sending a key to proceed" ) |
| 193 | indexMore = self.handle.expect( |
| 194 | [ "--More--", expectPrompt ], timeout=timeoutVar ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 195 | while indexMore == 0: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 196 | main.log.info( |
| 197 | "Found anoother More screen to go , Sending a key to proceed" ) |
| 198 | self.handle.send( args[ "MORE" ] ) |
| 199 | indexMore = self.handle.expect( |
| 200 | [ "--More--", expectPrompt ], timeout=timeoutVar ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 201 | self.LASTRSP = self.LASTRSP + self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 202 | elif index == 2: |
| 203 | main.log.error( "Command not found" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 204 | self.LASTRSP = self.LASTRSP + self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 205 | elif index == 3: |
| 206 | main.log.error( "Expected Prompt not found , Time Out!!" ) |
| 207 | main.log.error( expectPrompt ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 208 | return "Expected Prompt not found , Time Out!!" |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 209 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 210 | elif index == 4: |
| 211 | self.LASTRSP = self.LASTRSP + self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 212 | # self.handle.send( args[ "MORE" ] ) |
| 213 | self.handle.sendcontrol( "D" ) |
| 214 | main.log.info( |
| 215 | "Found More screen to go , Sending a key to proceed" ) |
| 216 | indexMore = self.handle.expect( |
| 217 | [ "^:$", expectPrompt ], timeout=timeoutVar ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 218 | while indexMore == 0: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 219 | main.log.info( |
| 220 | "Found another More screen to go , Sending a key to proceed" ) |
| 221 | self.handle.sendcontrol( "D" ) |
| 222 | indexMore = self.handle.expect( |
| 223 | [ "^:$", expectPrompt ], timeout=timeoutVar ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 224 | self.LASTRSP = self.LASTRSP + self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 225 | |
| 226 | main.last_response = self.remove_contol_chars( self.LASTRSP ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 227 | return self.LASTRSP |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 228 | |
| 229 | def remove_contol_chars( self, response ): |
| 230 | # RE_XML_ILLEGAL = '([\u0000-\u0008\u000b-\u000c\u000e-\u001f\ufffe-\uffff])|([%s-%s][^%s-%s])|([^%s-%s][%s-%s])|([%s-%s]$)|(^[%s-%s])'%( unichr( 0xd800 ),unichr( 0xdbff ),unichr( 0xdc00 ),unichr( 0xdfff ),unichr( 0xd800 ),unichr( 0xdbff ),unichr( 0xdc00 ),unichr( 0xdfff ),unichr( 0xd800 ),unichr( 0xdbff ),unichr( 0xdc00 ),unichr( 0xdfff ) ) |
| 231 | # response = re.sub( RE_XML_ILLEGAL, "\n", response ) |
| 232 | response = re.sub( r"[\x01-\x1F\x7F]", "", response ) |
| 233 | # response = re.sub( r"\[\d+\;1H", "\n", response ) |
| 234 | response = re.sub( r"\[\d+\;\d+H", "", response ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 235 | return response |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 236 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 237 | def runAsSudoUser( self, handle, pwd, default ): |
| 238 | |
| 239 | i = handle.expect( [ ".ssword:*", default, pexpect.EOF ] ) |
| 240 | if i == 0: |
| 241 | handle.sendline( pwd ) |
| 242 | handle.sendline( "\r" ) |
| 243 | |
| 244 | if i == 1: |
| 245 | handle.expect( default ) |
| 246 | |
| 247 | if i == 2: |
| 248 | main.log.error( "Unable to run as Sudo user" ) |
| 249 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 250 | return handle |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 251 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 252 | def onfail( self ): |
| 253 | if 'onfail' in main.componentDictionary[ self.name ]: |
| 254 | commandList = main.componentDictionary[ |
| 255 | self.name ][ 'onfail' ].split( "," ) |
| 256 | for command in commandList: |
| 257 | response = self.execute( |
| 258 | cmd=command, |
| 259 | prompt="(.*)", |
| 260 | timeout=120 ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 261 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 262 | def secureCopy( self, user_name, ip_address, filepath, pwd, dst_path ): |
| 263 | |
| 264 | # scp openflow@192.168.56.101:/home/openflow/sample |
| 265 | # /home/paxterra/Desktop/ |
| 266 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 267 | Connection will establish to the remote host using ssh. |
| 268 | It will take user_name ,ip_address and password as arguments<br> |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 269 | and will return the handle. |
| 270 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 271 | ssh_newkey = 'Are you sure you want to continue connecting' |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 272 | refused = "ssh: connect to host " + \ |
| 273 | ip_address + " port 22: Connection refused" |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 274 | |
| 275 | cmd = 'scp ' + str( user_name ) + '@' + str( ip_address ) + ':' + \ |
| 276 | str( filepath ) + ' ' + str(dst_path ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 277 | |
| 278 | main.log.info( "Sending: " + cmd ) |
| 279 | self.handle = pexpect.spawn( cmd ) |
| 280 | i = self.handle.expect( [ |
acsmars | 07f9d39 | 2015-07-15 10:30:58 -0700 | [diff] [blame] | 281 | ssh_newkey, |
| 282 | 'password:', |
| 283 | pexpect.EOF, |
| 284 | pexpect.TIMEOUT, |
| 285 | refused ], |
| 286 | 120 ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 287 | |
| 288 | if i == 0: |
| 289 | main.log.info( "ssh key confirmation received, send yes" ) |
| 290 | self.handle.sendline( 'yes' ) |
| 291 | i = self.handle.expect( [ ssh_newkey, 'password:', pexpect.EOF ] ) |
| 292 | if i == 1: |
| 293 | main.log.info( "ssh connection asked for password, gave password" ) |
| 294 | self.handle.sendline( pwd ) |
| 295 | # self.handle.expect( user_name ) |
| 296 | |
| 297 | elif i == 2: |
| 298 | main.log.error( "Connection timeout" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 299 | pass |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 300 | elif i == 3: # timeout |
| 301 | main.log.error( |
| 302 | "No route to the Host " + |
| 303 | user_name + |
| 304 | "@" + |
| 305 | ip_address ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 306 | return main.FALSE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 307 | elif i == 4: |
| 308 | main.log.error( |
| 309 | "ssh: connect to host " + |
| 310 | ip_address + |
| 311 | " port 22: Connection refused" ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 312 | return main.FALSE |
| 313 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 314 | self.handle.sendline( "" ) |
| 315 | self.handle.expect( "$" ) |
Jon Hall | 94fd047 | 2014-12-08 11:52:42 -0800 | [diff] [blame] | 316 | print self.handle.before |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 317 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 318 | return self.handle |