Subject: [Netconf] Is a ‘replace’ operation on the candidate datastore always the same as ‘delete’ + ‘merge’ ?

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Fri, 17 Jun 2016 13:41:38 +0000

Hi all,

I buried this question in another thread and it had some initial discussion but we never really clarified it.  I mostly want to ignore the running DS for this specific question and just focus on the candidate.

Is a ‘replace’ operation on the candidate datastore always the same as ‘delete’ + ‘merge’ in all cases ?  Are there any corner cases where the result is not the same (e.g. replace at the top levels, empty values, NACM, etc) ?

i.e. is ‘replace’ (in a candidate config) simply the “one-step” equivalent of doing a ‘delete’ and then a ‘merge’ with:
•       identical data in the ‘replace’ and ‘merge’
•       the ‘replace’ and ‘delete’ operation on the same node in the requests ?

# Replace:

<interfaces xc:operation=”replace”>
  <interface>
    <name>eth0</name>
    <description>interface number 1</description>
  </interface>
</interfaces>

# Equivalent delete + merge (in two separate <edit-config> requests):

<interfaces xc:operation=”delete”/>

<interfaces xc:operation=”merge”>  <--operation not really necessary here
  <interface>
    <name>eth0</name>
    <description>interface number 1</description>
  </interface>
</interfaces>

Regards,
Jason

---

From: t.petch <[email-masked]>
Date: Fri, 17 Jun 2016 16:11:00 +0100

---- Original Message -----
From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
To: <[email-masked]>
Sent: Friday, June 17, 2016 2:41 PM

Hi all,

I buried this question in another thread and it had some initial
discussion but we never really clarified it.  I mostly want to ignore
the running DS for this specific question and just focus on the
candidate.

Is a ‘replace’ operation on the candidate datastore always the same as
‘delete’ + ‘merge’ in all cases ?  Are there any corner cases where the
result is not the same (e.g. replace at the top levels, empty values,
NACM, etc) ?

i.e. is ‘replace’ (in a candidate config) simply the “one-step”
equivalent of doing a ‘delete’ and then a ‘merge’ with:
•       identical data in the ‘replace’ and ‘merge’
•       the ‘replace’ and ‘delete’ operation on the same node in the
requests ?

<tp>
Simplistically no; delete requires the node to exist else it errors,
while replace will accept a non-existent node and create it.

Tom Petch

# Replace:

<interfaces xc:operation=”merge”>  <--operation not really necessary
here
  <interface>
    <name>eth0</name>
    <description>interface number 1</description>
  </interface>
</interfaces>

Regards,
Jason

------------------------------------------------------------------------
--------

> _______________________________________________
> Netconf mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netconf
>

---

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Fri, 17 Jun 2016 15:21:13 +0000

Sorry - I realize I really meant to ask if it is the same as 'remove' + 'merge'.
Renaming the subject and reforming the example:

i.e. is ‘replace’ (in a candidate config) simply the “one-step”
equivalent of doing a ‘remove and then a ‘merge’ with:
•       identical data in the ‘replace’ and ‘merge’
•       the ‘replace’ and ‘remove' operation on the same node in the
requests ?

# Replace:

# Equivalent remove + merge (in two separate <edit-config> requests):

<interfaces xc:operation=”remove”/>

Jason

-----Original Message-----
From: t.petch [mailto:[email-masked]] 
Sent: Friday, June 17, 2016 11:11
To: Sterne, Jason (Nokia - CA); [email-masked]
Subject: Re: [Netconf] Is a ‘replace’ operation on the candidate datastore always the same as ‘delete’ + ‘merge’ ?

---- Original Message -----
From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
To: <[email-masked]>
Sent: Friday, June 17, 2016 2:41 PM

Hi all,

<tp>
Simplistically no; delete requires the node to exist else it errors, while replace will accept a non-existent node and create it.

Tom Petch

# Replace:

Regards,
Jason

---

From: "Xiang Li" <[email-masked]>
Date: Fri, 17 Jun 2016 10:24:33 -0500

I think even woth "remove", these two examples are not equivalent at all,
specifically:

<interfaces xc:operation="remove"/>

Would remove everything under the container interfaces.

