Subject: [yang-doctors] Question on when statment and container presence

From: Christian Hopps <[email-masked]>
Date: Fri, 22 Jan 2021 03:21:11 -0500

Hi,

The libyang folks have made a change in their libyang2 branch. The chnage is causing containers to be implicitly marked as presence containers if they include a "when" statement i.e.,:

module main {
  yang-version 1.1;
  namespace "http://example.com/main";
  prefix m;

  leaf afi-safi-name {
    type string;
  }
  container ipv4-flowspec {
    when "../afi-safi-name = 'ipv4-flowspec'";
    leaf flowspec-config {
      type uint8;
    }
  }
}

So in this case "ipv4-flowspec" is being changed as if it had a presence statement.

On of the authors indicated that this was supported indirectly by some mail on netmod; however, my search is not turning anything up.

I think this is incorrect as the presence of the container based on the when is an "implicit" (some other leaf value is set) not "explicit" meaning.

Thoughts?

Thanks,
Chris.

---

From: Martin Björklund <[email-masked]>
Date: Fri, 22 Jan 2021 09:58:37 +0100 (CET)

Hi,

Christian Hopps <[email-masked]> wrote:
> Hi,
> 
> The libyang folks have made a change in their libyang2 branch. The
> chnage is causing containers to be implicitly marked as presence
> containers if they include a "when" statement i.e.,:
> 
> module main {
>   yang-version 1.1;

This is not correct.  If the when evaluates to 'true', it should not
be possible to delete the ipv4-flowspec container - which would be
possible it if had a presence statement.

/martin

> 
> On of the authors indicated that this was supported indirectly by some
> mail on netmod; however, my search is not turning anything up.
> 
> I think this is incorrect as the presence of the container based on
> the when is an "implicit" (some other leaf value is set) not
> "explicit" meaning.
> 
> Thoughts?
> 
> Thanks,
> Chris.