ktbyers/netmiko — pull request #22 by rnilekani (2014-12-18 21:09:52+00:00)
Title: Update f5_ltm_ssh.py

Added the following features:

a) Normalize Linefeeds
b) Striping the command from the output.

Results:
>>>
>>>
>>> import netmiko

>>>
>>> SSHClass = netmiko.ssh_dispatcher(device_type='f5_ltm')
>>>
>>> SSHClass

>>>
>>> net_connect = SSHClass(ip = 'X.X.X.X', username='xxxx', password ='xxxx', secret = '')
SSH connection established to X.X.X.X:22
Interactive SSH session established

Paging has been disabled

>>>
>>>
>>>
>>> output = net_connect.send_command('tmsh show sys version')
>>>
>>> print output

Sys::Version
Main Package
Product BIG-IP
Version 11.1.0
Build 1943.0
Edition Final
Date Sun Nov 20 18:27:50 PST 2011

[root@f5-Active] config #
>>>
>>>
>>>
>>>
>>> config_commands = ['tmsh show sys version', 'tmsh show ltm pool TEST']
>>>
>>> output = net_connect.send_config_set(config_commands)
>>>
>>>
>>> print output

Sys::Version
Main Package
Product BIG-IP
Version 11.1.0
Build 1943.0
Edition Final
Date Sun Nov 20 18:27:50 PST 2011

[root@f5-inova-1a:Active] config #
---------------------------------------------------------------------
Ltm::Pool: TEST
---------------------------------------------------------------------
Status
Availability : offline
State : enabled
Reason :
Monitor : none
Minimum Active Members : 0
Current Active Members : 0

Traffic ServerSide
Bits In 0
Bits Out 0
Packets In 0
Packets Out 0
Current Connections 0
Maximum Connections 0
Total Connections 0

Connection Queue Pool Pool and members
Number of connections queued now 0 0
Number of connections serviced 0 0
Queue head entry age (ms) 0 0
Maximum queue entry age ever (ms) 0 0
Maximum queue entry age recently (ms) 0 0
Average queue entry age (ms) 0 0