Re: [core] draft-bierman-core-yid-00.txt questions

Michel Veillette <Michel.Veillette@trilliantinc.com> Thu, 25 August 2016 15:55 UTC

Return-Path: <Michel.Veillette@trilliantinc.com>
X-Original-To: core@ietfa.amsl.com
Delivered-To: core@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7E8BE12D831 for <core@ietfa.amsl.com>; Thu, 25 Aug 2016 08:55:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.921
X-Spam-Level:
X-Spam-Status: No, score=-1.921 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=trilliant.onmicrosoft.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 xvtRKRjYAG-j for <core@ietfa.amsl.com>; Thu, 25 Aug 2016 08:54:57 -0700 (PDT)
Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0135.outbound.protection.outlook.com [104.47.40.135]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6BFEF12D15A for <core@ietf.org>; Thu, 25 Aug 2016 08:54:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Trilliant.onmicrosoft.com; s=selector1-trilliantinc-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=MJj8Dn9FIAAluEcIKngXeLWQDOVupbLj1X3kRLU6/L0=; b=lasqTHxATigZNw/RHMRfluHWwsp8QmjiqBFQTDKChLyi1R6a3BDUMp/jGlbzCjMA4KSN6WSc0SnxXGTq3byea2ssDaJ/l+f41Rs8HDbL8jiX+nb2FpYYmGfRTUdqgGQpEAEYwCE5xTekiepumgqFfSAb2AfjdoiQs5HPdvO73Bg=
Received: from BN6PR06MB2308.namprd06.prod.outlook.com (10.173.19.139) by BN6PR06MB2308.namprd06.prod.outlook.com (10.173.19.139) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Thu, 25 Aug 2016 15:54:51 +0000
Received: from BN6PR06MB2308.namprd06.prod.outlook.com ([10.173.19.139]) by BN6PR06MB2308.namprd06.prod.outlook.com ([10.173.19.139]) with mapi id 15.01.0557.030; Thu, 25 Aug 2016 15:54:51 +0000
From: Michel Veillette <Michel.Veillette@trilliantinc.com>
To: Andy Bierman <andy@yumaworks.com>
Thread-Topic: [core] draft-bierman-core-yid-00.txt questions
Thread-Index: AQHR/oAwnsXgBk9RvEWD4CzBgA9zo6BZtb8wgAAZbwCAAAFWcA==
Date: Thu, 25 Aug 2016 15:54:51 +0000
Message-ID: <BN6PR06MB23081868474C1EBEF6124A07FEED0@BN6PR06MB2308.namprd06.prod.outlook.com>
References: <BN6PR06MB2308A46F6A84378832DBC849FEEA0@BN6PR06MB2308.namprd06.prod.outlook.com> <201608250324.u7P3OTAI005926@mainfs.snmp.com> <BN6PR06MB2308826651FF40B1BB08F39CFEED0@BN6PR06MB2308.namprd06.prod.outlook.com> <CABCOCHQrNrYkC5yZLou33own9q+h0yn9+GogEWcm4q1CP+6jVw@mail.gmail.com>
In-Reply-To: <CABCOCHQrNrYkC5yZLou33own9q+h0yn9+GogEWcm4q1CP+6jVw@mail.gmail.com>
Accept-Language: fr-CA, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=Michel.Veillette@trilliantinc.com;
x-originating-ip: [207.96.192.122]
x-ms-office365-filtering-correlation-id: 84195c57-5498-48f4-07ff-08d3cd002671
x-microsoft-exchange-diagnostics: 1; BN6PR06MB2308; 6:TMuT9HaPIarAL6F9QcniwZ5aLtgABX5S5Dw/10wzzH48xk/1SuP58akQtm0ge49+6zqrwTptf80cgZnOilFVhLZjYUlnCqIGpKMLeO12kIln93llxkQOI1mQMNzy2YAbIccmW/y8f6dLs9EpGY8rrEmXmu/W7bPjT7TvLaJ1zI0taDGn30fgAsKx0AM3c/qzIIGRvMLRAv3LP0zu5NWlmnnCqNO32LK3K5qw/fc26v/tqYwG8FcLr5bp62I+vOUQEhvk2jsilJ1r7W1cilprV9aGQy80mfKHeLlS9VCra/k=; 5:fXINqBVNqTXFx9yJC8L2iwMM16VLm27LL2zHhPDG/ITPKPyTp5XZyHru1nRqZIZn2Ky8vmIuDaCn1nlPP8UuhhsfAVO5fcZu/aFESVbVzrIOP/O4zZ1nZ56tmtnYcMpH+glsTYs2TJrEe003c8P+Lg==; 24:zVDn6VGjLyIYOs8y9Qe2nVyyCeBDe/Dnv8UgFySGTZL4wbB7tpSaPL8upRF3VP3pwWkBn8HFVR4nDWhkGnE3rPfDc3wpCwzixtfcXPdwZOA=; 7:HuMJbjr34i8aK090K45vuNSCcGtmtYjCoo6nhF3XxFykNxYj7s4kuct9Qk54xImtJ+KPC1y3xzOlKcj3PM/ITyUewHBKEFzSsFweSkfX84Ju3pHBX8Ll0Y40DVB1DDQInXfXctsfxeN+yUkY1t3WCJwSUicASVWraUuB7SBeLZ1V5l3Docz36Mc96JM54ni3x71Jj+bCEt952TFPAw0UmYkMjR5vn0nZZ4J08Jo2RWL7N8xar4/WkpHyKXPB/slM
x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR06MB2308;
x-microsoft-antispam-prvs: <BN6PR06MB23081368D8642D02646F9ACDFEED0@BN6PR06MB2308.namprd06.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(166708455590820)(21748063052155)(17755550239193);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BN6PR06MB2308; BCL:0; PCL:0; RULEID:; SRVR:BN6PR06MB2308;
x-forefront-prvs: 0045236D47
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(7916002)(189002)(377454003)(24454002)(13464003)(51884002)(199003)(9686002)(5890100001)(4326007)(101416001)(7696003)(92566002)(76176999)(3280700002)(54356999)(50986999)(110136002)(7906003)(105586002)(106116001)(8936002)(586003)(189998001)(19625215002)(81156014)(8676002)(3846002)(74316002)(2906002)(99286002)(76576001)(77096005)(81166006)(15975445007)(19300405004)(97736004)(7736002)(7846002)(5660300001)(790700001)(6116002)(230783001)(2900100001)(102836003)(2950100001)(3660700001)(10400500002)(66066001)(93886004)(68736007)(19609705001)(33656002)(122556002)(106356001)(19580395003)(19580405001)(86362001)(19617315012)(11100500001)(16236675004)(5002640100001)(87936001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR06MB2308; H:BN6PR06MB2308.namprd06.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en;
received-spf: None (protection.outlook.com: trilliantinc.com does not designate permitted sender hosts)
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_BN6PR06MB23081868474C1EBEF6124A07FEED0BN6PR06MB2308namp_"
MIME-Version: 1.0
X-OriginatorOrg: trilliantinc.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Aug 2016 15:54:51.6746 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 4f6fbd13-0dfb-4150-85c3-d43260c04309
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB2308
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/Ak8PHQiMhqKXlIJKHLLXapDMtcM>
Cc: "core@ietf.org" <core@ietf.org>
Subject: Re: [core] draft-bierman-core-yid-00.txt questions
X-BeenThere: core@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "Constrained RESTful Environments \(CoRE\) Working Group list" <core.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/core>, <mailto:core-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/core/>
List-Post: <mailto:core@ietf.org>
List-Help: <mailto:core-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/core>, <mailto:core-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 25 Aug 2016 15:55:00 -0000

Hi Andy, Hi David

There is no requirement to have multiple tools or algorithms producing the same result.
The only requirements we have for YIDs/SIDs are:
- To be unique (Within the allocated range without duplicate)
- To be permanent (Registered within a private or public registry)

As demonstrated in one of my last email, all YIDs/SIDs must be registered even if generated from a hash.
The algorithm don’t need to be mandated, the registered YIDs/SIDs are the IDs to use.

The currently recommended algorithm is described in
https://tools.ietf.org/html/draft-somaraju-core-sid-01#section-3

   o  A tool extracts the different items defined for a specific YANG
      module.

   o  The list of items is ordered by type and label.

   o  SIDs are assigned sequentially for the entry point up to the size
      of the registered SID range.  It is important to note that
      sequentially assigning SIDs optimizes the CBOR serialization due
      to the use of delta encoding.

   o  If the number of items exceeds the SID range(s) allocated to a
      YANG module, an extra range is added for subsequent assignments.


   SIDs are assigned permanently, items introduced by a new revision of

   a YANG module are added to the list of SIDs already assigned.  This

   process can also be automated using the same method described above

   except that the assignment need to be restarted from the highest SID

   already assigned.

Since the file is fully defined, ordering the list within this file and assigning sequentially IDs to these
entries can be performed by different tools with the same result.

Regards,
Michel

From: Andy Bierman [mailto:andy@yumaworks.com]
Sent: Thursday, August 25, 2016 11:34 AM
To: Michel Veillette <Michel.Veillette@trilliantinc.com>
Cc: David Reid <reid@snmp.com>; core@ietf.org
Subject: Re: [core] draft-bierman-core-yid-00.txt questions



On Thu, Aug 25, 2016 at 7:15 AM, Michel Veillette <Michel.Veillette@trilliantinc.com<mailto:Michel.Veillette@trilliantinc.com>> wrote:
Hi David

About " Is the sequential numbering auto-assigned or manually assigned? "

If you use a tool such the pyang plugin, they will be automatically assigned.

For example, the command:
   pyang --generate-sid-file 20000:100 toaster@2009-11-20.yang<mailto:toaster@2009-11-20.yang>

Generate the file toaster@2009-11-20.sid<mailto:toaster@2009-11-20.sid> in attachment.

The command:
  pyang --update-sid-file toaster@2009-11-20.sid<mailto:toaster@2009-11-20.sid>  toaster@2009-12-28.yang<mailto:toaster@2009-12-28.yang>

Where is the algorithm explained in enough detail that multiple
independent implementations will all produce the exact same results?


Andy

Generate the file toaster@2009-12-28.sid<mailto:toaster@2009-12-28.sid> in attachment.

It is important to note that sequential numbering doesn't means that two data nodes defined sequentially in .yang file will receive consecutive IDs.
As you known, order may change and grouping may be introduced between versions.
It means that IDs are assigned sequentially from 1 using some arbitrary order.
If a .yang module have 14 YANG items, they will be numbered from 1 to 14.
If the next version add 5 YANG items, they will be numbered from 15 to 19.

Regards,
Michel

-----Original Message-----
From: core [mailto:core-bounces@ietf.org<mailto:core-bounces@ietf.org>] On Behalf Of David Reid
Sent: Wednesday, August 24, 2016 11:24 PM
To: core@ietf.org<mailto:core@ietf.org>
Subject: Re: [core] draft-bierman-core-yid-00.txt questions

>>> What is the benefit of assigning values using hashing over
>>> sequentially assigning values?

>> There is overhead ir reading and processing a giant list of mappings.

The assignment only happens one-time, so I don't see a problem with a little overhead (which I think would be minimal anyway).

>> Automatic assignment is risky because both sides need to agree on the
>> object to number mapping.  Detecting these issues is very difficult.
>> The YANG Hash algorithm is designed to use the path string, which is
>> permanent and cannot change no matter how the YANG is refactored.
>> The murmur hash is a stable algorithm.
>> There is not a lot that can go wrong for the 2 peers to disagree on
>> the hashes (except for collisions)

I would think we could write an algorithm that would guarantee the same number every time. Although I have not thought through all the issues that come up with revisions, maybe this is harder than I think.

>>> When there is a hash collision, would it be possible to rehash the
>>> value to get a unique number so that we never have to manually
>>> assign numbers and thus never need to register the numbers in the registry?

>> yes, this has been suggested.
>> The problem with auto-rehashing before was inter-module clashes.
>> Now those are not possible so automatic rehashing is feasible.

> [MV] I disagree, see my previous email which explain why all YIDs/SIDs
> need to be registered even if generated using a hash.

As long as I have either all revisions of a module or the YIDs from the previous revision, I can generate the numbers for the module. I don't think I need it to be in a central registry.

>>> Would it make sense to put the module-id inside the yang module with
>>> a yid extension so that I would not have to go lookup that
>>> information from a registry?

>> I suppose -- but how to prevent duplicates and cut-and-paste errors?

We would still need a registry to prevent duplicates. But only the module writer would need to access the registry. The module users would have the information in the yang module and would not have to look at the registry.

> [MV] Just adding the module ID in the yang file is not sufficient to
> use a .yang file, all YIDs/SIDs need to be added.

If YIDs are generated by hashing with auto rehashing on collisions, the YIDs would not have to be explicitly listed in the module. They could be auto-generated and stored in a different file.

> [MV] Having YIDs/SIDs in yang files will make their maintenance more
> complex.

Yes, it makes it more complex for the module writers. But it is easier on the users of the module.

> [MV] BTW, a pyang plugin already exist to automatically generate and
> update a .sid file from a .yang file [MV] See
> [2]https://github.com/core-wg/yang-cbor/blob/master/sid.py

>>> Would it be possible to assign the module-id based on information in
>>> the module, for example a hash of the namespace and maybe the revision date.
>>> That way, a module-id would not have to be assigned and maintained
>>> in a registry.

>> I think private module-id would be better, using a range reserved for
>> temporary assignments.

I think you are right. I was just hoping we could avoid requiring module writers to register a module-id by finding a way to auto assign it.

>> How do you resolve hash collisions for module-id?

I don't have a good solution. I was hoping the probability of collision would be low enough to be acceptable, or we could add the first revision in the number to further reduce collisions. But I don't have a way to resolve collisions.

>>> Who will assign the local-id numbers? Is that done by the working
>>> group that defines the YANG module?

>> I would expect IETF modules to use hashes by default but for some
>> modules that seem useful to constrained devices, then manual
>> numbering could be done instead by the WG.

> [MV] To obtain a smaller encoding, I personally believe that the
> sequential numbering will be used.

> [MV] With sequential numbering, all current YANG modules defined in
> RFCs can be assigned within the first 6500 SIDs which will be encoded
> as 3 bytes for the first reference and typically as 1 bytes for the
> following ones using delta encoding.

> [MV] With hashes, only one YANG module can be assigned within that
> range.

Is the sequential numbering auto-assigned or manually assigned?

-David Reid

_______________________________________________
core mailing list
core@ietf.org<mailto:core@ietf.org>
https://www.ietf.org/mailman/listinfo/core

_______________________________________________
core mailing list
core@ietf.org<mailto:core@ietf.org>
https://www.ietf.org/mailman/listinfo/core