Subject: [netmod] is list set or not?

From: Leif Johansson <[email-masked]>
Date: Thu, 31 Jul 2008 11:43:45 +0200

Here are the questions I asked at the mic just now in Dublin:

- Is a yang 'list' a set - i.e can a value only occur once?

- Is a yang 'leaf-list' then also a set? The implication of that would be that 
it cannot be used to model an array of primitive types - i.e the array of 
two occurences of the integer 1 would be illegal.

	Cheers Leif
_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Balazs Lengyel <[email-masked]>
Date: Thu, 31 Jul 2008 09:50:37 +0200

Hello,
All leafs in the leaf-list must be unique. All keys (key-combinations) in a list must be 
unique. I think the best solution today is to have a list

list mySet {
    key index;
    leaf index { type int32; }
    leaf setMember { type xxx;}
}

setMembers do not have to be unique.

Balazs
-- 
Balazs Lengyel                       Ericsson Hungary Ltd.
TSP System Manager
ECN: 831 7320                        Fax: +36 1 4377792
Tel: +36-1-437-7320     email: [email-masked]

---

From: Leif Johansson <[email-masked]>
Date: Thu, 31 Jul 2008 12:12:55 +0200

On Thursday 31 July 2008 09:50:37 Balazs Lengyel wrote:
> Hello,
> All leafs in the leaf-list must be unique. All keys (key-combinations) in a
> list must be unique. I think the best solution today is to have a list
>
> list mySet {
>     key index;

Hi

I'm not sure I parse your answer. It sounds to me that you're saying that

"Yes, a yang list is a set."

and that

"Here is now to model an member of an array of type xxx in yang". Is that 
correct?

	Cheers Leif

---

From: Balazs Lengyel <[email-masked]>
Date: Thu, 31 Jul 2008 15:38:06 +0200

Hello,
Yes you are right.
Balazs

---

From: Leif Johansson <[email-masked]>
Date: Thu, 31 Jul 2008 18:49:56 +0200

On Thursday 31 July 2008 15:38:06 Balazs Lengyel wrote:
> >> All leafs in the leaf-list must be unique. All keys (key-combinations)
> >> in a list must be unique. I think the best solution today is to have a
> >> list
> >>
> >> list mySet {
> >>     key index;

In that case could someone explain a use-case for leaf-list?

	Cheers Leif

---

From: "Randy Presuhn" <[email-masked]>
Date: Thu, 31 Jul 2008 13:06:06 -0700

Hi -

It sounds like it's a question of the distinction between a "bag"
and a mathematical "set".  The former allows duplicates, and
requires additional information to uniquely identify an element.
The latter (by definition) does not allow duplicates, so providing
an element's value is sufficient to uniquely identify that element.

Randy

----- Original Message ----- 
> From: "Balazs Lengyel" <[email-masked]>
> To: "Leif Johansson" <[email-masked]>
> Cc: <[email-masked]>
> Sent: Thursday, July 31, 2008 6:38 AM
> Subject: Re: [netmod] is list set or not?
>
> Hello,
> Yes you are right.
> Balazs
> 
> Leif Johansson wrote:

---

From: Andy Bierman <[email-masked]>
Date: Thu, 31 Jul 2008 13:21:43 -0700

> an element's value is sufficient to uniquely identify that element.

I use a proprietary extension called 'no-duplicates' for this purpose.

IMO, the leaf-list would benefit from the following sub-clause:

   ignore-duplicates   true/false;   [default: false]

It should not be an error to have duplicates,
just as it is not an error for the unique-stmt
or must-stmt;

> Randy

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Thu, 31 Jul 2008 17:56:11 +0100 (IST)

> In that case could someone explain a use-case for leaf-list?

Whenever you need to configure not one single value, but many values.

For example, here's one from the YANG draft:

       leaf-list domain-search {
           type string;
           description "List of domain names to search";
       }

And here are two from the ipfix data model:

             leaf-list ipAddress {
               description "List of eligible local IP addresses to be
                 used by the SCTP endpoint. If omitted, all locally
                 assigned IP addresses are used by the SCTP endpoint.";
               type inet:ip-address;
             }

       leaf-list exportingProcess {
         description "Export of received records without any
           modifications. Records are processed by all Exporting
           Processes in the list.";
         type keyref { path "/ipfix/exportingProcess/name"; }
       }

/martin

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 01 Aug 2008 00:37:22 +0100 (IST)

> I use a proprietary extension called 'no-duplicates' for this purpose.

Do you allow this for ordered-by system leaf-lists?

Can you give a use case for these kinds of lists?

If the leaf-list is 
 
    1 2 3 3 1 2

how do you delete the second "1"?

If this is useful for leaf-list, do you also support it on normal
lists?

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 31 Jul 2008 17:49:50 -0700

> Do you allow this for ordered-by system leaf-lists?

have not implemented it yet

> Can you give a use case for these kinds of lists?

not really -- 'bits' covers it pretty well

> If the leaf-list is 

YANG ordered-by user

> If this is useful for leaf-list, do you also support it on normal

no -- lists already have a key-stmt

Andy