Subject: [Netconf] Clarification request for NETCONF edit-config default-operation replace

From: William Ivory <[email-masked]>
Date: Thu, 14 Apr 2016 07:13:34 +0000

Hi,

I'd appreciate clarification of how the  NETCONF edit-config command should work with default-operation set to 'replace'.  For the most part, the edit-config section is clear that config will only be replaced if explicitly overwritten (ie if you provide replacement config for given nodes).  However, the section on default-operation is less clear:

         The <default-operation> parameter is optional, but if provided,
         it has one of the following values:

         merge:  The configuration data in the <config> parameter is
            merged with the configuration at the corresponding level in
            the target datastore.  This is the default behavior.

         replace:  The configuration data in the <config> parameter
            completely replaces the configuration in the target
            datastore.  This is useful for loading previously saved
            configuration data.

Specifically, while 'merge' states that merge happesn with 'configuration as the corresponding level', 'replace' states that is 'completely replaces' the configuration, suggesting that it will remove ALL existing configuration regardless of what is explicitly provided as the replacement.  Is that correct, or is 'replace' meant to have equivalent semantics to 'merge' ie it will only replace configuration when an explicit replacement is provided.  In other words, if the latter case is correct, all it does is remove the requirement to specify the operation in each element of new config.

Thanks,

William

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 14 Apr 2016 10:34:01 +0200 (CEST)

Hi,

William Ivory <[email-masked]> wrote:
> Hi,
> 
> I'd appreciate clarification of how the NETCONF edit-config command
> should work with default-operation set to 'replace'.  For the most
> part, the edit-config section is clear that config will only be
> replaced if explicitly overwritten (ie if you provide replacement
> config for given nodes).  However, the section on default-operation is
> less clear:
> 
> Specifically, while 'merge' states that merge happesn with
> 'configuration as the corresponding level', 'replace' states that is
> 'completely replaces' the configuration, suggesting that it will
> remove ALL existing configuration regardless of what is explicitly
> provided as the replacement.  Is that correct, or is 'replace' meant
> to have equivalent semantics to 'merge' ie it will only replace
> configuration when an explicit replacement is provided.  In other
> words, if the latter case is correct, all it does is remove the
> requirement to specify the operation in each element of new config.

Yes the latter is correct.  Note that the definition of "replace" as
an operation says:

            Unlike a
            <copy-config> operation, which replaces the entire target
            configuration, only the configuration actually present in
            the <config> parameter is affected.

/martin

---

From: William Ivory <[email-masked]>
Date: Fri, 15 Apr 2016 12:35:21 +0000

Hi Martin,

Thanks - I think  that the section on 'replace' under 'default-operation' could do with being clarified next time the RFC is updated then.

I'd appreciate some further clarification on what exactly ' only the configuration actually present in the <config> parameter is affected' means in practice.

First, the general pattern of examples which use 'operation=<operation>' is that this command is put in the 'parent' element's tag, ie the tag which specifies 'delete' is *not* deleted.  How then would you delete a top-level container?  The examples have a '<top>' element but in cases where there are multiple top-level nodes, some of which are optional in the configuration (ie not presence containers), is it possible to delete these nodes?

Secondly, if I'm correct that the 'delete' operation would only affect nodes below the one with the delete operation, is it possible to construct an edit-config PDU that would delete all child nodes without having to explicitly specify each one?  Or is the only way to achieve this either to explicitly specify all config to be removed, or to do a copy-config explicitly specifying all config that is not to be deleted.

Thanks,

William

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: 14 April 2016 09:34
To: William Ivory <[email-masked]>
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

Hi,

> requirement to specify the operation in each element of new config.

Yes the latter is correct.  Note that the definition of "replace" as an operation says:

            Unlike a

/martin

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 15 Apr 2016 14:44:13 +0200 (CEST)

William Ivory <[email-masked]> wrote:
> Hi Martin,
> 
> Thanks - I think that the section on 'replace' under
> 'default-operation' could do with being clarified next time the RFC is
> updated then.
> 
> I'd appreciate some further clarification on what exactly ' only the
> configuration actually present in the <config> parameter is affected'
> means in practice.
> 
> First, the general pattern of examples which use
> 'operation=<operation>' is that this command is put in the 'parent'
> element's tag, ie the tag which specifies 'delete' is *not* deleted.

No.  For example:

    <interface xc:operation="delete">
      <name>192.0.2.4</name>
    </interface>

will delete the "interface" node with the name "192.0.2.4"

It does NOT keep the "interface" node and just delete the "name" node.

