Subject: [netmod] leafref questions

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 29 Jun 2009 13:39:11 +0200

Hi,

three questions regarding 'leafref':

1. Can leafref point to another leafref? If so, circular references 
   should probably be forbidden.

2. Does a default specified for the target leaf apply to the leafref 
   pointing to that target?

3. Is it OK to specify a default for the leafref itself?

Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 29 Jun 2009 14:02:07 +0200 (CEST)

>    should probably be forbidden.

Yes.  There MUST NOT be any circular chains of leafrefs.

> 3. Is it OK to specify a default for the leafref itself?

We discussed this a bit before... I think it would be ok to a CLR that
says that a leafref cannot have a default value.  IIRC this was also
Andy's suggestion at the time.

/martin

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 29 Jun 2009 14:16:28 +0200

> Andy's suggestion at the time.

I don't remember but agree. :-)

How about the second question? For example:

must "bar > 1";
leaf foo {
    type uint8;
    default 2;
}
leaf bar {
    type leafref {
        path "../foo";
    }
}

Is the must contraint satisfied or not if neither 'foo' nor 'bar' exists
in the instance document?

Lada

-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C

---

From: Martin Bjorklund <[email-masked]>
Date: Mon, 29 Jun 2009 14:23:58 +0200 (CEST)

> in the instance document?

If we add the CLR that says that a leafref cannot have a default, then
it applies to this case as well - thus the must contraint would not be
satisfied.

/martin