Subject: [yang-doctors] YANG 'list' key identifier uniqueness

From: "Sela, Guy" <[email-masked]>
Date: Mon, 20 Jun 2016 21:13:11 +0000

General question about YANG 'list' key identifier
Does the "key" only needs to be unique within its context/scope, or within the entire model?

So let's say that the context of the 'list user' in this example was inside another list called "anotherlist" which has a key "anotherlistkey", and the list sits inside a container called "container".
Is this model allowed:
<container>
<anotherlist>
                              <anotherlistkey>4</anotherlistkey>
<user>
                                             <login-name>Mike</login-name>
                                             <full-name>Mike Mayers</full-name>
                              </user>
<user>
                                             <login-name>Mike</login-name>
                                             <full-name>Mike Mayers</full-name>
                              </user>
</anotherlist>
<anotherlist>
                              <anotherlistkey>8</anotherlistkey>
                              <user>
                                             <login-name>Mike</login-name>
                                             <full-name>Mike Mayers</full-name>
                              </user>
               </anotherlist>
</container>

?

Thanks,
Guy Sela

---

From: Martin Bjorklund <[email-masked]>
Date: Tue, 21 Jun 2016 13:18:45 +0200 (CEST)

> Does the "key" only needs to be unique within its context/scope, or

They are unique only within the list.

/martin

> 
> So let's say that the context of the 'list user' in this example was
> inside another list called "anotherlist" which has a key
> "anotherlistkey", and the list sits inside a container called
> "container".
> Is this model allowed:
> <container>
> <anotherlist>

---

From: "Giles Heron (giheron)" <[email-masked]>
Date: Tue, 21 Jun 2016 11:21:16 +0000

Yes that should be allowed (having two items with the same login-name in two separate instances of the list "user")

Though having two items with the same login-name in one instance of list "user" wouldn't (and you also have that below I think?)

On 21 Jun 2016, at 13:07, Sela, Guy <[email-masked]<mailto:[email-masked]>> wrote:

?

Thanks,
Guy Sela

_______________________________________________
yang-doctors mailing list
[email-masked]<mailto:[email-masked]>
https://www.ietf.org/mailman/listinfo/yang-doctors

---

From: "Sela, Guy" <[email-masked]>
Date: Tue, 21 Jun 2016 17:44:23 +0000

Thanks doctor:)

-----Original Message-----
From: Martin Bjorklund [mailto:[email-masked]] 
Sent: Tuesday, June 21, 2016 2:19 PM
To: Sela, Guy <[email-masked]>
Cc: [email-masked]
Subject: Re: [yang-doctors] YANG 'list' key identifier uniqueness

"Sela, Guy" <[email-masked]> wrote:
> General question about YANG 'list' key identifier Does the "key" only 
> needs to be unique within its context/scope, or within the entire 
> model?

/martin

---

From: "Sela, Guy" <[email-masked]>
Date: Tue, 21 Jun 2016 17:45:42 +0000

Yeah my bad:)
Is this considered a bad design practice though? Can harm XPaths or something like that? Or is it normal?

From: Giles Heron (giheron) [mailto:[email-masked]]
Sent: Tuesday, June 21, 2016 2:21 PM
To: Sela, Guy <[email-masked]>
Cc: [email-masked]
Subject: Re: [yang-doctors] YANG 'list' key identifier uniqueness

?

Thanks,
Guy Sela