> How then would you delete a top-level container?

 <my-top-level-container nc:operation="delete"/>

/martin

> The examples have a
> '<top>' element but in cases where there are multiple top-level nodes,
> some of which are optional in the configuration (ie not presence
> containers), is it possible to delete these nodes?
> 
> Secondly, if I'm correct that the 'delete' operation would only affect
> nodes below the one with the delete operation, is it possible to
> construct an edit-config PDU that would delete all child nodes without
> having to explicitly specify each one?  Or is the only way to achieve
> this either to explicitly specify all config to be removed, or to do a
> copy-config explicitly specifying all config that is not to be
> deleted.
> 
> Thanks,
> 
> William
>

---

From: William Ivory <[email-masked]>
Date: Fri, 15 Apr 2016 13:55:48 +0000

OK - I think it might help if I gave some specific examples, with my understanding of what would get deleted and you can tell me if I'm correct or not.  Apologies for length, but I'd like to avoid any confusion by not spelling out my queries, and I'm struggling to get a clear picture of how this all works with all the different permutations!

Let's take a configuration like this:

<topCont>
    <aLeaf>leafValue</aLeaf>
    <aLeafListEntry>leaflistValueOne</aLeafListEntry>
    <aLeafListEntry>leaflistValueTwo</aLeafListEntry>
    <aListEntry>
        <listKey>firstEntryKey</listKey>
        <listLeaf>firstEntryLeaf</listLeaf>
    </aListEntry>
    <aListEntry>
        <listKey>secondEntryKey</listKey>
        <listLeaf>secondEntryLeaf</listLeaf>
    </aListEntry>
</topCont>

---

(a) topCont, default operation delete

With the default operation set to delete:

<config>
    <topCont>
</config>

=> topCont, and everything under it, would be deleted

---

(b) topCont, operation delete

With the default operation set to none:

<config>
    <topCont xc:operation=delete>
</config>

=> topCont, and everything under it, would be deleted

---

(c) aLeaf delete, operation specified for topCont

With the default operation set to none:

<config>
    <topCont xc:operation=delete>
        <aLeaf>leafValue</aLeaf>
</config>

=> Will delete aLeaf node.  If this leaves topCont empty, then topCont would be removed.  If topCont still contains other elements, topCont would remain?

---

(d) aLeaf delete, operation specified for aLeaf

With the default operation set to none:

<config>
    <topCont>
        <aLeaf xc:operation=delete>leafValue</aLeaf>
</config>

=> Will delete aLeaf node.  If this leaves topCont empty, then topCont would be removed unless it is a presence node.

---

(e) aLeaf delete, operation specified for aLeaf, but no value given

With the default operation set to none:

<config>
    <topCont>
        <aLeaf xc:operation=delete/>
</config>

=> Would this delete aLeaf, and, as per (d), conditionally <topCont>, or must the value of the leaf be specified?

---

(f) aLeafListEntry

Is there a way to delete all leaflist entries without specifying them individually, eg:

<aLeafListEntry xc:operation=delete>

... or, assuming there are other sibling nodes such that we can't just delete topCont, must I specify each individual leaflist element I wish to remove?

---

(g) aListEntry

As per leaflist entries, is there a way to delete all entries generically, or must each be specified?

Separately, if I delete a non-key node inside a list entry, I assume that just deletes that node.  If I delete the list's key node, then presumably that removes the complete entry, eg:

<config>
    <topCont>
        <aListEntry xc:operation=delete>
            <listKey>firstEntryKey</listKey>
        </aListEntry>
</config>

Would the following achieve the same, ie removal of this list entry:

<config>
    <topCont>
        <aListEntry >
            <listKey xc:operation=delete >firstEntryKey</listKey>
        </aListEntry>
</config>

---

Thanks  for bearing with me,

William

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: 15 April 2016 13:44
To: William Ivory <[email-masked]>
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

No.  For example:

/martin

> > config for given nodes).  However, the section on default-operation 
> > is less clear:
> >

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 15 Apr 2016 16:49:25 +0200 (CEST)

William Ivory <[email-masked]> wrote:
> OK - I think it might help if I gave some specific examples, with my
> understanding of what would get deleted and you can tell me if I'm
> correct or not.  Apologies for length, but I'd like to avoid any
> confusion by not spelling out my queries, and I'm struggling to get a
> clear picture of how this all works with all the different
> permutations!
> 

Yes.

> => topCont, and everything under it, would be deleted

Yes.

