Re: [Netconf] [yang-doctors] YANG Doctor question: empty mandatory choice? (was RE: YangPush now)

Robert Wilton <rwilton@cisco.com> Fri, 27 July 2018 11:30 UTC

Return-Path: <rwilton@cisco.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 0A1F1130F3F; Fri, 27 Jul 2018 04:30:23 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.51
X-Spam-Level:
X-Spam-Status: No, score=-14.51 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_DKIMWL_WL_HIGH=-0.01, USER_IN_DEF_DKIM_WL=-7.5] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=cisco.com
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 z0VoClrSS5sf; Fri, 27 Jul 2018 04:30:20 -0700 (PDT)
Received: from aer-iport-1.cisco.com (aer-iport-1.cisco.com [173.38.203.51]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6ACE2130F2B; Fri, 27 Jul 2018 04:30:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=22248; q=dns/txt; s=iport; t=1532691019; x=1533900619; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to; bh=rwCP+7BJ9TlOvlgeFqPl2c5SO9LjfsiVTqqF5Bs1x/4=; b=Vkv+5g1NPfsP1+GPPrmF47BG5suPh/Gv7Sir7xu8qaUYgWHmbjXVQIDo aRqk5EaUmLqtJTReeZNp9yU36gwlnxcEKhpwaZrGYBWnRgDczzrzo7moH cCc+sov8CztU1CfOcLdV5X1K9NvrIr0VFBEPF9TX1ALrrpsrECC3NatBu s=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CLAQDbAVtb/xbLJq1bGQEBAQEBAQE?= =?us-ascii?q?BAQEBAQcBAQEBAYJXgVp/KIN+iGWNPQgklWWBZgsYAQqEA0YCgxo4FAECAQE?= =?us-ascii?q?CAQECbRwMhTYBAQEBAgEBAQwVCjgJCwULCQIVAw0TCgICJzAGAQwGAgEBFQK?= =?us-ascii?q?DBQGBdwgPki6bR4EuH4Q/hWAFiRmBQT+BEScMgl+DGwEBAYEsARECAYMfgjU?= =?us-ascii?q?gAoxojSMJjzAGgUiEGoJLhVmMXIVYgVghYXEzGggbFTuCaYIlFxGISIU/PjA?= =?us-ascii?q?Bj1QBAQ?=
X-IronPort-AV: E=Sophos;i="5.51,408,1526342400"; d="scan'208,217";a="5441230"
Received: from aer-iport-nat.cisco.com (HELO aer-core-2.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 11:30:14 +0000
Received: from [10.63.23.106] (dhcp-ensft1-uk-vla370-10-63-23-106.cisco.com [10.63.23.106]) by aer-core-2.cisco.com (8.15.2/8.15.2) with ESMTP id w6RBUEdO032670; Fri, 27 Jul 2018 11:30:14 GMT
To: "Eric Voit (evoit)" <evoit=40cisco.com@dmarc.ietf.org>, Kent Watsen <kwatsen@juniper.net>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>
Cc: "netconf@ietf.org" <netconf@ietf.org>
References: <727ae35abd394a85812168615acce2d3@XCH-RTP-013.cisco.com>
From: Robert Wilton <rwilton@cisco.com>
Message-ID: <187a83c7-1949-7189-f1c7-20135a835ef7@cisco.com>
Date: Fri, 27 Jul 2018 12:30:14 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1
MIME-Version: 1.0
In-Reply-To: <727ae35abd394a85812168615acce2d3@XCH-RTP-013.cisco.com>
Content-Type: multipart/alternative; boundary="------------4BD0E05642055145F9F338F8"
Content-Language: en-US
X-Outbound-SMTP-Client: 10.63.23.106, dhcp-ensft1-uk-vla370-10-63-23-106.cisco.com
X-Outbound-Node: aer-core-2.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/XINwu46iyxQIqj_xHJJcY-fCB-s>
Subject: Re: [Netconf] [yang-doctors] YANG Doctor question: empty mandatory choice? (was RE: YangPush now)
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.27
Precedence: list
List-Id: Network Configuration WG mailing list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Jul 2018 11:30:23 -0000

Hi Eric,

Please see inline ...

On 26/07/2018 20:22, Eric Voit (evoit) wrote:
>
> Hi YANG doctors,
>
> We are trying to close on some YANG push drafts.  There is one YANG 
> related question I would like to bounce off of you before making a 
> suggested change.
>
> In the thread:
>
> https://www.ietf.org/mail-archive/web/netconf/current/msg15169.html
>
> is the following request:
>
> > From: Kent Watsen, July 26, 2018 1:48 PM
>
> >
>
> > <chair hat on>
>
> > ...
>
> >
>
> > Assuming no objections, to close the issues discussed in Montreal, 
> we're waiting
>
> > for the following updates:
>
> >
>
> >   ...
>
> >   sub-notif: modify config model to mandate a transport
>
> What I believe Kent is asking for is that the 
> ietf-subscribed-notifications.yang model should be enhanced to mandate 
> that transport specific call home parameters are augmented under the 
> container “receivers”.  He wants to do this by incorporating a 
> mandatory choice, with no cases being identified.  Cases would be 
> added via augmentations in subsequent drafts.
>
> Specifically, Kent's proposal as per
>
> https://www.ietf.org/mail-archive/web/netconf/current/msg15148.html
>
> is "to make the augmentation of a "notif" model mandatory (see the '+' 
> lines below), to ensure that there is always something more than just 
> a name being configured per receiver.
>
> container receivers {
>
> list receiver {
>
> key "name";
>
> min-elements 1;
>
> leaf name {
>
> type string;
>
> }
>
> +      choice transport {
>
> +        mandatory true;
>
> +        description
>
> +          "Defines the transport-specific configuration data
>
> +           for the selected transport.";
>
> +      } "
>
> At this point there is an open question from Andy on this approach.
>
> https://www.ietf.org/mail-archive/web/netconf/current/msg15149.html
>
> Andy’s says:
>
> “The notion of an empty mandatory choice really stretches the 
> definition of YANG Conformance. This says you cannot possible 
> implement the SN module without some other module augmenting it. Yet 
> there is no way in YANG (besides import) to say the module bar needs 
> to be present if module foo is present.”
>

I can definitely get Andy's point here.  I.e. that using mandatory as a 
conformance tool doesn't seem like a great choice.

However, I think that another angle is that the configuration for a 
receiver a transport must always be specified.  This seems like a 
reasonable constraint, so the mandatory also seems reasonable 
(regardless that it is specified as an empty choice).

> My first question to you is would you object to mandatory choice 
> statements without corresponding case statements?  If you *do* have an 
> issue with an empty mandatory choice, we should likely stay with the 
> current solution.
>
On balance, no I don't object.


> If you see no issue with an empty mandatory choice, I have a second 
> question for you.    For all receivers in a subscription, the selected 
> transport choice case in Kent’s suggestion above MUST match to the 
> value of the “transport” leaf which is one level higher in the tree.  
> I.e.:
>
>     +--rw subscriptions
>
>        +--rw subscription* [identifier]
>
> +--rw transport                                  transport {configured}?
>
>           +--rw receivers
>
>              +--rw receiver* [name]
>
>    +--rw (transport)
>
>       +--rw :(NETCONF)
>
>         |  +--rw (NETCONF specific call home parameters)
>
>       +--rw :(HTTP2)
>
>             +--rw (HTTP2 specific parameters)
>
> (Note on the tree above, I inserted the NETCONF and HTTP2 cases of 
> transport for illustration purposes for the question below.  These two 
> cases would actually be incorporated via separate augmentations to the 
> ietf-subscribed-notifications.yang model.)
>
> Considering above, It seems difficult to enforce that the transport 
> cases selected under all receivers for a single subscription MUST be 
> identical, and also MUST match to the value of the “transport” leaf 
> under the subscription.
>
As per my other email, I think that we should allow multiple transports, 
so the transport leaf is not required.

> Would the YANG doctors have any issue with the structure Kent suggests 
> above?  If no, would the YANG doctors then mandate that integrity 
> checks per performed across the receiver case instances under a 
> subscription?   And if mandated, how might XPATH be encoded 
> considering transport cases are only added via augmentation?
>
Personally, I wouldn't mandate an xpath constraint.  There are many real 
life constraints that are not encoded in YANG models today.

If it did need to be enforced then I think that it would be an xpath 
expression on each transport container.  Perhaps something along the 
lines of "the count of 'receivers' under the subscription must equal the 
count of '<transport-specific-container or leaf>".

Thanks,
Rob


> Thanks,
>
> Eric
>
>
>
> _______________________________________________
> yang-doctors mailing list
> yang-doctors@ietf.org
> https://www.ietf.org/mailman/listinfo/yang-doctors