Subject: Re: [netmod] [Netconf] Leaf-list usage

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 16 Dec 2016 09:40:15 +0100

Hi,

> On 16 Dec 2016, at 06:44, Rohit R Ranade <[email-masked]> wrote:
> 
> I was going through the ietf discussion for leaf-list subtree and found a link (https://www.ietf.org/mail-archive/web/netmod/current/msg01982.html)

Your question belongs to to the NETMOD mailing list, so I am moving it there.

>  
> A question that I have :
> 1)      Consider leaf-list f1= [1, 2, 3] in DB.. If I provide condition on leaflist f1=[1],  will it select [1,2,3] ? Will it always be sub-set match   ? How to get an exact match for the whole leaf-list.

I assume you mean condition expressed in XPath. In this case you cannot test whole lists on equality, but if you have

must "f1 = 1";

then

"f1": [1, 2, 3]

would satisfy that condition. You could also write, for example,

must "f1 = 1 and count(f1) = 1";

and then only

"f1": [1]

will match.

Lada

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

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: Rohit R Ranade <[email-masked]>
Date: Fri, 16 Dec 2016 09:08:43 +0000

Hi,
Consider we have 2 records as given below  
  <config> (Rec1)
    <name>10</name>
    <foo>fred</foo>
  </config>
  <config> (Rec2)
    <name>20</name>
    <foo>fred</foo>
    <foo>barney</foo>
    <foo>wilma</foo>
    <foo>someother</foo>
  </config>

Q1 : Using subtree filtering which condition on the leaf-list node can the user give such that he selects the record which contains foo=fred only...
   [we can assume user does not know the value of "name"]

Q2 : Also about the leaf-list, I have tried searching but have not found how this leaf-list originated ? Whether XSD list is the representation for leaf-list in xsd ?
     The XSD list is represented slightly differently as per http://www.w3schools.com/xml/el_list.asp  : <stringvalues>I love XML Schema</stringvalues>

-----Original Message-----
From: Ladislav Lhotka [mailto:[email-masked]] 
Sent: 16 December, 2016 17:40
To: Rohit R Ranade
Cc: NETMOD WG
Subject: Re: [Netconf] Leaf-list usage

Hi,

must "f1 = 1";

then

"f1": [1, 2, 3]

and then only

"f1": [1]

will match.

Lada

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 16 Dec 2016 10:47:28 +0100 (CET)

Rohit R Ranade <[email-masked]> wrote:
> Q1 : Using subtree filtering which condition on the leaf-list node can
> the user give such that he selects the record which contains foo=fred
> only...

 <config>
   <foo>fred</fred>
 </config>

> Q2 : Also about the leaf-list, I have tried searching but have not
> found how this leaf-list originated ?

1 instance of a scalar type  => leaf
N instances of a scalar type => leaf-list
1 instance of a structure    => container
N instances of a structure   => list

>  Whether XSD list is the
> representation for leaf-list in xsd ?

No.

>      The XSD list is represented slightly differently as per
>      http://www.w3schools.com/xml/el_list.asp : <stringvalues>I love XML
>      Schema</stringvalues>

Correct.

/martin

---

From: Rohit R Ranade <[email-masked]>
Date: Fri, 16 Dec 2016 10:23:55 +0000

Whether condition as below:

 <config>
   <foo>fred</fred>
   <foo>barney</foo>
 </config>

Can select below record ?
<config>
   <foo>barney</foo>
   <foo>fred</fred>
 </config>

Basically , whether leaf-list with [barney, fred] are treated as same as leaf-list with [fred, barney] ? In ordered-by system the order does not matter to user, so it can be treated as same ?
I think in the ordered-by user case, this treatment cannot be extended. Please clarify.

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: 16 December, 2016 18:47
To: Rohit R Ranade
Cc: [email-masked]; [email-masked]
Subject: Re: [netmod] [Netconf] Leaf-list usage

 <config>
   <foo>fred</fred>
 </config>

No.

Correct.

/martin

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 16 Dec 2016 12:03:07 +0100 (CET)

Rohit R Ranade <[email-masked]> wrote:
> Basically , whether leaf-list with [barney, fred] are treated as same
> as leaf-list with [fred, barney] ? In ordered-by system the order does
> not matter to user, so it can be treated as same ?

For subtree filtering, the order of elements does not matter,  so in
the example above, the record will be selected.  Whether the leaf-list
is defined as ordered-by user or ordered-by system does not matter for
the filter result.

/martin

---

From: Rohit R Ranade <[email-masked]>
Date: Mon, 19 Dec 2016 05:30:14 +0000

Hi Martin,

As per the discussion in https://www.ietf.org/mail-archive/web/netmod/current/msg01984.html, the understanding is that 

<config>
   <foo>fred</fred>
 </config>

Will select both the records:

<config> (Rec1)
 <name>10</name>
 <foo>fred</foo>
</config>
<config> (Rec2)
 <name>20</name>
 <foo>fred</foo>
 <foo>barney</foo>
 <foo>wilma</foo>
 <foo>someother</foo>
</config>

"Since there is a node in the data store that matches
the content match node <foo>fred</foo>, all sibling nodes at this
level are selected."
This was the explanation given that time. 

Q1: Can you please clarify as to why the Record 2 is not selected as per RFC 6241.

Q2: Whether to select Record 2 only, user need to provide all its leaf-list elements values in the query request?

With Regards,
Rohit

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: 16 December, 2016 17:47
To: Rohit R Ranade
Cc: [email-masked]; [email-masked]
Subject: Re: [netmod] [Netconf] Leaf-list usage

 <config>
   <foo>fred</fred>
 </config>

No.

Correct.

/martin

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 19 Dec 2016 10:57:34 +0100 (CET)

> Q1: Can you please clarify as to why the Record 2 is not selected as

Sorry I misread your original question.  You are correct that this
request will get both records.  The client will get both records, and
will have to do further filtering in the client code.

> Q2: Whether to select Record 2 only, user need to provide all its leaf-list elements values in the query request?

It depends on what's in the db.

/martin