python example
* Example of "connect" and "command" API: code from ncclient import manager def connect(host, port, user, password): conn = manager.connect(host=host, port=port, username=user, password=password, timeout=10, device_params = {'name':'junos'}, hostkey_verify=False) print 'show version' print '*' * 30 result = conn.command('show version', format='text') print result.xpath('output')[0].text if __name__ == '__main__': connect('router', '22', 'netconf', 'juniper!') | |