Package DataCollector :: Module TelnetClient
[hide private]
[frames] | no frames]

Module TelnetClient

source code

Classes [hide private]
  TelnetClientProtocol
State-machine-based class for telnet
  TelnetClient
Reactor code to start communications and invoke our telnet transport mechanism.
  FakePlugin
Fake class to provide plugin instances for command-line processing.
Functions [hide private]
integer
check(hostname)
Check to see if a device supports telnet
source code
 
buildOptions(parser=None, usage=None)
Command-line telnet options
source code
list of FakePlugins
commandsToPlugins(commands)
The TelntClient class expects plugins.
source code
 
main()
Test harness main()
source code
Variables [hide private]
  __doc__ = """TelnetCli...
  log = logging.getLogger("zen.TelnetClient")
  defaultPromptTimeout = 10
  defaultLoginRegex = 'ogin:.$'
  defaultPasswordRegex = 'assword:'
  defaultEnable = False
  defaultTermLength = False
  responseMap = "WILL", "WONT", "DO", "DONT"
Function Details [hide private]

check(hostname)

source code 
Check to see if a device supports telnet
Parameters:
  • hostname (string) - name or IP address of device
Returns: integer
whether or not telnet port is available

To Do: support alternate ports

commandsToPlugins(commands)

source code 
The TelntClient class expects plugins. Convert commands like 'ls a', 'ls b' to plugin instances. Duplicate commands will (eventually) be removed. This is used to support command-line arguments.
Parameters:
  • commands (list of strings) - list of commands from command-line
Returns: list of FakePlugins
list of commands, plugin-style

main()

source code 

Test harness main()

Usage:

python TelnetClient.py hostname[:port] comand [command]

Each command must be enclosed in quotes (") to be interpreted properly as a complete unit.

Variables Details [hide private]

__doc__

Value:
"""TelnetClient

TelnetClient is used by TelnetClient to issue commands to a machine
and return their output over the telnet protocol.

Device Tree Parameters are:

zTelnetLoginTries - number of times to try login default: 1
...