使用 NETCONF 请求配置层次结构级别或容器对象(无标识符)
在与运行 Junos OS 的设备的 NETCONF 会话中,为了在层次结构级别或没有标识符的容器对象中请求有关所有儿童配置元素的完整信息,客户端应用程序会发出标记 <filter> 元素,该标记元素将代表配置层次结构中所有级别的标记元素从 root(表示为 <configuration> 标记元素)下至级别或容器对象的直接父级,由空标记表示。整个请求都包含在标记元素中 <rpc> :
<rpc>
<get-config>
<source>
<!-- tag specifying the source configuration -->
</source>
<filter type="subtree">
<configuration>
<!-- opening tags for each parent of the requested level -->
<level-or-container/>
<!-- closing tags for each parent of the requested level -->
</configuration>
</filter>
</get-config>
</rpc>
]]>]]>
有关 <source> 标记元素的信息,请参阅 使用 NETCONF 指定配置信息请求的来源。
NETCONF 服务器将所请求的配置部分退回和<rpc-reply>标记元素中<data>。有关打开<configuration>标记中的属性的信息,请参阅 使用 NETCONF 指定配置信息请求的来源。
<rpc-reply xmlns="URN" xmlns:junos="URL">
<data>
<configuration attributes>
<!-- opening tags for each parent of the level -->
<level-or-container>
<!-- child tag elements of the level or container -->
</level-or-container>
<!-- closing tags for each parent of the level -->
</configuration>
</data>
</rpc-reply>
]]>]]>
该应用程序还可以在同一标记元素中 <get-config> 包含相应的标记元素,从而请求相同或其他类型的附加配置元素。有关更多信息,请 参阅 使用 NETCONF 同时请求多个配置元素。
以下示例说明如何请求候选配置中的层次结构级别的内容 [edit system login] 。