"Bogaert, Bart (Nokia - BE)" <[email protected]> wrote:
> So; to make this work the YANG property of the parent leaf in the config
> data tree should be set to false to allow a reference to hardware-state,
> correct?
It would be:
leaf parent {
type leafref {
path "/hardware-state/component/name";
require-instance false;
}
/martin
>
> Regards, Bart
>
> Juergen Schoenwaelder <[email protected]> wrote:
> > On Wed, Mar 08, 2017 at 02:48:15PM +0000, Bogaert, Bart (Nokia - BE)
> wrote:
> > > Hi,
> > >
> > > > If we pick the former, it will not be possible to configure a
> > > > component with a system controlled parent (unless you also add the
> > > > system controlled parent to the configuration).
> > > > [Bart Bogaert] Is there a reason to only have this parent in the
> > > > state tree and not in the config tree?
> > >
> > > I am not sure I understand the question. Suppose the config tree is
> > > empty, and the system boots and populates the state tree with all
> > > detected harwdare. Next, a client would like to pre-provision a
> > > module in a chassis that exists in state. If the leafref is to the
> > > config tree, the client would have to create both the chassis and
> > > the module in the config tree, since the leafef would otherwise fail to
> validate.
> > >
> > > [Bart Bogaert] Ok, so you are looking for a solution that refers to
> > > an entry in the state tree. I always thought that one could not
> > > refer from config to state but it seems I misunderstood this since
> > > this is exactly what you are proposing.
> > >
> > > > If we pick the latter you will not get any validation (since it
> > > > has to be require-instance false).
> > > >
> > > > It is fine w/ me to change the type string to a leafref of the
> > > > former
> > > type.
> > >
> > > Correction: I am fine with changing the string to a leafref to state.
> > >
> > > > [Bart Bogaert] If we leave it as a string it would mean that an
> > > > external application would have to check whether the value of the
> > > > string actually corresponds to a component that should exist (in
> > > > the case of a non-system-controlled parent)?
> > >
> > > So are you ok with a leafref to state?
> > >
> > > [Bart Bogaert] Since that seems possible this would solve the
> > > problem. I'm checking this with our people.
> >
> > Are you discussing leafref to a config false node with require
> > instance false?
>
> Yes.
>
> > I am not sure this is valid YANG.
>
> It is valid, section 9.9 on leafref says:
>
> If the referring node represents configuration data and the
> "require-instance" property (Section 9.9.3) is "true", the referred
> node MUST also represent configuration.
>
>
>
> /martin
_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod