如何从restconf中的父元素中获取特定的子元素,同时在restconf中获取父元素的所有子元素?,例如,:my模块
module system{
leaf name{
type string;
}
leaf version{
type string;
}
container processors{
list processor{
key "id";
leaf id{
type string;
}
leaf name{
type string;
}
}
}
}我需要系统的所有子级(名称、版本、处理器),但只需要处理器的I:
<system>
<name>system_1</name>
<version>1</version>
<processors>
<processor>
<id>1</id>
</processor>
<processor>
<id>2</id>
</processor>
</processors>
</system>在restconf中调用该答案的查询是什么?
发布于 2020-01-12 12:04:54
通过使用GET方法的字段查询参数,您应该能够做到这一点。参考资料可在RFC8040 (https://www.rfc-editor.org/rfc/rfc8040#section-4.8.3)中找到。
请求应该类似于:
GET /restconf/data?fields=(system:name;system:version;system:processors/processor/id)
请注意,您需要多次重复模块名“system”,因为您还没有在示例模型中定义一个常见的顶级节点。
请记住,只有在RESTCONF服务器支持“字段”查询参数的情况下才能工作,该参数需要首先确认。
https://stackoverflow.com/questions/59176533
复制相似问题