For 'replace' in <edit-config> , only the configuration actually present in
the <config> parameter is affected.

Thus if you send the following request( assuming leat name is list key):
<interfaces xc:operation="replace">
  <interface>
    <name>eth0</name>
    <description>interface number 1</description>
  </interface>
</interfaces>

and If the existing instance data in the server is:

<interfaces>
  <interface>
    <name>eth0</name>
    <description>interface number 9999999</description>
  </interface>
  <interface>
    <name>eth1</name>
    <description>interface number 2</description>
  </interface>

</interfaces>

Then after replacing, it would become

<interfaces >
  <interface>
    <name>eth0</name>
    <description>interface number 1</description>
  </interface>
</interfaces>
  <interface>
    <name>eth1</name>
    <description>interface number 2</description>
  </interface>

Note the data on the server
  <interface>
    <name>eth1</name>
    <description>interface number 2</description>
  </interface>

Would never be removed for this edit-config.

-Xiang

> From: Netconf [mailto:[email-masked]] On Behalf Of Sterne,
> Jason (Nokia - CA)
> Sent: Friday, June 17, 2016 10:21 AM
> To: t.petch <[email-masked]>; [email-masked]
> Subject: Re: [Netconf] Is a 'replace' operation on the candidate datastore
> always the same as 'remove' + 'merge' ?
> 
> i.e. is 'replace' (in a candidate config) simply the "one-step"
> equivalent of doing a 'remove and then a 'merge' with:
> .       identical data in the 'replace' and 'merge'
> .       the 'replace' and 'remove' operation on the same node in the
> requests ?
> 
> # Replace:
> 
> <interfaces xc:operation="replace">
>   <interface>
>     <name>eth0</name>
> <interfaces xc:operation="remove"/>
> 
> <interfaces xc:operation="merge">  <--operation not really necessary here
>   <interface>
>     <name>eth0</name>
> Subject: Re: [Netconf] Is a 'replace' operation on the candidate datastore
> always the same as 'delete' + 'merge' ?
> 
discussion but
> we never really clarified it.  I mostly want to ignore the running DS for
this
> specific question and just focus on the candidate.
> 
> Is a 'replace' operation on the candidate datastore always the same as
> 'delete' + 'merge' in all cases ?  Are there any corner cases where the
result
> is not the same (e.g. replace at the top levels, empty values, NACM, etc)
?
> 
> i.e. is 'replace' (in a candidate config) simply the "one-step"
> equivalent of doing a 'delete' and then a 'merge' with:
> .       identical data in the 'replace' and 'merge'
> .       the 'replace' and 'delete' operation on the same node in the
> requests ?
> 
> <tp>
> Simplistically no; delete requires the node to exist else it errors, while
replace
> will accept a non-existent node and create it.
> 
> Tom Petch
> 
> 
> # Replace:
> 
> <interfaces xc:operation="replace">
>   <interface>
>     <name>eth0</name>
> <interfaces xc:operation="delete"/>
> 
> <interfaces xc:operation="merge">  <--operation not really necessary here
>   <interface>
>     <name>eth0</name>

---

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Fri, 17 Jun 2016 18:00:59 +0000

Hi Xiang Li,

I was referencing the ietf interfaces model.  <interfaces> is a container.  I'm pretty sure that a replace operation at a container node removes all descendants of that container and replaces them with the data provided.

I didn't show the full <edit-config> but for clarity here it is:

  <?xml version="1.0" encoding="UTF-8"?>
  <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> 
     <edit-config>
            <target>
                 <candidate/>
            </target>
            <config>
                <interfaces xc:operation="replace">
                    <interface>
                        <name>eth0</name>
                        <description>interface number 1</description>
                    </interface>
                 </interfaces>
             </config>
      </edit-config>
  </rpc>
  ]]>]]>

If my request was this instead then only eth0 would be affected:
              <interfaces>
                  <interface xc:operation="replace">>
                      <name>eth0</name>
                      <description>interface number 1</description>
                  </interface>
               </interfaces>

What if my original datastore contained the following:

  <interfaces>
    <interface>
      <name>eth0</name>
      <description>interface number 9999999</description>
      <link-up-down-trap-enable>enabled</link-up-down-trap-enable>
    </interface>
  </interfaces>

