Re: [netmod] ?= mandatory choice with non-presence container cas

"Rob Wilton (rwilton)" <rwilton@cisco.com> Tue, 25 June 2019 09:08 UTC

Return-Path: <rwilton@cisco.com>
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 0E89D1205D7 for <netmod@ietfa.amsl.com>; Tue, 25 Jun 2019 02:08:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.5
X-Spam-Level:
X-Spam-Status: No, score=-14.5 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, 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 header.b=U4I6WbqT; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.b=TbN/ClFz
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 FedjpCH1dfFD for <netmod@ietfa.amsl.com>; Tue, 25 Jun 2019 02:08:29 -0700 (PDT)
Received: from rcdn-iport-3.cisco.com (rcdn-iport-3.cisco.com [173.37.86.74]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D7D05120470 for <netmod@ietf.org>; Tue, 25 Jun 2019 02:08:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=6598; q=dns/txt; s=iport; t=1561453708; x=1562663308; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=DyYelnOTde9vy/ZNF3lizx0ofCtaWedV4BahwYWfGqc=; b=U4I6WbqTkpvU/jxwmJ996H6QyCIeW2s0lXHKq/GATU7AC1EvE/3PkY6G VLpCrSjz3XynsI1EbveHJGVcsmvGo06Q1Snkr2lmjNgsuVcbrX3vo/i4a 4EUd1vFKnKwWlrCXnH1yI0PbPy4sc+qhLtWuD8Fym/ld7CmNOrTEq4/O2 I=;
IronPort-PHdr: 9a23:ztVSOR3EQ2DPzD2IsmDT+zVfbzU7u7jyIg8e44YmjLQLaKm44pD+JxKHt+51ggrPWoPWo7JfhuzavrqoeFRI4I3J8RVgOIdJSwdDjMwXmwI6B8vQE1L6KOLtaQQxHd9JUxlu+HToeUU=
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0AGAAAW5BFd/5RdJa1lGQEBAQEBAQEBAQEBAQcBAQEBAQGBUwQBAQEBAQsBgUNQA2pVIAQLKAqEDINHA4RSig+CW5c4gS6BJANUCQEBAQwBARgLCgIBAYN6RgIXglsjNAkOAQMBAQQBAQIBBW2KNwyFSgEBAQEDAQEQEREMAQEsCwELBAIBCBEEAQEBAgImAgICJQsVCAgCBAENBQgagwGBagMdAQIMmWUCgTiIX3GBMYJ5AQEFhQIYghEDBoEMKAGLXReBQD+BV4JMPoJhAQECAYFIGAUQI4JQMoImi3uCWIcglCMJAoIUhk+NM5dKjSiHNI9XAgQCBAUCDgEBBYFQOIFYcBU7gmyCQYNwhRSFP3IBAYEnjCQrgQQBgSABAQ
X-IronPort-AV: E=Sophos;i="5.63,415,1557187200"; d="scan'208";a="569447938"
Received: from rcdn-core-12.cisco.com ([173.37.93.148]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 25 Jun 2019 09:08:27 +0000
Received: from XCH-RCD-002.cisco.com (xch-rcd-002.cisco.com [173.37.102.12]) by rcdn-core-12.cisco.com (8.15.2/8.15.2) with ESMTPS id x5P98ROY006547 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 25 Jun 2019 09:08:27 GMT
Received: from xhs-rtp-001.cisco.com (64.101.210.228) by XCH-RCD-002.cisco.com (173.37.102.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 25 Jun 2019 04:08:27 -0500
Received: from xhs-rtp-003.cisco.com (64.101.210.230) by xhs-rtp-001.cisco.com (64.101.210.228) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 25 Jun 2019 05:08:26 -0400
Received: from NAM02-BL2-obe.outbound.protection.outlook.com (64.101.32.56) by xhs-rtp-003.cisco.com (64.101.210.230) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 25 Jun 2019 05:08:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DyYelnOTde9vy/ZNF3lizx0ofCtaWedV4BahwYWfGqc=; b=TbN/ClFzoEVJE6I5YQei3+cA3Qapq6bkkIaTOlhSqQaX/PhVQmySmAIqKwYVCMl/o69OFpNvD5XQ5wr0FabT7a2NcPOzuLvlPDd9Sn+9H6iJg0yUOciuaaNhC66N3FPD388vBf6KrtIFfirwAIVM0KbF+ntbclSA0OY1p7gxlvA=
Received: from BYAPR11MB2631.namprd11.prod.outlook.com (52.135.227.28) by BYASPR01MB6.namprd11.prod.outlook.com (52.135.221.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Tue, 25 Jun 2019 09:08:24 +0000
Received: from BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045]) by BYAPR11MB2631.namprd11.prod.outlook.com ([fe80::ed99:b6a8:d6fb:5045%4]) with mapi id 15.20.2008.017; Tue, 25 Jun 2019 09:08:24 +0000
From: "Rob Wilton (rwilton)" <rwilton@cisco.com>
To: Michal Vaško <mvasko@cesnet.cz>, Andy Bierman <andy@yumaworks.com>
CC: netmod <netmod@ietf.org>
Thread-Topic: [netmod] ?= mandatory choice with non-presence container cas
Thread-Index: AQHVKrB0TPOIokG5I0ClVRwvOYWW46asEe7w
Date: Tue, 25 Jun 2019 09:08:24 +0000
Message-ID: <BYAPR11MB263192DBFAA0F634DBCF0A85B5E30@BYAPR11MB2631.namprd11.prod.outlook.com>
References: <CABCOCHSYeRCsSKsNSEWeifX3Dpm80KawdioZSJua6jF3-R+f7w@mail.gmail.com> <ad3-5d110500-55-63a2bc80@40796557>
In-Reply-To: <ad3-5d110500-55-63a2bc80@40796557>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=rwilton@cisco.com;
x-originating-ip: [173.38.220.41]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: 8b868db5-228a-4869-3fc0-08d6f94cadad
x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:BYASPR01MB6;
x-ms-traffictypediagnostic: BYASPR01MB6:
x-ms-exchange-purlcount: 2
x-microsoft-antispam-prvs: <BYASPR01MB6E140BBA6515D1B41E500B5E30@BYASPR01MB6.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 0079056367
x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(346002)(366004)(136003)(13464003)(199004)(189003)(53546011)(6506007)(66556008)(76176011)(66446008)(66476007)(64756008)(110136005)(316002)(486006)(14454004)(256004)(53936002)(14444005)(52536014)(26005)(102836004)(7696005)(66946007)(478600001)(76116006)(186003)(86362001)(6246003)(73956011)(229853002)(25786009)(5660300002)(8936002)(4326008)(2906002)(3846002)(66574012)(6116002)(68736007)(33656002)(55016002)(81166006)(81156014)(8676002)(7736002)(305945005)(74316002)(71200400001)(71190400001)(6306002)(476003)(11346002)(446003)(9686003)(966005)(66066001)(99286004)(6436002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYASPR01MB6; H:BYAPR11MB2631.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: gwxcoTzZ3o38U44hYlu/t+uN2lggpTadEbfrym+2b9hLQYnjZyh2EJNLY43MfjTRy3rNFF/qqLFux87fxzBUSoI9yQxDOcqVlPmHOshNI/lKXYYmx1wyGgo9wJs0HxlbSab1GGyH+YO/ZPvLQ1QJg9lKePBJg+rAyaquQehRqmPFfI3+MOeGoP/P+Bq5rssrP7IRv6oxGrIQdCGdqvz/ejJehKz/yJSw8XBvMXuI2wg8MiFmzuR3+fV/o7EZama7dwJpNRlLo+JTV22N0Dsm6/VvjnHgle9wM3ZlLlR8kbBVzke7j7Mau4NxDDVnHICeQe0Ll6iRFZ1ZbaTGIfJ6GCZRP+iqaCG8KEpnNUD5EO+p6YTkG5f0wtwoEUJ5a/03cCLxUIbxzvwtRk5VPuCJbaEIIAK+hHmY+fAo+eNLofk=
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: 8b868db5-228a-4869-3fc0-08d6f94cadad
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jun 2019 09:08:24.4248 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: rwilton@cisco.com
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYASPR01MB6
X-OriginatorOrg: cisco.com
X-Outbound-SMTP-Client: 173.37.102.12, xch-rcd-002.cisco.com
X-Outbound-Node: rcdn-core-12.cisco.com
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/dMsY4BcEo1WWO-6sUd3TLdKgoqc>
Subject: Re: [netmod] ?= mandatory choice with non-presence container cas
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: Tue, 25 Jun 2019 09:08:38 -0000

Hi Michal,

It is not the printing of the data that makes it valid/invalid.

I don't think that your input data was ever valid, because "container C" doesn't satisfy the mandatory statement because it isn't a real data node in the tree - it is instantiated when required and may be deleted when it is no longer required.

I.e. your model has been designed such that it can never be satisfied.


If your model was instead:

container TOP {
  leaf L {
    type empty;
  }
  choice A {
    mandatory true;
    container C {
      leaf L2 {
        type empty;
      }
    }
  }
}


Then this data is valid:

<TOP>
  <L/>
  <C>
   <L2/>
  </C>
</TOP>


But this data is not:

<TOP>
  <L/>
</TOP>


Nor is this, which is directly equivalent to the one above, because the <C/> container doesn't really exist if it doesn't have a child node present.

<TOP>
  <L/>
  <C/>
</TOP>

Thanks,
Rob


> -----Original Message-----
> From: Michal Vaško <mvasko@cesnet.cz>
> Sent: 24 June 2019 18:15
> To: Andy Bierman <andy@yumaworks.com>
> Cc: Rob Wilton (rwilton) <rwilton@cisco.com>; netmod <netmod@ietf.org>
> Subject: Re: [netmod] ?= mandatory choice with non-presence container cas
> 
> Hi Andy,
> 
> On Monday, June 24, 2019 19:11 CEST, Andy Bierman <andy@yumaworks.com>
> wrote:
> 
> > On Mon, Jun 24, 2019 at 10:01 AM Michal Vaško <mvasko@cesnet.cz> wrote:
> >
> > > Hi Rob,
> > > I think there is a problem in the RFC because using only allowed
> > > steps I got invalid data from initially valid data. That cannot be
> correct.
> > >
> > >
> > No.  See sec. 7.5.7
> >
> >    If a non-presence container does not have any child nodes, the
> >    container may or may not be present in the XML encoding.
> >
> >
> > Just because your retrieval does not contain the NP-container, that
> > does not mean the NP-container was not present in the server for the
> > mandatory-stmt validation.
> 
> I agree, but these valid data were correctly printed into invalid data. I
> do not think printing is allowed to change the validity of data.
> 
> Michal
> 
> >
> > Regards,
> > > Michal
> > >
> > >
> > Andy
> >
> >
> > > On Monday, June 24, 2019 18:52 CEST, "Rob Wilton (rwilton)" <
> > > rwilton@cisco.com> wrote:
> > >
> > > > Hi Michal,
> > > >
> > > > My thoughts:
> > > >
> > > > According to 7.5.1:
> > > >
> > > >    In the first style, the container has no meaning of its own,
> existing
> > > >    only to contain child nodes.  In particular, the presence of the
> > > >    container node with no child nodes is semantically equivalent to
> the
> > > >    absence of the container node.  YANG calls this style a "non-
> presence
> > > >    container".  This is the default style.
> > > >
> > > > Hence your request (because the NP container does not have any
> > > > children)
> > > is equivalent to:
> > > >
> > > >  <TOP>
> > > >    <L/>
> > > >  </TOP>
> > > >
> > > > which fails the "mandatory" check.
> > > >
> > > > Thanks,
> > > > Rob
> > > >
> > > >
> > > > > -----Original Message-----
> > > > > From: netmod <netmod-bounces@ietf.org> On Behalf Of Michal Vaško
> > > > > Sent: 24 June 2019 17:39
> > > > > To: netmod <netmod@ietf.org>
> > > > > Subject: [netmod] mandatory choice with non-presence container
> > > > > case
> > > > >
> > > > > Hi,
> > > > > I have encountered a situation that I think is not covered by
> > > > > RFC
> > > 7950. My
> > > > > specific use-case was as follows.
> > > > >
> > > > > model:
> > > > >
> > > > > container TOP {
> > > > >   leaf L {
> > > > >     type empty;
> > > > >   }
> > > > >   choice A {
> > > > >     mandatory true;
> > > > >     container C;
> > > > >   }
> > > > > }
> > > > >
> > > > > data:
> > > > >
> > > > > <TOP>
> > > > >   <L/>
> > > > >   <C/>
> > > > > </TOP>
> > > > >
> > > > > Parsing was successful, but printing these data back to XML
> produced:
> > > > >
> > > > > <TOP>
> > > > >   <L/>
> > > > > </TOP>
> > > > >
> > > > > and parsing this correctly failed with missing mandatory choice.
> > > According
> > > > > to section 7.5.7 [1], I think the C container could be omitted
> > > > > but the whole situation does not seem correct. Thank you for any
> input.
> > > > >
> > > > > Regards,
> > > > > Michal
> > > > >
> > > > > [1] https://tools.ietf.org/html/rfc7950#section-7.5.7
> > > > >
> > > > > _______________________________________________
> > > > > netmod mailing list
> > > > > netmod@ietf.org
> > > > > https://www.ietf.org/mailman/listinfo/netmod
> > >
> > >
> > >
> > > _______________________________________________
> > > netmod mailing list
> > > netmod@ietf.org
> > > https://www.ietf.org/mailman/listinfo/netmod
> > >
> 
>