我使用APIExplorer,尝试将RESTCONF设备连接到Opendaylight。不幸的是,其Hello Message未读入功能列表。
我运行的Opendaylight Neon的每个功能名称中都带有“ restconf”或“ netconf”。操作系统是Ubuntu 18.04。 为了模拟netconf设备,我从docker映像(benjaminsh / netopeer2)中使用了netopeer2。
我确信我拥有ODL的正确IP,因为我能够连接和接收拓扑数据。 此外,我确定我的模拟设备会发出问候消息,因为尝试SSH进入设备时会看到它。
我使用以下命令启动docker容器:
sudo docker run -it --name netopeer2 -p 1831:830 --rm benjaminsh/netopeer2:latest
我通过此REST命令添加netconf设备:
post /restconf/operations/netconf-node-topology:create-device
{
"netconf-node-topology:input": {
"netconf-node-topology:pass-through": {},
"key-based": {
"netconf-node-topology:key-id": "netconf",
"netconf-node-topology:username": "netconf"
},
"netconf-node-topology:host": "192.168.56.2",
"netconf-node-topology:port": "830",
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:reconnect-on-changed-schema": "false",
"netconf-node-topology:connection-timeout-millis": "20000",
"netconf-node-topology:max-connection-attempts": "0",
"netconf-node-topology:between-attempts-timeout-millis": "2000",
"netconf-node-topology:sleep-factor": "1.5",
"netconf-node-topology:keepalive-delay": "120",
"netconf-node-topology:node-id": "new-netconf-device"
}
}
之后,我尝试使用此REST命令从收到的问候消息中访问功能:
get /restconf/config/network-topology:network-topology/topology/topology-netconf/node/new-netconf-device/netconf-node-topology:odl-hello-message-capabilities
我希望看到odl-hello-message-capabilites中的功能,但它只是说数据模型内容不存在。
答案 0 :(得分:1)
我发现了一个我想发布的解决方案,以防其他人遇到类似问题:
在查看opendaylight中的日志时,我发现尝试连接到设备时出现JAVA应用程序错误。即使netconf连接器已添加到数据中,也无法通信。
诀窍是将“ key-auth”更改为“ login-pw”。新的REST命令:
post /restconf/operations/netconf-node-topology:create-device
{
"netconf-node-topology:input": {
"netconf-node-topology:pass-through": {},
"login-password": {
"netconf-node-topology:username": "netconf",
"netconf-node-topology:password": "netconf"
},
"netconf-node-topology:host": "192.168.56.2",
"netconf-node-topology:port": "1831",
"netconf-node-topology:tcp-only": "false",
"netconf-node-topology:reconnect-on-changed-schema": "false",
"netconf-node-topology:connection-timeout-millis": "20000",
"netconf-node-topology:max-connection-attempts": "0",
"netconf-node-topology:between-attempts-timeout-millis": "2000",
"netconf-node-topology:sleep-factor": "1.5",
"netconf-node-topology:keepalive-delay": "120",
"netconf-node-topology:node-id": "new-netconf-device"
}
}
功能在那里:
get /restconf/operational/network-topology:network-topology