blob: 3c0b10945157eacdc736afbe9771123e11373e6d [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
kelvin-onlabb87672e2015-01-16 10:58:34 -08002"""
3Created on 26-Oct-2012
Jeremy Songsterae01bba2016-07-11 15:39:17 -07004Modified 2015 by ON.Lab
5
6Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
7the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
8or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
adminbae64d82013-08-01 10:50:15 -07009
kelvin-onlabb87672e2015-01-16 10:58:34 -080010author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
adminbae64d82013-08-01 10:50:15 -070011
12 TestON is free software: you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation, either version 2 of the License, or
kelvin-onlabb87672e2015-01-16 10:58:34 -080015 ( at your option ) any later version.
adminbae64d82013-08-01 10:50:15 -070016
17 TestON is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
kelvin-onlabb87672e2015-01-16 10:58:34 -080023 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070024
25
kelvin-onlabb87672e2015-01-16 10:58:34 -080026"""
adminbae64d82013-08-01 10:50:15 -070027from drivers.common.clidriver import CLI
28
adminbae64d82013-08-01 10:50:15 -070029
kelvin-onlabb87672e2015-01-16 10:58:34 -080030class RemoteTestBedDriver( CLI ):
31 # The common functions for emulator included in RemoteTestBedDriver
32
33 def __init__( self ):
Devin Limdc78e202017-06-09 18:30:07 -070034 super( RemoteTestBedDriver, self ).__init__()
kelvin-onlabb87672e2015-01-16 10:58:34 -080035
36 def connect( self, **connectargs ):
37 for key in connectargs:
38 vars( self )[ 'vm_' + key ] = connectargs[ key ]
39
40 remote_user_name = main.componentDictionary[
41 self.name ][ 'remote_user_name' ]
42 remote_ip_address = main.componentDictionary[
43 self.name ][ 'remote_ip_address' ]
44 remote_port = main.componentDictionary[ self.name ][ 'remote_port' ]
45 remote_pwd = main.componentDictionary[ self.name ][ 'remote_pwd' ]
46
47 self.handle = super(
48 RemoteTestBedDriver,
49 self ).connect(
50 user_name=remote_user_name,
51 ip_address=remote_ip_address,
52 port=remote_port,
53 pwd=remote_pwd )
54
adminbae64d82013-08-01 10:50:15 -070055 if self.handle:
Devin Limdc78e202017-06-09 18:30:07 -070056 self.execute( cmd="\n", prompt=self.prompt, timeout=10 )
57 self.execute( cmd="SET CYGWIN=notty", prompt=self.prompt, timeout=10 )
58 self.execute( cmd="\n", prompt=self.prompt, timeout=10 )
kelvin-onlabb87672e2015-01-16 10:58:34 -080059 main.log.info(
60 "ssh " +
61 self.vm_user_name +
62 '@' +
63 self.vm_ip_address )
64 self.execute(
65 cmd="ssh " +
66 self.vm_user_name +
67 '@' +
68 self.vm_ip_address,
69 prompt="(.*)",
70 timeout=10 )
Devin Limdc78e202017-06-09 18:30:07 -070071 self.execute( cmd="\n", prompt="password:", timeout=10 )
72 self.execute( cmd=self.vm_pwd, prompt=self.prompt, timeout=10 )
kelvin-onlabb87672e2015-01-16 10:58:34 -080073
adminbae64d82013-08-01 10:50:15 -070074 return self.handle
kelvin-onlabb87672e2015-01-16 10:58:34 -080075 else:
adminbae64d82013-08-01 10:50:15 -070076 return main.FALSE