NETCONF および Junos XML プロトコル セッション内のオブジェクトの特定の子タグに対するフィルター操作コマンド出力
Junos OS を実行しているデバイスとの NETCONF または Junos XML プロトコル セッションでは、クライアント アプリケーションはデバイスの運用情報を要求し、特定のオブジェクトの子要素を選択するように出力をフィルター処理できます。操作コマンドの出力をフィルタリングして特定の子要素を返すために、クライアント アプリケーションは運用情報に対する RPC リクエストを発行し、操作コマンド出力階層のすべてのレベルを表すタグ要素をルート 要素からオブジェクトの直接の親レベルまで囲むタグ 要素を含みます <filter type="subtree"> 。
要求されたオブジェクトのインスタンスを表すために、アプリケーションはコンテナ タグ要素を発行し、識別子として使用しないオブジェクトに <name> 対してタグ要素または同等の識別子要素を使用してその識別子を含 <name> めます。クライアント アプリケーションは、特定の子タグを選択するために、必要なすべての子タグ要素と子孫を発行します。
<rpc>
<operational-request>
<!-- optional tag elements representing the options -->
<filter type="subtree">
<!-- opening tags for each parent of the object -->
<object>
<name>identifier</name>
<first-child/>
<second-child/>
<third-child>
<!--tags for descendents-->
</third-child>
<!-- tag for each additional child to return -->
</object>
<!-- closing tags for each parent of the object -->
</filter>
</operational-request>
</rpc>
サーバーは、RPC 応答で要求されたオブジェクトと子エレメントを返します。
<rpc-reply xmlns="URN" xmlns:junos="URL">
<!-- opening tags for each parent of the object -->
<object>
<name>identifier</name>
<!-- requested child tags -->
</object>
<!-- closing tags for each parent of the object -->
</rpc-reply>
次の例では、RPC リクエスト タグにshow route対応する コマンドの情報を<get-route-information>要求します。クライアント アプリケーションは、操作コマンドの出力をフィルター処理して、識別子 172.16.0.0/12 を持つ inet.0 テーブル内のオブジェクトの および <nh> 要素<rt>のみを<active-tag>返します。
<rpc>
<get-route-information>
<filter type="subtree">
<route-information>
<route-table>
<table-name>inet.0</table-name>
<rt>
<rt-destination>172.16.0.0/12</rt-destination>
<rt-entry>
<active-tag/>
<nh/>
</rt-entry>
</rt>
</route-table>
</route-information>
</filter>
</get-route-information>
</rpc>
]]>]]>
サーバーからの RPC 応答には、要求されたエレメントと子エレメントのみが <rt> 含まれます。
<rpc-reply xmlns="URN" xmlns:junos="URL">
<route-information xmlns="URL">
<route-table>
<table-name>inet.0</table-name>
<rt junos:style="brief">
<rt-destination>172.16.0.0/12</rt-destination>
<rt-entry>
<active-tag>*</active-tag>
<nh>
<selected-next-hop/>
<to>192.168.167.254</to>
<via>fxp0.0</via>
</nh>
</rt-entry>
</rt>
</route-table>
</route-information>
</rpc-reply>
]]>]]>