[netmod] three questions about YANG deviation statement

"Zhengguangying (Walker)" <zhengguangying@huawei.com> Wed, 11 July 2018 03:05 UTC

Return-Path: <zhengguangying@huawei.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 BF0D7130DD3 for <netmod@ietfa.amsl.com>; Tue, 10 Jul 2018 20:05:30 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 J6-NfraLvYFL for <netmod@ietfa.amsl.com>; Tue, 10 Jul 2018 20:05:29 -0700 (PDT)
Received: from huawei.com (lhrrgout.huawei.com [185.176.76.210]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 988B7124D68 for <netmod@ietf.org>; Tue, 10 Jul 2018 20:05:28 -0700 (PDT)
Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id F35AA3945D0CE for <netmod@ietf.org>; Wed, 11 Jul 2018 04:05:24 +0100 (IST)
Received: from NKGEML412-HUB.china.huawei.com (10.98.56.73) by LHREML713-CAH.china.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.382.0; Wed, 11 Jul 2018 04:05:25 +0100
Received: from NKGEML513-MBX.china.huawei.com ([169.254.1.13]) by nkgeml412-hub.china.huawei.com ([10.98.56.73]) with mapi id 14.03.0382.000; Wed, 11 Jul 2018 11:05:16 +0800
From: "Zhengguangying (Walker)" <zhengguangying@huawei.com>
To: "netmod@ietf.org" <netmod@ietf.org>, "Yangang (Routing Design)" <yangang@huawei.com>, Yangshouchuan <yangshouchuan@huawei.com>, "Qudan (Beijing-NOS)" <qudan.qudan@huawei.com>, Qin Wu <bill.wu@huawei.com>
Thread-Topic: [netmod] three questions about YANG deviation statement
Thread-Index: AdQYw+JeFHRcJ83VT/e5cB1803Ckag==
Date: Wed, 11 Jul 2018 03:05:16 +0000
Message-ID: <381D7D55085B1E4D8B581BD652E1E140C9313AA9@nkgeml513-mbx.china.huawei.com>
Accept-Language: zh-CN, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [10.134.169.155]
Content-Type: multipart/alternative; boundary="_000_381D7D55085B1E4D8B581BD652E1E140C9313AA9nkgeml513mbxchi_"
MIME-Version: 1.0
X-CFilter-Loop: Reflected
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/dNYSEOe_gl0useziwSE9OuJgtnE>
Subject: [netmod] three questions about YANG deviation statement
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.27
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: Wed, 11 Jul 2018 03:05:31 -0000

Hi all,
   When we try to implementing, there are 3 questions want to clear on WG, please expert help to answer the questions, thanks.


[Question 1]: whether "mandatory true" node can be deviated as "not-supported" ?

[Question 2]: Whether can deviation YANG to expand the range of type?

   example:

 target YANG node:
 leaf a {
  type uint 8 {
    range "1..50";
  }
}

deviation yang:

deviation "/a:a" {
  replace type {
    range "1..100";
  }
}

[Question 3]: How to use a new type defined by "typedef" to deviate replace the target module's type.

example:
module example-base {
      namespace "urn:example-base";
      prefix base;

      container system {
        description
         "System group configuration.";
        leaf daytime {
           type string;
        }
        leaf date {
           type string;
        }
        leaf interface {
           type string;
        }
        leaf status {
           type string;
           config false;
        }
      }
}

module example-deviations {
       yang-version 1.1;
       namespace "urn:example:deviations";
       prefix md;

       import example-base {
         prefix base;
       }

       import ietf-interfaces {
         prefix if;
       }

       // here, define a new type with typedef statement
       typedef date-and-time {
         type string {
           pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
             + '(Z|[\+\-]\d{2}:\d{2})';
         }
        }

       // try to replace the target node's type with new typedef type
       deviation /base:system/base:date {
         deviate replace {
            type date-and-time;
         }
       }

        deviation /base:system/base:interface {
         deviate replace {
            type leafref {
                    path "/if:interfaces/if:interface/if:name";
                }              }
       }
       ...
     }


problem 1: when use new type defined in deviation YANG file to replace the target node's type, some tools give compile error, because they can not find the definition of new type "date-and-time" . From the YANG language view, this error looks reasonable, but how to replace the target node with newly deifned type?

problem 2: when try to replace the type to leafref a xpath which not imported in the target module, it have the compile error too, then how to replace the target node with another module's xpath?


Thanks
Walker(Guangying zheng)