> => Will delete aLeaf node.  If this leaves topCont empty, then topCont
> would be removed.  If topCont still contains other elements, topCont
> would remain?

No.  This deletes the topCont and everything below it.

> => Will delete aLeaf node.  If this leaves topCont empty, then topCont
> would be removed unless it is a presence node.

Yes  (s/would/may/)

> => Would this delete aLeaf, and, as per (d), conditionally <topCont>,
> or must the value of the leaf be specified?
> 

Yes, this would delete aLeaf.  The value doesn't matter.

> <aLeafListEntry xc:operation=delete>

No

> 
> ... or, assuming there are other sibling nodes such that we can't just
> delete topCont, must I specify each individual leaflist element I wish
> to remove?
> 
> ---
> 
> (g) aListEntry
> 
> As per leaflist entries, is there a way to delete all entries
> generically

No.

>, or must each be specified?

Yes.

> Separately, if I delete a non-key node inside a list entry, I assume
> that just deletes that node.  If I delete the list's key node, then
> presumably that removes the complete entry, eg:
> 
> <config>
>     <topCont>

Yes

>             <listKey xc:operation=delete >firstEntryKey</listKey>

Hmm.  I would say that this results in an error - deleting
just the key of a list is not possible.

/martin

---

From: William Ivory <[email-masked]>
Date: Mon, 18 Apr 2016 15:55:51 +0000

Hi Martin,

To follow up on this 'replace'-specific query (as opposed to my other reply regarding 'delete'), is it correct that with this example YANG:

<topCont>
    <aLeaf>leafValue</aLeaf>

... then either of the following operations would remove ALL existing configuration under <topCont>, including any existing list entries and any other nodes (leaves etc), and would only leave the new list entry?

Using default operation 'none':
<config>
    <topCont>
        <aListEntry xc:operation='replace'>
            <listKey>newEntryKey</listKey>
        </aListEntry>
    </topCont>
</config>

Or using default operation 'replace':

<config>
    <topCont>
        <aListEntry>

---

Thanks,

William

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: 14 April 2016 09:34
To: William Ivory <[email-masked]>
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

Hi,

            Unlike a

/martin

---

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Fri, 29 Apr 2016 19:12:11 +0000

Is there no way to delete the entire contents of the datastore without having to explicitly list every single top level node ?

e.g.
with no default operation (i.e. merge):
<config operation="delete"/>

Or
With default operation = delete:
<config/>

Similarly -> Is there no way to replace the entire contents of the datastore ?

About the cases below shouldn't (c) and (d) return an error ?  They contain data for an object that is being deleted.  (e) seems like the correct way to do it.

