#! /usr/bin/env python2.7
import sys, os, warnings
warnings.simplefilter("ignore", DeprecationWarning)
from ncclient import manager
import time
def my_unknown_host_cb(host, figerprint):
return True
def demo(host, port, user, pwd):
xml = """
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
<top xmlns="http://www.h3c.com/netconf/config:1.0">
<BGP>
<Instances>
<Instance>
<Name></Name>
<ASNumber>111</ASNumber>
<NSR>1</NSR>
</Instance>
</Instances>
</BGP>
</top>
</config>"""
with manager.connect_ssh(host=host,
port=port,
username=user,
password=pwd,
unknown_host_cb=my_unknown_host_cb,
device_params = {'name':'h3c'}) as m:
for c in m.server_capabilities:
print (c)
print (xml)
print (m.edit_config(target='running', cOnfig=xml))
if __name__ == '__main__':
demo("17.1.1.124", 830, "admin", "admin")
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论