blob: 8369c24f1feadd8f0a53aa0d3fa53002ab54f720 [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
kelvin-onlab66bccb72015-01-16 14:52:12 -08002"""
adminbae64d82013-08-01 10:50:15 -07003Created on 12-Feb-2013
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07004Copyright 2013 Open Networking Foundation ( ONF )
Jeremy Songsterae01bba2016-07-11 15:39:17 -07005
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-onlab66bccb72015-01-16 14:52:12 -080010author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
adminbae64d82013-08-01 10:50:15 -070011
12
13 TestON is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 2 of the License, or
kelvin-onlab66bccb72015-01-16 14:52:12 -080016 ( at your option ) any later version.
adminbae64d82013-08-01 10:50:15 -070017
18 TestON is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
22
23 You should have received a copy of the GNU General Public License
kelvin-onlab66bccb72015-01-16 14:52:12 -080024 along with TestON. If not, see <http://www.gnu.org/licenses/>.
adminbae64d82013-08-01 10:50:15 -070025
26
27RemoteVMDriver is the basic driver which will handle the Mininet functions
kelvin-onlab66bccb72015-01-16 14:52:12 -080028"""
adminbae64d82013-08-01 10:50:15 -070029from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver
30
adminbae64d82013-08-01 10:50:15 -070031
kelvin-onlab66bccb72015-01-16 14:52:12 -080032class RemotePoxDriver( RemoteTestBedDriver ):
33
34 """
35 RemoteVMDriver is the basic driver which will handle the Mininet functions
36 """
37 def __init__( self ):
Devin Limdc78e202017-06-09 18:30:07 -070038 super( RemotePoxDriver, self ).__init__()
kelvin-onlab66bccb72015-01-16 14:52:12 -080039
40 def connect( self, **connectargs ):
41 for key in connectargs:
42 vars( self )[ key ] = connectargs[ key ]
43
44 self.name = self.options[ 'name' ]
45
46 self.handle = super(
47 RemotePoxDriver,
48 self ).connect(
49 user_name=self.user_name,
50 ip_address=self.ip_address,
51 port=self.port,
52 pwd=self.pwd )
53 if self.handle:
54 main.log.info( self.name + " connected successfully " )
55
56 self.execute(
57 cmd="cd " +
58 self.options[ 'pox_lib_location' ],
Devin Limdc78e202017-06-09 18:30:07 -070059 prompt="/pox" + self.prompt,
kelvin-onlab66bccb72015-01-16 14:52:12 -080060 timeout=120 )
61 self.execute(
62 cmd='./pox.py samples.of_tutorial',
63 prompt="DEBUG:",
64 timeout=120 )
adminbae64d82013-08-01 10:50:15 -070065 return self.handle
66 return main.TRUE
kelvin-onlab66bccb72015-01-16 14:52:12 -080067
68 def disconnect( self, handle ):
adminbae64d82013-08-01 10:50:15 -070069 if self.handle:
Devin Limdc78e202017-06-09 18:30:07 -070070 self.execute( cmd="exit()", prompt="/pox" + self.prompt, timeout=120 )
kelvin-onlab66bccb72015-01-16 14:52:12 -080071 else:
72 main.log.error( "Connection failed to the host" )