Re: [netmod] guidelines for top-level nodes in RFC 8407

Ladislav Lhotka <lhotka@nic.cz> Fri, 22 March 2019 13:46 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CE5A6130EC2 for <netmod@ietfa.amsl.com>; Fri, 22 Mar 2019 06:46:05 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nEgki7FVGnpE for <netmod@ietfa.amsl.com>; Fri, 22 Mar 2019 06:46:02 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 10D58130EBB for <netmod@ietf.org>; Fri, 22 Mar 2019 06:46:01 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id 6549F18204B4; Fri, 22 Mar 2019 14:45:55 +0100 (CET)
Received: from localhost (unknown [195.113.220.123]) by trail.lhotka.name (Postfix) with ESMTPSA id E22E71820047; Fri, 22 Mar 2019 14:45:38 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Martin Bjorklund <mbj@tail-f.com>
Cc: netmod@ietf.org
In-Reply-To: <20190322.133346.1421769722882415136.mbj@tail-f.com>
References: <20190322.102400.1417118397166044745.mbj@tail-f.com> <64219162d7fbcea83796e37f01f4cf9648b5573b.camel@nic.cz> <20190322.133346.1421769722882415136.mbj@tail-f.com>
Mail-Followup-To: Martin Bjorklund <mbj@tail-f.com>, netmod@ietf.org
Date: Fri, 22 Mar 2019 14:45:42 +0100
Message-ID: <87tvfvxbsp.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/ufObhnDdujH1FuiS8SDoOG4gg-U>
Subject: Re: [netmod] guidelines for top-level nodes in RFC 8407
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 22 Mar 2019 13:46:06 -0000

Martin Bjorklund <mbj@tail-f.com> writes:

...

> Ok.  So in this case I suppose I can do:
>
>    container top {
>      leaf foo {
>        type int32;
>        default 0;
>        must '. != 42 or ../bar' {
>          description
>            "If foo is 42, then bar must be be set";
>        }
>      }
>      leaf bar {
>        when '../foo = 42';
>        type int32;
>      }
>    }

Or just

    container top {
      must 'foo != 42 and not(bar) or foo = 42 and bar';
      ...
    }

It also depends on whether you want to let automatically nuke bar if foo
is changed from 42 to something else. I prefer to keep it and report a
semantic error during validation.

>
> It accomplishes the same thing, but it is less clear.

Well, the interaction between mandatory and when has already caused a
lot of confusion. Some people even thought it was clear but their
interpretation was wrong. :-)

Lada

>
>
> /martin
>
>
>> > IMO it doesn't violate the spirit of the rule.  So the question is; is
>> > this allowed?
>> 
>> My answer is that the mandatory property is a syntactic/schema constraint
>> whereas "when" should be treated as a semantic rule because its expression has
>> to be evaluated on a particular instance. As such, it should not interfere with
>> schema constraints including mandatory.
>> 
>> If the when expression is more complicated (e.g. involves data from
>> other modules), it may not be possible to determine just by looking
>> at a single module whether an empty datastore is valid or not.
>> 
>> Even in your trivial example, what if an implementation adds a deviation module
>> changing the default for /top/foo to 42?
>> 
>> Lada
>> 
>> > 
>> > 
>> > /martin
>> > 
>> > P.S. the real data model is a potential solution to a problem with
>> > ietf-alarms from draft-ietf-ccamp-alarm-module:
>> > 
>> >       leaf notify-status-changes {
>> >         type enumeration {
>> >           enum all-state-changes {
>> >             ...
>> >           }
>> >           enum raise-and-clear {
>> >             ...
>> >           }
>> >           enum severity-level {
>> >             ...
>> >           }
>> >         }
>> >         default "all-state-changes";
>> >         description
>> >           ...
>> >       }
>> >       leaf notify-severity-level {
>> >         when '../notify-status-changes = "severity-level"';
>> >         type severity;
>> >         mandatory true;
>> >         ...
>> >       }
>> > 
>> > 
>> > pyang complains that this violates the cited rule.
>> > 
>> > D.S.
>> > 
>> > _______________________________________________
>> > netmod mailing list
>> > netmod@ietf.org
>> > https://www.ietf.org/mailman/listinfo/netmod
>> -- 
>> Ladislav Lhotka
>> Head, CZ.NIC Labs
>> PGP Key ID: 0xB8F92B08A9F76C67
>> 
>> _______________________________________________
>> netmod mailing list
>> netmod@ietf.org
>> https://www.ietf.org/mailman/listinfo/netmod
>> 

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67