#! /usr/bin/python2.7

import ncclient

from ncclient import manager

with manager.connect(\
host="192.168.56.2", \
port=22, \
username="client002", \
hostkey_verify=True, \
key_filename="private.ppk",\
device_params={'name':'huawei'}) as m:
c = m.get_config(source='running').data_xml
with open("%s.xml" % host, 'w') as f:
f.write(c)

posted on 2017-09-21 00:30  爱编程的小兵  阅读(358)  评论(0编辑  收藏  举报