Re: [OSPF] [yang-doctors] Yangdoctors last call review of draft-ietf-ospf-yang-09

"Acee Lindem (acee)" <acee@cisco.com> Fri, 02 February 2018 00:18 UTC

Return-Path: <acee@cisco.com>
X-Original-To: ospf@ietfa.amsl.com
Delivered-To: ospf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 365B712E870; Thu, 1 Feb 2018 16:18:31 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -14.53
X-Spam-Level:
X-Spam-Status: No, score=-14.53 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, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-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 UBIAnPNPXq1t; Thu, 1 Feb 2018 16:18:29 -0800 (PST)
Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) (using TLSv1.2 with cipher DHE-RSA-SEED-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B77C612D7E9; Thu, 1 Feb 2018 16:18:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=21460; q=dns/txt; s=iport; t=1517530708; x=1518740308; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-id:content-transfer-encoding: mime-version; bh=KPV2QiPQe8ZPTeCDdos3fNjo9y0fuIEJLYw+JV6C+Cw=; b=iA3Y6j1RnLvudqD/H7yn5G/vo8VHJxgQ65DyVLKbA+Qp24kqketmA95n c/qFNqAJyfpQbNcvGS6uC3Zdz8X4+zHTjdtHEbBIFG4cKtYT95uvWNI9y wXHEVbK/ejs26wPNJNBx+i8IfkN3hmIrNBSiBwGjH6w13klSkopFX6/xd U=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0C6AABYrXNa/51dJa1UCRkBAQEBAQEBAQEBAQEHAQEBAQGDQoFbKAqDVookji2CApdIghcKhTsCGoIXVBgBAQEBAQEBAQJrKIUjAQEBAwEjEUUFCwIBCA4KAgImAgICMBUQAgQOBYotCK12gieKZAEBAQEBAQEBAQEBAQEBAQEBAQEBAR2BD4NaghWDaIMFgy8EgUUUFoMXMYIUIAWKZodfkV4CjBiJVIIehiOLcIgFjzkCERkBgTsBHzmBUHAVZwGBf4R3eIlzLIEGgRcBAQE
X-IronPort-AV: E=Sophos;i="5.46,444,1511827200"; d="scan'208";a="350928416"
Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 00:18:26 +0000
Received: from XCH-RTP-014.cisco.com (xch-rtp-014.cisco.com [64.101.220.154]) by rcdn-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id w120IQuj013081 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Fri, 2 Feb 2018 00:18:26 GMT
Received: from xch-rtp-015.cisco.com (64.101.220.155) by XCH-RTP-014.cisco.com (64.101.220.154) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Thu, 1 Feb 2018 19:18:25 -0500
Received: from xch-rtp-015.cisco.com ([64.101.220.155]) by XCH-RTP-015.cisco.com ([64.101.220.155]) with mapi id 15.00.1320.000; Thu, 1 Feb 2018 19:18:25 -0500
From: "Acee Lindem (acee)" <acee@cisco.com>
To: Martin Bjorklund <mbj@tail-f.com>
CC: "lhotka@nic.cz" <lhotka@nic.cz>, "yang-doctors@ietf.org" <yang-doctors@ietf.org>, "draft-ietf-ospf-yang.all@ietf.org" <draft-ietf-ospf-yang.all@ietf.org>, "ietf@ietf.org" <ietf@ietf.org>, "ospf@ietf.org" <ospf@ietf.org>
Thread-Topic: [yang-doctors] Yangdoctors last call review of draft-ietf-ospf-yang-09
Thread-Index: AQHTboUcIbs87wVZj0yzoeuFibmmLKNqkMSAgAEjW4CAAARAAIAAdfEAgAAD/ICAAAyegIABJEgAgBMhLoCAD+0xgIAAWWkA///OqoA=
Date: Fri, 02 Feb 2018 00:18:25 +0000
Message-ID: <13F95329-13A9-4B22-973A-24A1FC2BE1E8@cisco.com>
References: <20180110.103428.251892557297447292.mbj@tail-f.com> <2AECD072-7E95-4493-82E1-F83EA32F6F2E@cisco.com> <47F532E6-18A8-44C3-B8FA-CAB7B8959231@cisco.com> <20180201.231500.294238499203436586.mbj@tail-f.com>
In-Reply-To: <20180201.231500.294238499203436586.mbj@tail-f.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-exchange-messagesentrepresentingtype: 1
x-ms-exchange-transport-fromentityheader: Hosted
x-originating-ip: [10.116.152.198]
Content-Type: text/plain; charset="utf-8"
Content-ID: <17AFE20B29DD9C4197982025F0B8D624@emea.cisco.com>
Content-Transfer-Encoding: base64
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/ospf/S29WP6KqoYFqJ6zynT4nbndp58g>
Subject: Re: [OSPF] [yang-doctors] Yangdoctors last call review of draft-ietf-ospf-yang-09
X-BeenThere: ospf@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: The Official IETF OSPG WG Mailing List <ospf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ospf>, <mailto:ospf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ospf/>
List-Post: <mailto:ospf@ietf.org>
List-Help: <mailto:ospf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ospf>, <mailto:ospf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 02 Feb 2018 00:18:31 -0000

Hi Martin,
That works. 
Thanks,
Acee 

On 2/1/18, 5:15 PM, "Martin Bjorklund" <mbj@tail-f.com> wrote:

    Hi,
    
    The second argument must be a string, so you should add quotes:
    
      must "derived-from( "
         + "/rt:routing/rt:control-plane-protocols/"
         + "rt:control-plane-protocol[rt:name=current()]/"
         + "rt:type, 'ospf:ospf-protocol')";
        -------------^------------------^   
    
    
    /martin
    
    
    "Acee Lindem (acee)" <acee@cisco.com> wrote:
    > Martin, Lada,
    > 
    > I believe this got lost with all the discussion of schema mount/yang
    > library during roughly the same time frame.  You have both advocated
    > using derived-from()/dervived-from-or-self() for ietf-ospf.yang
    > checking. However, either I have misinterpreted the RFC 7950
    > description of these YANG functions or the yangvalidator validation is
    > broken. Please see below.
    > 
    > Thanks,
    > Acee 
    > 
    > On 1/22/18, 1:42 PM, "Acee Lindem (acee)" <acee@cisco.com> wrote:
    > 
    >     Hi Martin, Lada, 
    >     
    >     In experimenting with this, I get YANGLINT validation errors. I’m not
    >     sure what I’m missing but the first argument to
    >     derived-from()/derive-from-or-self() is the schema node and the second
    >     is the identity – correct?
    >     For example, the following YANG leaf:
    >     
    >     identity ospf-protocol {
    >         base "rt:routing-protocol";
    >         description "Any version the OSPF protocol";
    >       }
    >     
    >       identity ospfv2 {
    >         base "ospf-protocol";
    >         description "OSPFv2";
    >       }
    >     
    >       identity ospfv3 {
    >         base "ospf-protocol";
    >         description "OSPFv3";
    >       }
    >     
    >     leaf routing-protocol-name {
    >           type leafref {
    >             path "/rt:routing/rt:control-plane-protocols/"
    >                + "rt:control-plane-protocol/rt:name";
    >           }
    >           must "derived-from( "
    >     	+ "/rt:routing/rt:control-plane-protocols/"
    >             + "rt:control-plane-protocol[rt:name=current()]/"
    >             + "rt:type, ospf:ospf-protocol)";
    >           description
    >            "OSPF routing protocol instance name.";
    >         }
    >     
    >     Gives me: 
    >     
    >     warn: Schema node "ietf-ospf:ospf-protocol" not found (derived-from(
    >     /ietf-routing:routing/ietf-routing:control-plane-protocols/ietf-routing:control-plane-protocol[ietf-routing:name=current()]/ietf-routing:type,
    >     ietf-ospf:ospf-protocol) with context node
    >     "/ietf-ospf:if-state-change/routing-protocol-name".
    >     
    >     Thanks
    >     Acee 
    >     
    >     On 1/10/18, 4:36 AM, "Martin Bjorklund" <mbj@tail-f.com> wrote:
    >     
    >         Hi,
    >         
    >         I think we can agree that the model in this I-D should use
    >         derived-from-or-self() instead of string comparison, and conclude this
    >         discussion here.  I suggest that if we need to further discuss the
    >         representation of identityrefs, then we start a new thred on the
    >         NETMOD ML.
    >         
    >         
    >         /martin
    >         
    >         
    >         
    >         Ladislav Lhotka <lhotka@nic.cz> wrote:
    >         > On Tue, 2018-01-09 at 16:23 +0100, Martin Bjorklund wrote:
    >         > > Ladislav Lhotka <lhotka@nic.cz> wrote:
    >         > > > On Tue, 2018-01-09 at 09:06 +0100, Martin Bjorklund wrote:
    >         > > 
    >         > > > > Hi,
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > Ladislav Lhotka <lhotka@nic.cz> wrote:
    >         > > 
    >         > > > > > Hi Acee,
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > please see inline.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > On Mon, 2018-01-08 at 19:28 +0000, Acee Lindem (acee) wrote:
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > Hi Lada,
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > Apologies for the delay. We somewhat got hung up on 4 and
    >         > > > > > > 6. See
    >         > > inline.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > On 12/6/17, 6:26 AM, "Ladislav Lhotka" <lhotka@nic.cz>
    >         > > > > > > wrote:
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > > Reviewer: Ladislav Lhotka
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > > Review result: Ready with Issues
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > ...
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > > 3. Maybe the draft could mention that implementations
    >         > > > > > > > should supply
    >         > > a
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > >   default routing domain as a system-controlled resource.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > Isn’t this more of an RFC8022BIS statement? I guess we
    >         > > > > > > could state
    >         > > this as
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > an assumption.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > Probably, but it is not a YANG issue, so I'd leave it to you
    >         > > > > > routing
    >         > > folks
    >         > > 
    >         > > > > to
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > decide.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > >  
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > > 4. In "when" expressions, the module uses literal strings
    >         > > > > > > > for
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > >   identities. This is known to be problematic, the XPath
    >         > > > > > > >   functions
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > >   derived-from() or derived-from-or-self() should be used
    >         > > > > > > >   instead.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > > Why is this problematic? Is it because the types can be
    >         > > > > > > extended?
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > That's one reason: derived identities should often also
    >         > > > > > satisfy the
    >         > > 
    >         > > > > constraint.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > But the more serious problem is that things like
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > >     when "../../../../../../../rt:type = 'ospf:ospfv3'"
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > rely on plain string comparison that depends od the actual
    >         > > > > > prefix used
    >         > > for
    >         > > 
    >         > > > > the
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > "rt:type" value. For one, according to RFC 7951 the JSON
    >         > > > > > encoding of
    >         > > this
    >         > > 
    >         > > > > value
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > > would be "ietf-ospf:ospfv3" so the above expression is always
    >         > > > > > false.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > This is not correct; the when expression is not evaluated on
    >         > > > > the JSON
    >         > > 
    >         > > > > encoding.  See the last paragraph of section 9.10.3 in RFC
    >         > > > > 7950:
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > >    The string value of a node of type "identityref" in a "must"
    >         > > > >    or
    >         > > 
    >         > > > >    "when" XPath expression is the referred identity's qualified
    >         > > > >    name
    >         > > 
    >         > > > >    with the prefix present.  If the referred identity is
    >         > > > >    defined in an
    >         > > 
    >         > > > >    imported module, the prefix in the string value is the
    >         > > > >    prefix defined
    >         > > 
    >         > > > >    in the corresponding "import" statement.  Otherwise, the
    >         > > > >    prefix in
    >         > > 
    >         > > > >    the string value is the prefix for the current module.
    >         > > 
    >         > > > 
    >         > > 
    >         > > > This is weird, to say the least. The leafref instance may have an
    >         > > > identity
    >         > > value
    >         > > 
    >         > > > that is defined in a module that (has to be implemented by the
    >         > > > server but)
    >         > > 
    >         > > > needn't be imported in the module that contains the XPath
    >         > > > expression. So I
    >         > > don't
    >         > > 
    >         > > > know what 'corresponding "import" statement' this paragraph is
    >         > > > talking
    >         > > about.
    >         > > 
    >         > > 
    >         > > It has to import the module in order to give a prefix, which then
    >         > > can
    >         > > be used in the XPath expression.
    >         > 
    >         > In the XPath expression above, do you mean the "rt" prefix of
    >         > "rt:type"? If so,
    >         > it is irrelevant for the string comparison, what's important is the
    >         > *value* of
    >         > the "rt:type" instance, which can be an identity defined in a module
    >         > that
    >         > needn't be imported by ietf-routing, ietf-ospf or
    >         > whatever. Sec. 9.10.2:
    >         > 
    >         >    On a particular server, the valid values are further restricted to
    >         >    the set of
    >         >      identities defined in the modules implemented by the server.
    >         > 
    >         > > 
    >         > > > Also, potentially there can be a collision in prefixes and then
    >         > > > this also
    >         > > breaks
    >         > > 
    >         > > > down.
    >         > > 
    >         > > 
    >         > > No, two modules cannot be imported with the same prefix.
    >         > 
    >         > I have to disagree. An identity derived from the
    >         > "ietf-routing:control-protocol-
    >         > type" base identity can be defined in a module that is not imported
    >         > anywhere. If
    >         > a server declares such a module as implemented, then "rt:type" may
    >         > have this
    >         > value per sec. 9.10.2.
    >         > 
    >         > And, consequently, there may be two different modules with
    >         > conflicting prefixes
    >         > defining identities that are derived from
    >         > "ietf-routing:control-protocol-type".
    >         > 
    >         > > 
    >         > > > A moral of the namespace/prefix story in XML was that relying of
    >         > > > namespace
    >         > > 
    >         > > > prefixes having a particular value is a really bad idea. I know
    >         > > > that the
    >         > > cited
    >         > > 
    >         > > > paragraph was intended to make such XPath string comparisons more
    >         > > deterministic,
    >         > > 
    >         > > > but it is also problematic and should be avoided if possible.
    >         > > 
    >         > > 
    >         > > Note that this prefix is under the control of the module designer
    >         > > writing the XPath expression.  The same identityref value might use
    >         > > a
    >         > 
    >         > No, it is not. The prefixes appear in instance data.
    >         > 
    >         > Lada
    >         > 
    >         > > different prefix in some other module.
    >         > > 
    >         > > 
    >         > > /martin
    >         > > 
    >         > > 
    >         > > 
    >         > > > 
    >         > > 
    >         > > > Lada
    >         > > 
    >         > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > So the equality test of the identityref is correct.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > However, I agree that in most cases 'derived-from-or-self'
    >         > > > > should be
    >         > > 
    >         > > > > used, in order to handle derived identities.
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > 
    >         > > 
    >         > > > > /martin
    >         > > 
    >         > > > -- 
    >         > > 
    >         > > > Ladislav Lhotka
    >         > > 
    >         > > > Head, CZ.NIC Labs
    >         > > 
    >         > > > PGP Key ID: 0xB8F92B08A9F76C67
    >         > > 
    >         > > > 
    >         > > 
    >         > -- 
    >         > Ladislav Lhotka
    >         > Head, CZ.NIC Labs
    >         > PGP Key ID: 0xB8F92B08A9F76C67
    >         > 
    >         
    >     
    >     
    > 
    >