and then I did the following <edit-config>:

would the resulting datastore have the link-up-down-trap-enable leaf or not ?  The link-up-down-trap-enable was not in the <config> parameter so by your definition it isn't affected.   But I think the result is this:

  <interfaces>
    <interface>
      <name>eth0</name>

Regards,
Jason

-----Original Message-----
From: Xiang Li [mailto:[email-masked]] 
Sent: Friday, June 17, 2016 11:25
To: Sterne, Jason (Nokia - CA); 't.petch'; [email-masked]
Subject: RE: [Netconf] Is a 'replace' operation on the candidate datastore always the same as 'remove' + 'merge' ?

For 'replace' in <edit-config> , only the configuration actually present in the <config> parameter is affected.

<interfaces>
  <interface>
    <name>eth0</name>

</interfaces>

<interfaces >
  <interface>
    <name>eth0</name>

-Xiang

> Subject: Re: [Netconf] Is a 'replace' operation on the candidate 
> datastore always the same as 'remove' + 'merge' ?
> 
> Sorry - I realize I really meant to ask if it is the same as 'remove' 
> +
'merge'.
> Subject: Re: [Netconf] Is a 'replace' operation on the candidate 
> datastore always the same as 'delete' + 'merge' ?
> 
discussion but
this
result
?
> while
replace

---

From: "Xiang Li" <[email-masked]>
Date: Fri, 17 Jun 2016 16:58:57 -0500

Hi

> From: Sterne, Jason (Nokia - CA) [mailto:[email-masked]]
> Sent: Friday, June 17, 2016 1:01 PM
> To: Xiang Li <[email-masked]>; 't.petch' <[email-masked]>;
> [email-masked]
> I was referencing the ietf interfaces model.  <interfaces> is a container.
I'm
> pretty sure that a replace operation at a container node removes all
> descendants of that container and replaces them with the data provided.

Ok...I misread the place where the "replace" attribute appears.

>                       <description>interface number 1</description>

Ok

> would the resulting datastore have the link-up-down-trap-enable leaf or
not ?

No

Regards
-Xiang

> From: Sterne, Jason (Nokia - CA) [mailto:[email-masked]]
> Sent: Friday, June 17, 2016 1:01 PM
> To: Xiang Li <[email-masked]>; 't.petch' <[email-masked]>;
> [email-masked]
> I was referencing the ietf interfaces model.  <interfaces> is a container.
I'm
> pretty sure that a replace operation at a container node removes all
> descendants of that container and replaces them with the data provided.
> 
> would the resulting datastore have the link-up-down-trap-enable leaf or
not ?
> The link-up-down-trap-enable was not in the <config> parameter so by your
> definition it isn't affected.   But I think the result is this:
> 
>   <interfaces>
>     <interface>
>       <name>eth0</name>
> For 'replace' in <edit-config> , only the configuration actually present
in the
> <config> parameter is affected.
>

---

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Mon, 20 Jun 2016 14:13:59 +0000

OK - thanks.  So I think you and I are in sync now on the behavior of 'replace'.

So the question is still open to the group -> does anyone know of cases where a 'replace' in a candidate config doesn't have the same result as a 'remove' + 'merge' ?

Regards,
Jason 

-----Original Message-----
From: Xiang Li [mailto:[email-masked]] 
Sent: Friday, June 17, 2016 17:59
To: Sterne, Jason (Nokia - CA); 't.petch'; [email-masked]
Subject: RE: [Netconf] Is a 'replace' operation on the candidate datastore always the same as 'remove' + 'merge' ?

Hi

> Subject: RE: [Netconf] Is a 'replace' operation on the candidate 
I'm

Ok

not ?

No

Regards
-Xiang

> Subject: RE: [Netconf] Is a 'replace' operation on the candidate 
I'm
not ?
> Subject: RE: [Netconf] Is a 'replace' operation on the candidate 
in the
> > Is a 'replace' operation on the candidate datastore always the same 
> > as 'delete' + 'merge' in all cases ?  Are there any corner cases 
> > where the
> result
> > --------------------------------------------------------------------
> > --
> > --
> > --------
> >
> >