2

使用 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 命令从收到的 hello 消息中访问功能:

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 中的功能,但它只是说数据模型内容不存在。

4

1 回答 1

2

我找到了一个我想发布的解决方案,以防其他人遇到类似问题:

在查看 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 
于 2019-06-14T12:44:27.837 回答