[yang-doctors] YANG Augmentation Complexities

"Acee Lindem (acee)" <acee@cisco.com> Mon, 30 April 2018 20:13 UTC

Return-Path: <acee@cisco.com>
X-Original-To: yang-doctors@ietfa.amsl.com
Delivered-To: yang-doctors@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 5BAE412D86E for <yang-doctors@ietfa.amsl.com>; Mon, 30 Apr 2018 13:13:38 -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=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 GPDmxFSZzU4m for <yang-doctors@ietfa.amsl.com>; Mon, 30 Apr 2018 13:13:36 -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 2678812708C for <yang-doctors@ietf.org>; Mon, 30 Apr 2018 13:13:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=30822; q=dns/txt; s=iport; t=1525119215; x=1526328815; h=from:to:cc:subject:date:message-id:mime-version; bh=UFp5FLCM3QthvzW03kuLUzzG/T4gZTUz/3lb3i+Pbjs=; b=TK5QW+/TsZACg5llYfw0cNPgZR2JvxuHuvedf37nqvTKPuzIP1dClueY iVHf2eNw59rPhfe3zYtxet7W3WrMoKO2KwJwHaugUlGOcS4zMbVsz/4yz go+QG7BgWvNGN0ZE7PaZPwWGL/aDnHzZS2Z1vt+FKnAyCUK0FhJyMv3Ep w=;
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DiAgBseOda/5xdJa1TCRkBAQEBAQEBAQEBAQEHAQEBAQGCTXZhF2Myg2KUfYFTgTCTFIF4C4RsHIJZITUXAQIBAQEBAQECbCiFUgpMEgFACgIEMCcEAQ2EMGSndIIchFiDa4JHiBaCE4EOASMMhyWDKjCCJAKYEggCjkmMV5AVAhETAYEkAR4BNUCBEnAVZQGCGZBNjz6BGAEB
X-IronPort-AV: E=Sophos;i="5.49,348,1520899200"; d="scan'208,217";a="378238808"
Received: from rcdn-core-5.cisco.com ([173.37.93.156]) by rcdn-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Apr 2018 20:13:32 +0000
Received: from XCH-RTP-013.cisco.com (xch-rtp-013.cisco.com [64.101.220.153]) by rcdn-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id w3UKDWmp010112 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Mon, 30 Apr 2018 20:13:32 GMT
Received: from xch-rtp-015.cisco.com (64.101.220.155) by XCH-RTP-013.cisco.com (64.101.220.153) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Mon, 30 Apr 2018 16:13:31 -0400
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; Mon, 30 Apr 2018 16:13:31 -0400
From: "Acee Lindem (acee)" <acee@cisco.com>
To: Ladislav Lhotka <lhotka@nic.cz>, Martin Bjorklund <mbj@tail-f.com>
CC: YANG Doctors <yang-doctors@ietf.org>
Thread-Topic: YANG Augmentation Complexities
Thread-Index: AQHT4L+1x8Jw4/r5W0Kl70tc3mxn+A==
Date: Mon, 30 Apr 2018 20:13:31 +0000
Message-ID: <42660D47-116B-4282-AEDE-CBB1D8786598@cisco.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.196]
Content-Type: multipart/alternative; boundary="_000_42660D47116B4282AEDECBB1D8786598ciscocom_"
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/yang-doctors/C6ieTOFzFql1vo4XFQwSQevNU7w>
Subject: [yang-doctors] YANG Augmentation Complexities
X-BeenThere: yang-doctors@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Email list of the yang-doctors directorate <yang-doctors.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/yang-doctors/>
List-Post: <mailto:yang-doctors@ietf.org>
List-Help: <mailto:yang-doctors-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/yang-doctors>, <mailto:yang-doctors-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 30 Apr 2018 20:13:38 -0000

Hi Lada, Martin,

Both of you provided YANG doctor comments and proposed usage of identity references for OSPF(v3) LSA types. However, I can’t seem to provide constraints in augmentations using these. Here is the snippet I’m trying to augment in a new model:

       |           |              +--:(ospfv3)
       |           |                 +--ro ospfv3
       |           |                    +--ro header
       |           |                    |  +--ro lsa-id        uint32
       |           |                    |  +--ro age           uint16
       |           |                    |  +--ro type          identityref
       |           |                    |  +--ro adv-router    yang:dotted-quad
       |           |                    |  +--ro seq-num       uint32
       |           |                    |  +--ro checksum      fletcher-checksum16-type
       |           |                    |  +--ro length        uint16
       |           |                    +--ro body
       |           |                       +--ro router
       |           |                       |  +--ro flags      bits
       |           |                       |  +--ro options    bits
       |           |                       |  +--ro links
       |           |                       |     +--ro link*
       |           |                       |        +--ro interface-id?            uint32
       |           |                       |        +--ro neighbor-interface-id?   uint32
       |           |                       |        +--ro neighbor-router-id?      rt-types:router-id
       |           |                       |        +--ro type?                    uint8
       |           |                       |        +--ro metric?                  uint16

If I try to augment the body, I get an error using the YANG when statement and the derived-from-or-self() function.

  grouping ospfv3-e-lsa-body {
    description "OSPFv3 Extended LSA body.";
    container e-router {
      when  "derived-from-or-self(../header/type, "
        + "'ospfv3-e-router-lsa')" {
        description "Only valid for OSPFv3 Extended-Router LSAs";
      }
      description "OSPv3 Extended Router LSA.";

augment "/rt:routing/"
    + "rt:control-plane-protocols/rt:control-plane-protocol/"
    + "ospf:ospf/ospf:areas/ospf:area/ospf:database/"
    + "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
    + "ospf:area-scope-lsa/ospf:version/ospf:ospfv3/"
    + "ospf:ospfv3/ospf:body" {
    when "../../../../../../../../../"
      + "rt:type = 'ospf:ospfv3'" {
      description
        "This augmentation is only valid for OSPFv3
         E-Router LSAs";
    }
    uses ospfv3-e-lsa-body;
    description
      "OSPFv3 Area-Scoped Extended LSAs";
  }

I get the error:

ACEE-M-G2HR:ospf-extended-lsa-yang acee$ pyang ietf-ospfv3-extended-lsa.yang
ietf-ospfv3-extended-lsa.yang:131: error: XPath function "derived-from-or-self" is not defined in the XPath context
ietf-ospfv3-extended-lsa.yang:285 (at /Users/acee/yang/modules/ietf-ospf.yang:1196): error: cannot augment with mandatory node options

If I try and augment one level up and put both constraints on the augmentation, I get the same error.

  + "rt:control-plane-protocols/rt:control-plane-protocol/"
    + "ospf:ospf/ospf:areas/ospf:area/ospf:database/"
    + "ospf:area-scope-lsa-type/ospf:area-scope-lsas/"
    + "ospf:area-scope-lsa/ospf:version/ospf:ospfv3/"
    + "ospf:ospfv3" {
    when "../../../../../../../../../"
       + "rt:type = 'ospf:ospfv3' and "
       + "derived-from-or-self(header/type, "
       + "'ospfv3-e-router-lsa')" {
      description
        "This augmentation is only valid for OSPFv3
         E-Router LSAs";
    }
    uses ospfv3-e-lsa-body;
    description
      "OSPFv3 Area-Scoped Extended LSAs";
  }

Thanks,
Acee