Subject: Second Example in section 7.2 of netconf-proto

From: "Sharon Chisholm" <[email-masked]>
Date: Thu, 9 Mar 2006 07:10:02 -0500

hi

In section 7.2, the second example indicates it will add an interface,
but uses the operator of replace. The definition of replace does not
actually say that if the entry does not exist, it is created. Should it,
or should the operator of create be used instead in this example?

I also wonder with these examples if there is an implicit assumption
that the key is name and this somehow defines whether something exists
or not?

      Add an interface named "Ethernet0/0" to the running configuration,
      replacing any previous interface with that name:

     <rpc message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <top xmlns="http://example.com/schema/1.2/config">
             <interface xc:operation="replace">
               <name>Ethernet0/0</name>
               <mtu>1500</mtu>
               <address>
                 <name>192.0.2.4</name>
                 <prefix-length>24</prefix-length>
               </address>
             </interface>
           </top>
         </config>
       </edit-config>
     </rpc>

     <rpc-reply message-id="101"
          xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <ok/>
     </rpc-reply>

Sharon Chisholm
Nortel 
Ottawa, Ontario
Canada

--
to unsubscribe send a message to [email-masked] with
the word 'unsubscribe' in a single line as the message text body.
archive: <http://ops.ietf.org/lists/netconf/>

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 09 Mar 2006 13:59:06 +0100 (CET)

"Sharon Chisholm" <[email-masked]> wrote:
> actually say that if the entry does not exist, it is created.

If it doesn't exist and you try to 'replace', it's an error. This is
not clearly defined in 7.2, but in the description of the error
'data-missing' it says:

   Tag:         data-missing
   Error-type:  application
   Severity:    error
   Error-info:  none
   Description: Request could not be completed because the relevant
                data model content does not exist.  For example,
                a 'replace' or 'delete' operation was attempted on
                data which does not exist.

'create' creates an non-existing; it's an error if it exists.
'replace' replaces an existing; it's an error if it doesn't exist.
'merge' creates if it doesn't exist, and modifies if it exists.
'delete' deletes an existing; it's an error if it doesn't exist.

So the example text is a bit unclear.

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 09 Mar 2006 06:39:49 -0800

> So the example text is a bit unclear.

This error text is wrong.
Replace does not cause an error if the data does not exist.
That was the reason we added create. 

Merge and replace do not care about existing data.

Create on data that already exists is an error.

Delete on data that does not exist is an error.

Replace foo with nothing is not an error.

Merge foo with nothing is not an error.

Replace nothing with foo is not an error.

Merge nothing with foo is not an error.

> /martin

Andy

---

From: Andy Bierman <[email-masked]>
Date: Thu, 09 Mar 2006 06:50:12 -0800

> that the key is name and this somehow defines whether something exists

How about some text that says:

"The manager must understand the data model being used.
In these examples, the manager knows a priori that the 'name' element
is used for instance identification to distinguish multiple instances
of the 'interface' element.

Andy

> -

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 09 Mar 2006 15:56:38 +0100 (CET)

> Replace does not cause an error if the data does not exist.

That was quite some change to the current draft!

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 09 Mar 2006 07:34:52 -0800

> That was quite some change to the current draft!

I could dig up lots of email messages from a couple years ago that
shows that this is not a change -- it is how replace has always worked.
The (unfortunate) extra 2 words in the error description is the bug.

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 09 Mar 2006 15:56:38 +0100 (CET)

/martin

---

From: Phil Shafer <[email-masked]>
Date: Thu, 09 Mar 2006 14:50:50 -0500

>Merge nothing with foo is not an error.

This all jibes with my memory.  The purpose of replace was
to replace any and all matching data with the new incoming
config.  So failing if nothing exists wouldn't help anyone.
If you wanted that, you would use "create".

Thanks,
 Phil

---

From: Andy Bierman <[email-masked]>
Date: Thu, 09 Mar 2006 12:06:33 -0800

> If you wanted that, you would use "create".

This really matters when you consider simple ordered lists like ACLs.
Without 'replace' you could not exchange all the old entries in the list
for some new entries -- in one operation. 

Andy