Re: [Netconf] [yang-doctors] YANG Doctor question: empty mandatory choice?

"Eric Voit (evoit)" <evoit@cisco.com> Mon, 30 July 2018 15:28 UTC

Return-Path: <evoit@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 60054131105; Mon, 30 Jul 2018 08:28:49 -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, RCVD_IN_DNSWL_HI=-5, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01, URIBL_BLOCKED=0.001, USER_IN_DEF_DKIM_WL=-7.5] autolearn=ham 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 d4IdQRb-y3lc; Mon, 30 Jul 2018 08:28:42 -0700 (PDT)
Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4B77D1310FF; Mon, 30 Jul 2018 08:28:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=8516; q=dns/txt; s=iport; t=1532964504; x=1534174104; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=rgUpoLSOssqNjDnA66p1bOpX+HOckWaKfNqqKyDQSRo=; b=jFKCSnEXX/p4R0EGdqgWrlOaliGtXmkEpu+8LO+aq/j8hA+Mf0Gswt32 i61cTATNlwXMHxN8mObcXuj3OhRBmAMFBw2I5v3tEo1hGQbYNEG3EPc4s drxBojrQdWIBTOM2fNiGsSfjBl+PN6v/ItD0d8ZOPdiYyz5A5tAlfehR6 0=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0A5AwDoD19b/4oNJK1SCRkBAQEBAQEBAQEBAQEHAQEBAQGDTmN/KAqDdJRCgg2DPJIVgXoLI4QDRgIXgnwhNhYBAgEBAgEBAm0cDIU2AQEBAQIBIxFFBQsCAQgOBwMCAgkdAgICMBUQAgQOBQgTgwaBdwgPqxiBLopEBYELh3cXgUE/gRKDEoMbAgEBgTUKAQE1gmqCNSACjGuNJQkCjy2OEZIQAhEUgSQkDiOBUnAVO4JpixWFPm8BjRKBH4EbAQE
X-IronPort-AV: E=Sophos;i="5.51,422,1526342400"; d="scan'208";a="430858526"
Received: from alln-core-5.cisco.com ([173.36.13.138]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2018 15:28:23 +0000
Received: from XCH-RTP-011.cisco.com (xch-rtp-011.cisco.com [64.101.220.151]) by alln-core-5.cisco.com (8.15.2/8.15.2) with ESMTPS id w6UFSMSD021993 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 30 Jul 2018 15:28:23 GMT
Received: from xch-rtp-013.cisco.com (64.101.220.153) by XCH-RTP-011.cisco.com (64.101.220.151) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 30 Jul 2018 11:28:22 -0400
Received: from xch-rtp-013.cisco.com ([64.101.220.153]) by XCH-RTP-013.cisco.com ([64.101.220.153]) with mapi id 15.00.1320.000; Mon, 30 Jul 2018 11:28:22 -0400
From: "Eric Voit (evoit)" <evoit@cisco.com>
To: Martin Bjorklund <mbj@tail-f.com>
CC: "kwatsen@juniper.net" <kwatsen@juniper.net>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>, "netconf@ietf.org" <netconf@ietf.org>
Thread-Topic: [yang-doctors] YANG Doctor question: empty mandatory choice?
Thread-Index: AQHUJ1ReOwlfbH+3hkGPLp9Bm3apCaSn4DUw
Date: Mon, 30 Jul 2018 15:28:21 +0000
Message-ID: <77080682bf90495caec48436453e4750@XCH-RTP-013.cisco.com>
References: <727ae35abd394a85812168615acce2d3@XCH-RTP-013.cisco.com> <20180729.175356.1841285666617255654.mbj@tail-f.com>
In-Reply-To: <20180729.175356.1841285666617255654.mbj@tail-f.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.118.56.234]
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-Outbound-SMTP-Client: 64.101.220.151, xch-rtp-011.cisco.com
X-Outbound-Node: alln-core-5.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/SCla2oPdhGYZDfonREl4vlGva3Q>
Subject: Re: [Netconf] [yang-doctors] YANG Doctor question: empty mandatory choice?
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: Mon, 30 Jul 2018 15:28:50 -0000

Hi Martin,

> From: Martin Bjorklund, July 29, 2018 11:54 AM
> 
> "Eric Voit \(evoit\)" <evoit=40cisco.com@dmarc.ietf.org> 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.";
> >
> >    +      }  "
> >
> 
> In a generic model like this one, I think the construct with a mandatory choice
> is ok.

It sounds like YANG doctors don't have a technical objection to Kent's proposal of an empty mandatory choice.

>  However, I am not convinced that this is the best solution for this model;
> it depends a bit if transport is defined per receiver or per subscription.
> 
> I assume that an augmentation would be done like this:
> 
>   module ietf-netconf-subscribed-notifications {
>     ...
>     prefix nsn;
> 
>     identity netconf { ... }
> 
>     augment /subscriptions/subscription/receivers/receiver/transport {
>       when 'derived-from-or-self(../../../transport, "nsn:netconf"');
> 
>       case netconf {
>         // leafref to call-home config
>       }
>     }
>   }
> 
> ... so that *if* the client configures the mandatory "transport" leaf to
> "nsn:netconf", then it also MUST configure the corresponding netconf-specific
> params.

I agree that this is what an augmentation would look like.  (And based on the "../../../transport", this augmentation assumes that the WG sticks with it previous position that a transport stays at the subscription level).

As the proposed augmentation by itself enforces a specific set of NETCONF transport parameters are configured (in the form of the leafref when the transport is "nsn:netconf"), do you see the empty mandatory choice as providing value?   I am ok with either answer on this, I am just trying to get closure.

Eric  

> /martin
> 
> 
> >
> >
> > 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.”
> >
> >
> >
> > 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.
> >
> >
> >
> > 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.
> >
> >
> >
> > 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?
> >
> >
> >
> > Thanks,
> >
> > Eric