Netconf 连接器 + Netopeer
介绍
Netopeer(一个开源的 NETCONF 服务器)可用于在 OpenDaylight 中测试/探索 NETCONF 南向。
安装
本指南将使用带有 netopeer的Docker容器。要安装 Docker 并启动netopeer 映像,请执行以下步骤:
- 安装 docker http://docs.docker.com/linux/step_one/
- 启动netopeer镜像:
docker run --rm -t -p 1831:830 dockeruser/netopeer
- 通过调用验证
netopeer 是否正在运行(netopeer 应立即发送其 HELLO 消息:
ssh root@localhost -p 1831 -s netconf
(password root)
挂载 netopeer NETCONF 服务器
前提条件:
- OpenDaylight 以功能odl-restconf-all和 odl-netconf-connector-all. Netopeer
- 已在 docker 中启动并运行
现在只需按照以下部分进行操作:生成新的 NETCONF 连接器。在有效载荷中更改:
PUT
http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/netopeer
<node xmlns="urn:TBD:params:xml:ns:yang:network-topology">
<node-id>netopeer</node-id>
<host xmlns="urn:opendaylight:netconf-node-topology">127.0.0.1</host>
<port xmlns="urn:opendaylight:netconf-node-topology">1831</port>
<username xmlns="urn:opendaylight:netconf-node-topology">root</username>
<password xmlns="urn:opendaylight:netconf-node-topology">root</password>
<tcp-only xmlns="urn:opendaylight:netconf-node-topology">false</tcp-only>
<!-- non-mandatory fields with default values, you can safely remove these if you do not wish to override any of these values-->
<reconnect-on-changed-schema xmlns="urn:opendaylight:netconf-node-topology">false</reconnect-on-changed-schema>
<connection-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">20000</connection-timeout-millis>
<max-connection-attempts xmlns="urn:opendaylight:netconf-node-topology">0</max-connection-attempts>
<between-attempts-timeout-millis xmlns="urn:opendaylight:netconf-node-topology">2000</between-attempts-timeout-millis>
<sleep-factor xmlns="urn:opendaylight:netconf-node-topology">1.5</sleep-factor>
<!-- keepalive-delay set to 0 turns off keepalives-->
<keepalive-delay xmlns="urn:opendaylight:netconf-node-topology">120</keepalive-delay>
</node>
成功挂载 netopeer 后,可以通过调用 RESTCONF 读取其配置:
GET
http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/netopeer/yang-ext:mount/
结果如下:
{
"ietf-netconf-acm:nacm": {
"denied-data-writes": 0,
"denied-notifications": 0,
"denied-operations": 0
},
"toaster:toaster": {
"toasterModelNumber": "toaster",
"toasterStatus": "down",
"toasterManufacturer": "CESNET, z.s.p.o."
},
"ietf-netconf-monitoring:netconf-state": {
"statistics": {
"netconf-start-time": "2022-07-12T08:59:02Z",
"in-bad-hellos": 0,
"in-bad-rpcs": 0,
"out-rpc-errors": 0,
"dropped-sessions": 0,
"in-rpcs": 111,
"out-notifications": 0,
"in-sessions": 1
},
"schemas": {
"schema": [
{
"identifier": "ietf-yang-types"