netconf协议开发

https://blog.csdn.net/haopeng123321/article/details/54934350

我们是基于libnetconf开源软件(https://github.com/CESNET/libnetconf)进行二次开发
github中有两套libnetconf, 一套是libnetconf,另外一套是libnetconf2。libnetconf2是正在开发中的版本,还未正式发布
网上的开源方案主要有2个:
一个是ensuite的yencap + manager,这个是基于Python的。MS之前用的人比较多。
http://ensuite.sourceforge.net/
另一个是yuma(yangclient+netconfd),这个感觉更专业。不过用的人很少。
http://netconfcentral.org
原文:https://blog.csdn.net/haopeng123321/article/details/54934350 

 

NETCONF模块设计介绍

https://blog.csdn.net/haopeng123321/article/details/54934542

 

NETCONF协议详解

https://blog.csdn.net/anzheangel/article/details/78885880

 

Yang解析

https://blog.csdn.net/CSND_PAN/article/details/79542917

NetConf简介之一篇文章读懂NetConf

 

https://github.com/CESNET/libnetconf

https://blog.csdn.net/Kangyucheng/article/details/88251249

https://github.com/CESNET/libnetconf

https://github.com/CESNET/libnetconf

https://github.com/CESNET/libnetconf2/blob/master/src/messages_server.c

https://github.com/ncclient/ncclient

https://github.com/CESNET/libnetconf

 

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Netconf是一种网络配置协议,南向接口设备端代码需要根据具体的设备和协议版本进行开发。一般来说,设备端代码需要实现以下功能: 1. 连接管理:设备端代码需要支持netconf协议的连接管理,包括建立连接、维护连接、关闭连接等。 2. 协议解析:设备端代码需要支持netconf协议的解析,包括接收和解析客户端发送的请求,生成并发送响应等。 3. 配置管理:设备端代码需要支持设备的配置管理,包括读取设备配置、修改设备配置等。 4. 错误处理:设备端代码需要支持错误处理,包括发送错误信息给客户端、记录错误日志等。 以下是一个简单的设备端代码示例,仅供参考: ```python import ncclient from ncclient import manager def connect(device_ip, device_port, device_username, device_password): """ 建立与设备的netconf连接 """ try: device = manager.connect( host=device_ip, port=device_port, username=device_username, password=device_password, device_params={'name': 'junos'}, hostkey_verify=False ) return device except Exception as e: print(e) def get_config(device, filter): """ 读取设备配置 """ try: return device.get_config(source='running', filter=filter).data_xml except Exception as e: print(e) def edit_config(device, config): """ 修改设备配置 """ try: device.edit_config(config=config) except Exception as e: print(e) def close(device): """ 关闭与设备的netconf连接 """ device.close_session() if __name__ == '__main__': device_ip = '192.168.1.1' device_port = 830 device_username = 'admin' device_password = 'admin' device = connect(device_ip, device_port, device_username, device_password) if device: filter = '<configuration><system/></configuration>' config = '<configuration><system><hostname>new_hostname</hostname></system></configuration>' print(get_config(device, filter)) edit_config(device, config) close(device) ``` 在这个示例中,我们使用ncclient库建立与设备的netconf连接,并实现了读取和修改设备配置的功能。这个示例只是一个简单的示例,并不能直接应用于实际生产环境中,需要根据具体的设备和协议版本进行开发

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值