admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 2 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 3 | Created on 12-Feb-2013 |
| 4 | |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 5 | author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 6 | |
| 7 | |
| 8 | TestON is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 11 | ( at your option ) any later version. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 12 | |
| 13 | TestON is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 20 | |
| 21 | |
| 22 | FloodLightCliDriver is the basic driver which will handle the Mininet functions |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 23 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 24 | from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver |
| 25 | |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 26 | class FloodLightCliDriver( RemoteTestBedDriver ): |
| 27 | |
| 28 | """ |
| 29 | FloodLightCliDriver is the basic driver which will handle the Mininet functions |
| 30 | """ |
| 31 | def __init__( self ): |
| 32 | super( RemoteTestBedDriver, self ).__init__() |
| 33 | |
| 34 | def connect( self, **connectargs ): |
| 35 | for key in connectargs: |
| 36 | vars( self )[ key ] = connectargs[ key ] |
| 37 | |
| 38 | self.name = self.options[ 'name' ] |
| 39 | |
| 40 | self.handle = super( |
| 41 | FloodLightCliDriver, |
| 42 | self ).connect( |
| 43 | user_name=self.user_name, |
| 44 | ip_address=self.ip_address, |
| 45 | port=self.port, |
| 46 | pwd=self.pwd ) |
| 47 | if self.handle: |
| 48 | main.log.info( "Connected " + self.name ) |
| 49 | self.execute( cmd="\r", prompt="\$", timeout=10 ) |
| 50 | self.execute( |
| 51 | cmd="cd /home/openflow/floodlight/", |
| 52 | prompt="floodlight\$", |
| 53 | timeout=3 ) |
| 54 | self.execute( |
| 55 | cmd="java -jar target/floodlight.jar &", |
| 56 | prompt="\$", |
| 57 | timeout=3 ) |
| 58 | self.execute( cmd="\r", prompt="\$", timeout=10 ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 59 | return self.handle |
kelvin-onlab | 898a6c6 | 2015-01-16 14:13:53 -0800 | [diff] [blame] | 60 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 61 | return main.FALSE |