admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 2 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 3 | Created on 12-Feb-2013 |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 4 | Copyright 2013 Open Networking Foundation ( ONF ) |
Jeremy Songster | ae01bba | 2016-07-11 15:39:17 -0700 | [diff] [blame] | 5 | |
| 6 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 7 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 8 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 9 | |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 10 | author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 11 | |
| 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-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 16 | ( at your option ) any later version. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 17 | |
| 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-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 24 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 25 | |
| 26 | |
| 27 | RemoteVMDriver is the basic driver which will handle the Mininet functions |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 28 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 29 | from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver |
| 30 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 31 | |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 32 | class RemotePoxDriver( RemoteTestBedDriver ): |
| 33 | |
| 34 | """ |
| 35 | RemoteVMDriver is the basic driver which will handle the Mininet functions |
| 36 | """ |
| 37 | def __init__( self ): |
Devin Lim | dc78e20 | 2017-06-09 18:30:07 -0700 | [diff] [blame] | 38 | super( RemotePoxDriver, self ).__init__() |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 39 | |
| 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 Lim | dc78e20 | 2017-06-09 18:30:07 -0700 | [diff] [blame] | 59 | prompt="/pox" + self.prompt, |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 60 | timeout=120 ) |
| 61 | self.execute( |
| 62 | cmd='./pox.py samples.of_tutorial', |
| 63 | prompt="DEBUG:", |
| 64 | timeout=120 ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 65 | return self.handle |
| 66 | return main.TRUE |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 67 | |
| 68 | def disconnect( self, handle ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 69 | if self.handle: |
Devin Lim | dc78e20 | 2017-06-09 18:30:07 -0700 | [diff] [blame] | 70 | self.execute( cmd="exit()", prompt="/pox" + self.prompt, timeout=120 ) |
kelvin-onlab | 66bccb7 | 2015-01-16 14:52:12 -0800 | [diff] [blame] | 71 | else: |
| 72 | main.log.error( "Connection failed to the host" ) |