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

"Eric Voit (evoit)" <evoit@cisco.com> Tue, 31 July 2018 19:39 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 4B214130DF7; Tue, 31 Jul 2018 12:39:22 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -12.611
X-Spam-Level:
X-Spam-Status: No, score=-12.611 tagged_above=-999 required=5 tests=[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, 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 nAEqwyxuNBVW; Tue, 31 Jul 2018 12:39:20 -0700 (PDT)
Received: from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 22D34130E2A; Tue, 31 Jul 2018 12:39:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=2963; q=dns/txt; s=iport; t=1533065960; x=1534275560; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=qZ8JXr3xHr632vSWxpk9sOpLnZ5qXqtw0UEphh6QzsE=; b=PRckPgA9zk4z9ZNui6v/s9hRjRhuFjAblDDMiIgmgRVMM69daFfvltqe 3lnpafxAuyTx1noM0hgWwnGXLqvsFVMLQYI39m3eYxbVAz7zJ7BI6/VGC avbu1f6JgT5tCMfcI6quBqI+U41TrMLyVLAL5X1mJjS5P10OHAFgDBPRo o=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0CeAQB7uWBb/5tdJa1SBgMZAQEBAQEBAQEBAQEBBwEBAQEBg05jfzKYP4INlViBegsfhE0CgyshNRcBAgEBAgEBAm0cDIU2AQEBAQIBOj8FCQICAQgOAgUDDREQGxclAgQBDQ2DGYF3CK8oikYFBYh/F4FBP4QkhFQUNyaEbyACjGyNKQkCjy6BUIcOhTeSFAIRFIEkHgE2gVJwFYMlhjOKH49vgRsBAQ
X-IronPort-AV: E=Sophos;i="5.51,428,1526342400"; d="scan'208";a="150489856"
Received: from rcdn-core-4.cisco.com ([173.37.93.155]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jul 2018 19:39:19 +0000
Received: from XCH-RTP-014.cisco.com (xch-rtp-014.cisco.com [64.101.220.154]) by rcdn-core-4.cisco.com (8.15.2/8.15.2) with ESMTPS id w6VJdIf2014283 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 31 Jul 2018 19:39:19 GMT
Received: from xch-rtp-013.cisco.com (64.101.220.153) by XCH-RTP-014.cisco.com (64.101.220.154) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 31 Jul 2018 15:39:18 -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; Tue, 31 Jul 2018 15:39:18 -0400
From: "Eric Voit (evoit)" <evoit@cisco.com>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, Martin Bjorklund <mbj@tail-f.com>, "Andy Bierman (andy@yumaworks.com)" <andy@yumaworks.com>
CC: "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+3hkGPLp9Bm3apCaSn4DUwgAB+GwCAAYN0gP//xXiQ
Date: Tue, 31 Jul 2018 19:39:18 +0000
Message-ID: <b8dc903dc04a46088bcca106ac45c4fc@XCH-RTP-013.cisco.com>
References: <727ae35abd394a85812168615acce2d3@XCH-RTP-013.cisco.com> <20180729.175356.1841285666617255654.mbj@tail-f.com> <77080682bf90495caec48436453e4750@XCH-RTP-013.cisco.com> <20180730.204142.1505732335534077415.mbj@tail-f.com> <20180731174827.n5r2jebon45s2cxy@anna.jacobs.jacobs-university.de>
In-Reply-To: <20180731174827.n5r2jebon45s2cxy@anna.jacobs.jacobs-university.de>
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="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Outbound-SMTP-Client: 64.101.220.154, xch-rtp-014.cisco.com
X-Outbound-Node: rcdn-core-4.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/0CvkVGtsROYhfgN5qxSN6qmG2tU>
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: Tue, 31 Jul 2018 19:39:22 -0000

> From: Juergen Schoenwaelder, July 31, 2018 1:48 PM
> 
> On Mon, Jul 30, 2018 at 08:41:42PM +0200, Martin Bjorklund wrote:
> >
> > The empty mandatory choice does provide value since it requires that
> > some transport-specific parameters are configured.  However, can we
> > assume that all transports require configuration parameters here?
> 
> Can you have a receiver without any transport parameters?
> 
> > It is probably safest to not have a mandatory choice, and instead
> > ensure that each transport augements the proper params -- and since
> > this is YANG 1.1, the transport params that are augmented can actually
> > be marked as mandatory.
> 
> Frankly, an empty mandatory choice quite clearly says "this is incomplete and
> unusable without an augmentation".

My read above is the YANG doctor's position is that we should *not* use the empty mandatory choice.  Let me know if I got this wrong.

That would mean that each transport document supporting configured subscriptions would then augment transport specific parameters to "/subscriptions/subscription/receivers/receiver".   And (assuming the "single transport" decision of IETF100 isn't changed), that the identity "transport" could be leveraged to enforce that only a single transport specific set of credentials are associated with a receiver.   

A sample YANG augmentation for NETCONF would then look like:

module ietf-netconf-subscribed-notifications {
 
  prefix nsn;
 
  import ietf-netconf-client { prefix ncc; }
  import ietf-subscribed-notifications { prefix sn; }

  identity netconf {
    base sn:transport;
    base sn:inline-address;
    description
      "NETCONF is used as a transport for notification messages and
       state change notifications.";
  }

  augment "/sn:subscriptions/sn:subscription/sn:receivers/sn:receiver" {
   when 'derived-from(../../../transport, "nsn:netconf")';   
   description
      "This augmentation allows NETCONF specific parameters to be 
      exposed for a receiver.";
    leaf netconf-endpoint {
      type leafref {
        path "/ncc:netconf-client/ncc:initiate/ncc:netconf-server" + 
                "/ncc:endpoints/ncc:endpoint/ncc:name";
      }
      mandatory true;
      description
        "Remote client which need to initiate the NETCONF transport if 
        an existing NETCONF session from that client is not available.";
    }
  }  
}

Which results in:
  +--rw subscriptions
     +--rw subscription* 
        +--rw transport         transport  {configured}?
        +--rw receivers
           +--rw receiver* 
              +--rw nsn:netconf-endpoint    leafref

Eric

 
> /js
> 
> --
> Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>