[Netdevicelib-checkins] CVS: netdevicelib/src/netdevicelib connections.py,1.4,1.5
Status: Alpha
Brought to you by:
bluecoat93
From: <net...@li...> - 2001-08-26 20:37:26
|
Update of /cvsroot/netdevicelib/netdevicelib/src/netdevicelib In directory usw-pr-cvs1:/tmp/cvs-serv31747 Modified Files: connections.py Log Message: - remove unused devices() method - implement Devices.getConfig() helper method to get a device's config Index: connections.py =================================================================== RCS file: /cvsroot/netdevicelib/netdevicelib/src/netdevicelib/connections.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** connections.py 2001/08/26 20:21:37 1.4 --- connections.py 2001/08/26 20:37:24 1.5 *************** *** 33,43 **** self._timeout = inTimeout - def device( self, inDevice=None ): - """ Accessor for the device associated with the connection """ - - if inDevice != None: - self._device = inDevice - return self._device - def disablePaging( self ): """ Helper function to disable screen paging for a connection """ --- 33,36 ---- *************** *** 47,51 **** --- 40,51 ---- """ Helper function to enable screen paging for a connection """ self.cmd( self._device.getCommand('enablePaging') ) + + def getConfig( self ): + """ Helper function to get the current config from a connection """ + if self._device._needsEnable and not self._isEnabled: + raise RuntimeError( "You must be enabled first" ) + return self.cmd( self._device.getCommand('getConfig') ) + # ------------------------------------------------------------------------ *************** *** 79,83 **** self._conn.close() ! self._isClosed = 0 def login( self, inUser=None, inPass=None ): --- 79,83 ---- self._conn.close() ! self._isOpen = 0 def login( self, inUser=None, inPass=None ): *************** *** 149,152 **** --- 149,156 ---- assert inCmd != None + # Handle blank commands (i.e. unimplemented in the Device subclass) + if inCmd == "": + return "" + debug( "running command (" + inCmd + ")" ) self._conn.write( inCmd + "\n" ) |