admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | ''' |
| 3 | Created on 12-Feb-2013 |
| 4 | |
| 5 | @author: Anil Kumar (anilkumar.s@paxterrasolutions.com) |
| 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 |
| 11 | (at your option) any later version. |
| 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 |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | |
| 21 | |
| 22 | RemoteVMDriver is the basic driver which will handle the Mininet functions |
| 23 | ''' |
| 24 | |
| 25 | import pexpect |
| 26 | import struct |
| 27 | import fcntl |
| 28 | import os |
| 29 | import signal |
| 30 | import re |
| 31 | import sys |
| 32 | import time |
| 33 | |
| 34 | sys.path.append("../") |
| 35 | |
| 36 | from drivers.common.cli.remotetestbeddriver import RemoteTestBedDriver |
| 37 | |
| 38 | class RemotePoxDriver(RemoteTestBedDriver): |
| 39 | ''' |
| 40 | RemoteVMDriver is the basic driver which will handle the Mininet functions |
| 41 | ''' |
| 42 | def __init__(self): |
| 43 | super(RemoteTestBedDriver, self).__init__() |
| 44 | |
| 45 | def connect(self,**connectargs): |
| 46 | for key in connectargs: |
| 47 | vars(self)[key] = connectargs[key] |
| 48 | |
| 49 | self.name = self.options['name'] |
| 50 | |
| 51 | self.handle = super(RemotePoxDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd) |
| 52 | if self.handle : |
| 53 | main.log.info(self.name+" connected successfully ") |
| 54 | |
| 55 | self.execute(cmd="cd "+self.options['pox_lib_location'],prompt="/pox\$",timeout=120) |
| 56 | self.execute(cmd='./pox.py samples.of_tutorial',prompt="DEBUG:",timeout=120) |
| 57 | return self.handle |
| 58 | return main.TRUE |
| 59 | |
| 60 | def disconnect(self,handle): |
| 61 | if self.handle: |
| 62 | self.execute(cmd="exit()",prompt="/pox\$",timeout=120) |
| 63 | else : |
| 64 | main.log.error("Connection failed to the host") |