我的设备yang如下所示-
module router {
yang-version 1;
namespace "urn:sdnhub:odl:tutorial:router";
prefix router;
description "Router configuration";
revision "2015-07-28" {
description "Initial version.";
}
list interfaces {
key id;
leaf id {
type string;
}
leaf ip-address {
type string;
}
}
container router {
list ospf {
key process-id;
leaf process-id {
type uint32;
}
list networks {
key subnet-ip;
leaf subnet-ip {
type string;
}
leaf area-id {
type uint32;
}
}
}
list bgp {
key as-number;
leaf as-number {
type uint32;
}
leaf router-id {
type string;
}
list neighbors {
key as-number;
leaf as-number {
type uint32;
}
leaf peer-ip {
type string;
}
}
}
}
}我正在使用Netconf客户端配置我的SDNHub设备(我正在使用模拟器)。我可以添加配置,但不能修改设备上的配置。
我设备上的初始配置如下所示
{
"router": {
"ospf": [
{
"process-id": 21,
"networks": [
{
"subnet-ip": "12.1.1.1",
"area-id": 12
}
]
}
],"bgp": [
{
"as-number": "31",
"router-id": "123",
"neighbors": [
{
"as-number": "31",
"peer-ip": "1.1.1.1"
}
]
},
{
"as-number": "32",
"router-id": "1234",
"neighbors": [
{
"as-number": "32",
"peer-ip": "2.2.2.2"
}
]
}
]
}
}我正在尝试使用PUT http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/testtool/yang-ext:mount/router:router/ospf/21修改ospf列表
使用以下有效负载,
{
"ospf":
[
{
"process-id" : "21",
"networks": [
{
"subnet-ip": "12.12.12.12",
"area-id": 1212
}
]
}
]
}根节点上的配置被覆盖,并在GET上提供以下数据
{
"router":
{
"ospf": [
{
"process-id": 21,
"networks": [
{
"subnet-ip": "12.12.12.12",
"area-id": 1212
}
]
}
]
}
}如果我发送了错误的请求,或者是否有任何其他方法可以更新Netconf设备上的配置,请让我知道。
发布于 2017-11-09 19:12:31
我假设您想要更新ospf中的网络;然后URL应该指向资源:process-id索引该子树(需要Section 4.5 of RFC 8040):
如果目标资源表示YANG列表实例,则消息正文表示中的关键叶值必须与请求URI中的关键叶值相同。PUT方法不能用于更改数据资源实例的关键叶值。
PUT http://localhost:8181/restconf/path_until_router/router:router/ospf=21 HTTP/1.1
Content-Type: application/yang-data+json
{
"router:process-id": 21,
"router:networks": [
{
"subnet-ip": "12.1.1.1",
"area-id": 12
}
]
}https://stackoverflow.com/questions/43375330
复制相似问题