Subject: [netmod] Hi all, one issue about YANG deviate's Substatements

From: "Zhengguangying (Walker)" <[email-masked]>
Date: Tue, 21 Feb 2017 08:32:41 +0000

Hi all,

  When we define YANG models, there has one issue about "deviate's Substatements"

  In section 7.20.3.2.  The "deviate" Statement given the Substatements supported, but "when" not there.
config       | 7.21.1       | 0..1        |
               | default      | 7.6.4, 7.7.4 | 0..n        |
               | mandatory    | 7.6.5        | 0..1        |
               | max-elements | 7.7.6        | 0..1        |
               | min-elements | 7.7.5        | 0..1        |
               | must         | 7.5.3        | 0..n        |
               | type         | 7.4          | 0..1        |
               | unique       | 7.8.3        | 0..n        |
               | units        | 7.3.3        | 0..1        |
               +--------------+--------------+-------------+
 Now, we have the scenario to add "when" constrains when deviate the existed YANG module, how I can do it?

 May be it need extend the Substatements of "devite" to add "when", what's yours opinion, please help to share, thanks.

Thanks & regards

Walker (Guangying zheng)

---

From: Andy Bierman <[email-masked]>
Date: Tue, 21 Feb 2017 11:23:59 -0800

On Tue, Feb 21, 2017 at 12:32 AM, Zhengguangying (Walker) <
[email-masked]> wrote:

> Hi all,
>
>   When we define YANG models, there has one issue about “deviate's
> Substatements”
>
>   In section *7.20.3.2.  The "deviate" Statement** given the *
> Substatements supported, but “when” not there.
> config       | 7.21.1       | 0..1        |
> Now, we have the scenario to add “when” constrains when deviate the existed
> YANG module, how I can do it?
>
>

You cannot add when-stmts to deviations.
It is not supported.  Deviations cannot be conditional.

> May be it need extend the Substatements of “devite” to add ”when”, what’s
> yours opinion, please help to share, thanks.
>
> Thanks & regards
>
> Walker (Guangying zheng)
>
>
>

Andy

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

---

From: Alex Campbell <[email-masked]>
Date: Tue, 21 Feb 2017 21:00:14 +0000

Hi,

I believe you misunderstood the intention.

A "when" statement inside a deviation would simply add/remove/update a "when" statement in the target module. It would not make the deviation conditional.

I asked this some time ago, and for some reason I was told that it would be overly complex to implement, and to use a "must" statement instead. But I disagree with this resolution.

Alex

________________________________
From: netmod <[email-masked]> on behalf of Andy Bierman <[email-masked]>
Sent: Wednesday, 22 February 2017 8:23 a.m.
To: Zhengguangying (Walker)
Cc: Qudan (Beijing-NOS); [email-masked]; Yangang
Subject: Re: [netmod] Hi all, one issue about YANG deviate's Substatements

On Tue, Feb 21, 2017 at 12:32 AM, Zhengguangying (Walker) <[email-masked]<mailto:[email-masked]>> wrote:
Hi all,

Thanks & regards

Walker (Guangying zheng)

Andy

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

---

From: "Zhengguangying (Walker)" <[email-masked]>
Date: Wed, 22 Feb 2017 06:02:18 +0000

Hi Andy,

    Thanks for your reply, my mean is not make the “Deviations be conditional”, but want to add “when” statements to exist module definition,  because vendor may cannot support all specifications defined in IETF-YANG but need to add some constrains.

Thanks & Regards

Walker (Guangying zheng)

From: Andy Bierman [mailto:[email-masked]]
Sent: 2017年2月22日 3:24
To: Zhengguangying (Walker)
Cc: [email-masked]; Qudan (Beijing-NOS); Guopeipei (Peipei Guo); Yangang
Subject: Re: [netmod] Hi all, one issue about YANG deviate's Substatements

  When we define YANG models, there has one issue about “deviate's Substatements”

  In section 7.20.3.2.  The "deviate" Statement given the Substatements supported, but “when” not there.
config       | 7.21.1       | 0..1        |
               | default      | 7.6.4, 7.7.4 | 0..n        |
               | mandatory    | 7.6.5        | 0..1        |
               | max-elements | 7.7.6        | 0..1        |
               | min-elements | 7.7.5        | 0..1        |
               | must         | 7.5.3        | 0..n        |
               | type         | 7.4          | 0..1        |
               | unique       | 7.8.3        | 0..n        |
               | units        | 7.3.3        | 0..1        |
               +--------------+--------------+-------------+
Now, we have the scenario to add “when” constrains when deviate the existed YANG module, how I can do it?

May be it need extend the Substatements of “devite” to add ”when”, what’s yours opinion, please help to share, thanks.

Thanks & regards

Walker (Guangying zheng)

Andy

---

From: Andy Bierman <[email-masked]>
Date: Wed, 22 Feb 2017 10:01:23 -0800

On Tue, Feb 21, 2017 at 10:02 PM, Zhengguangying (Walker) <
[email-masked]> wrote:

> Hi Andy,
>
>
>
>     Thanks for your reply, my mean is not make the “Deviations be
> conditional”, but want to add “when” statements to exist module
> definition,  because vendor may cannot support all specifications defined
> in IETF-YANG but need to add some constrains.
>
>
>

YANG deviations do not support when-stmt at all.
You can add and delete must-stmts (but not replace them
(replace can be done with delate + add).

You cannot add, delete, or replace a when-stmt.
Add is not allowed since only 1 when-stmt per data node is permitted.
I don't see any reason why replace and delete should have been left out,
but they were.
I also don't get why it is safe to replace the type-stmt but not the
status-stmt.
Lots of restrictions on deviations are hard to understand.

Andy

>
>
> *From:* Andy Bierman [mailto:[email-masked]]
> *Sent:* 2017年2月22日 3:24
> *To:* Zhengguangying (Walker)
> *Cc:* [email-masked]; Qudan (Beijing-NOS); Guopeipei (Peipei Guo);
> Yangang
> *Subject:* Re: [netmod] Hi all, one issue about YANG deviate's
> Substatements
>
>
>
>
>
>
>
>   In section *7.20.3.2.  The "deviate" Statement given the *Substatements
> supported, but “when” not there.
>
> config       | 7.21.1       | 0..1        |
>