#! /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)