[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: edit-config operation



Andy Bierman wrote:

Why I bet next you will be doing clever things like taking
the output of your <get-config> Xpath expression on <running>
and piping it somehow into a subsequent RPC, like multiple
<edit-config> Xpath expressions on <candidate>.
Or you could add an attribute to <config> (besides sel)
called 'sel-target' so the <edit-config> target can be different
from the Xpath target, and accomplish the same thing in 1 RPC.

Definite power tool with the blade-guard off potential here.
(But you can't cut any wood with the blade-guard in the way.)

There is an obvious solution to not apply the XPath to the whole running configuration.
Example:

<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <edit-config>
   <target>
     <running/>
   </target>
   <config type="xpath" xmlns:rr="my:own:namespace:root:elements" xmlns:uu="my:own:namespace:users" operation="create" sel="/rr:top/uu:users">
     <user xmlns=_*"my:own:namespace:users"*_>
       <name>Alice</name>
       <login>alicefoo</login>
     </user>
   </config>
 </edit-config>
</rpc>

1. Find the namespace of the element that will be created or replaced (here "my:own:namespace:users") 2. Query only the elements related to that namespace in order to build a sub document (Here it will just build a document containing the users)
3. Apply the XPath on it
4. Check that the user does not exist under the nodes selected
5. Create the user on your system

It scales with the number of namespaces (the number of sub-model of your config).
Namespaces are very useful to discriminate between nodes.

Vincent


begin:vcard
fn:Vincent Cridlig
n:Cridlig;Vincent
org:LORIA - INRIA Lorraine;Madynes
adr:;;;Nancy;;;France
email;internet:cridligv@loria.fr
title:PhD Student
tel;work:+33 (0)3 83 59 20 48
url:http://www.loria.fr/~cridligv
version:2.1
end:vcard