(f) and (g) surprise me.  If I can <get-config> an entire leaf-list or list by just specifying the tag for the leaf-list/list name, why doesn't delete get rid of the entire leaf-list/list ?
(if you specify a specific list entry/member in a delete it is basically just a content match node but otherwise you've selected the entire list no ?).

Jason

-----Original Message-----
From: Netconf [mailto:[email-masked]] On Behalf Of Martin Bjorklund
Sent: Friday, April 15, 2016 10:49
To: [email-masked]
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

Yes.

Yes.

Yes  (s/would/may/)

No

No.

Yes.

Yes

>             <listKey xc:operation=delete >firstEntryKey</listKey>

Hmm.  I would say that this results in an error - deleting just the key of a list is not possible.

/martin

> > 'default-operation' could do with being clarified next time the RFC 
> > is updated then.
> > 
> > '<top>' element but in cases where there are multiple top-level 
> > nodes, some of which are optional in the configuration (ie not 
> > presence containers), is it possible to delete these nodes?
> > 
> > Secondly, if I'm correct that the 'delete' operation would only 
> > affect nodes below the one with the delete operation, is it possible 
> > to construct an edit-config PDU that would delete all child nodes 
> > without having to explicitly specify each one?  Or is the only way 
> > to achieve this either to explicitly specify all config to be 
> > removed, or to do a copy-config explicitly specifying all config 
> > that is not to be deleted.
> > 
> > Thanks,
> > 
> > William
> > 
> > > I'd appreciate clarification of how the NETCONF edit-config 
> > > command should work with default-operation set to 'replace'.  For 
> > > the most part, the edit-config section is clear that config will 
> > > only be replaced if explicitly overwritten (ie if you provide 
> > > replacement config for given nodes).  However, the section on 
> > > default-operation is less clear:
> > > 
> > > 'configuration as the corresponding level', 'replace' states that 
> > > is 'completely replaces' the configuration, suggesting that it 
> > > will remove ALL existing configuration regardless of what is 
> > > explicitly provided as the replacement.  Is that correct, or is 
> > > 'replace' meant to have equivalent semantics to 'merge' ie it will 
> > > only replace configuration when an explicit replacement is 
> > > provided.  In other words, if the latter case is correct, all it 
> > > does is remove the requirement to specify the operation in each element of new config.
> > 

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

---

From: "Sterne, Jason (Nokia - CA)" <[email-masked]>
Date: Fri, 29 Apr 2016 19:18:09 +0000

See below.
Jason

-----Original Message-----
From: Netconf [mailto:[email-masked]] On Behalf Of William Ivory
Sent: Monday, April 18, 2016 11:56
To: Martin Bjorklund
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

Hi Martin,

<topCont>
    <aLeaf>leafValue</aLeaf>

[>>JTS] I would think this does nothing except add a new aListEntry with key 'newEntryKey'.  If you wanted to, for example, replace the contents of the first aListEntry member it would look like this:
<config>
    <topCont>
        <aListEntry xc:operation='replace'>
            <listKey>firstEntryKey</listKey>
            <listLeaf>newValueForFirstEntryLeaf</listLeaf>
        </aListEntry>
    </topCont>
</config>

[>>JTS] If you want to replace the entire content of topCont then you need to do this:
<config>
    <topCont xc:operation='replace'>
        <aListEntry>
            <listKey>newEntryKey</listKey>
        </aListEntry>
    </topCont>
</config>

<config>
    <topCont>
        <aListEntry>

[>>JTS] I'm not sure about this one.  Is it equivalent to the following ?
Default operation merge (or none):
<config xc:operation='replace'>
    <topCont>
        <aListEntry>
            <listKey>firstEntryKey</listKey>
        </aListEntry>
    </topCont>
</config>

---

Thanks,

William

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]]
Sent: 14 April 2016 09:34
To: William Ivory <[email-masked]>
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config default-operation replace

Hi,

            Unlike a

/martin

---

From: "Xiang Li" <[email-masked]>
Date: Fri, 29 Apr 2016 19:04:53 -0500

-----Original Message-----
From: Netconf [mailto:[email-masked]] On Behalf Of Sterne, Jason
(Nokia - CA)
Sent: Friday, April 29, 2016 2:12 PM
To: Martin Bjorklund <[email-masked]>; [email-masked]
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config
default-operation replace

Is there no way to delete the entire contents of the datastore without
having to explicitly list every single top level node ?

e.g.

Or

Similarly -> Is there no way to replace the entire contents of the datastore
?

[XL] I think< copy-config> or <delete-config> can do this.

About the cases below shouldn't (c) and (d) return an error ?  They contain
data for an object that is being deleted.  (e) seems like the correct way to
do it.

[XL] I think Martin's explanation is correct. My understanding is that if
the value does not match, then the <delete> would return an error since the
no matching data node found (yes I view this as a content-match). Or I might
be totally wrong here, i.e., the value does not matter in any way as Martin
said?

(f) and (g) surprise me.  If I can <get-config> an entire leaf-list or list
by just specifying the tag for the leaf-list/list name, why doesn't delete
get rid of the entire leaf-list/list ?
(if you specify a specific list entry/member in a delete it is basically
just a content match node but otherwise you've selected the entire list no
?).

[XL] I also thought that I can delete a list entry by specifying  all key
nodes and their values (i.e., list entry's instance ID). If no values of key
nodes are given, then the entire list entries matched and all of them should
be deleted. Although Martin's explanation also makes sense here, that is,
you can't  just delete a key node yet if it is still used by non-key nodes.
Just like deleting a directory when the directory still contains files. But,
in any case,  I would still like that I can delete a list entry by giving
the list entry's IID since we can unmistakably identify  a list entry by
given a list entry's IID (i.e. , all key nodes and their corresponding
values).  I think  such a delete operation would be useful,  just like "rm
-rf directory".

--Xiang 
-----Original Message-----
From: Netconf [mailto:[email-masked]] On Behalf Of Martin
Bjorklund
Sent: Friday, April 15, 2016 10:49
To: [email-masked]
Cc: [email-masked]
Subject: Re: [Netconf] Clarification request for NETCONF edit-config
default-operation replace

Yes.

Yes.

Yes  (s/would/may/)

No

No.

Yes.

Yes

>             <listKey xc:operation=delete >firstEntryKey</listKey>

Hmm.  I would say that this results in an error - deleting just the key of a
list is not possible.

/martin