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

Andy Bierman <andy@yumaworks.com> Thu, 25 August 2016 03:50 UTC

Return-Path: <andy@yumaworks.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 6C83B12D10C for <core@ietfa.amsl.com>; Wed, 24 Aug 2016 20:50:53 -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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.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 KtgyJIxM1SPV for <core@ietfa.amsl.com>; Wed, 24 Aug 2016 20:50:50 -0700 (PDT)
Received: from mail-ua0-x230.google.com (mail-ua0-x230.google.com [IPv6:2607:f8b0:400c:c08::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 7CD6312B04F for <core@ietf.org>; Wed, 24 Aug 2016 20:50:50 -0700 (PDT)
Received: by mail-ua0-x230.google.com with SMTP id n59so63663043uan.2 for <core@ietf.org>; Wed, 24 Aug 2016 20:50:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=sXrFg49xZiqQfoDDkIbE+aE8CK6JXNL4W1TXV2gTvDw=; b=dPecCkjLWCLFaMG89fwZhH0bjw+lXQOuJFLv5j4hbMfMHlOhTxJo89UTa6jYTMWA7k OpiSrw7/7f9ni2SsE99+i9ZgQd11EJL8M/b5UQ9vvKIwmv0xgMjiWu9fSPbnNmfT0BKd ieit0t5AKo60cnzipb8UYrX8fPdP5ZfpPV2RlfJ+AJhebVe49Pp6c5YDMJuRFajYXMu5 84MLxUrehp3UJ55Ye4LnXzkFAhfc96KtqlR9hd+FJcxDem0eTeIT+XPR3QXy7Y+YNvNp pXoJBCP+UAj0oiAHAqPx17gVFiggucUf0DfolxOo6QLG7GXs7g/s23RSX7vl9QSIMuCu U/Xw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sXrFg49xZiqQfoDDkIbE+aE8CK6JXNL4W1TXV2gTvDw=; b=bnCM4C/wHB1rEcs8lWqxsmi0VUDGMZ5vjqV68kHNQ5qJZzPXLLuBAbIGWiecDiD6Pv 8hDcA/ZrpDlMNUSmNCjU1jCrzFxrl05ircyHnGRlg4R6J20XyWVEFxPMFIaIeQVbHokF Nk80awHSWhQJx4zlvdO8pYkV1dLxy6Nip4P6RK7Znfn8cDTvddx6pK0YS5my6pq5BJaD TWn7ckg6oNlCTrUdPYZ4ay6yMpbUD8DKfG/AKVR2/c9kkpFOIETuUEsosPHVSOCBtWR+ fRkxTaEVbjBPthoSHt3c7tg2I2Pr2gTwL3g+71BP28BnsXOOSNMNr6Og8DGmvQ0OV5aa kvCg==
X-Gm-Message-State: AEkoousKbPRLZd3iM4SdNCyd4zNd9nPRj9Y7PBdHSqPZrI1+WTI/OKUYhgppXDI0c5B78AgVFL8L9Qmgfcw3NQ==
X-Received: by 10.31.136.70 with SMTP id k67mr3688019vkd.13.1472097049613; Wed, 24 Aug 2016 20:50:49 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.103.4.134 with HTTP; Wed, 24 Aug 2016 20:50:48 -0700 (PDT)
In-Reply-To: <201608250324.u7P3OTAI005926@mainfs.snmp.com>
References: <BN6PR06MB2308A46F6A84378832DBC849FEEA0@BN6PR06MB2308.namprd06.prod.outlook.com> <201608250324.u7P3OTAI005926@mainfs.snmp.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Wed, 24 Aug 2016 20:50:48 -0700
Message-ID: <CABCOCHS=KumUsVbJi5N4u-Y2z6SBN_ivau6P9yiXbTxN6EbcGQ@mail.gmail.com>
To: David Reid <reid@snmp.com>
Content-Type: multipart/alternative; boundary="001a11440bb6b7aa90053add4dfe"
Archived-At: <https://mailarchive.ietf.org/arch/msg/core/lF_SzIDXXrX_RqElFM6eHlOWWSg>
Cc: Core <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 03:50:53 -0000

On Wed, Aug 24, 2016 at 8:24 PM, David Reid <reid@snmp.com> wrote:

> >>> 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.
>
>
So many YANG statements are unordered.
There is no order to how imports and includes are processed,
which severely affects statement order.  Top level statements
have no order and can change at any time.

Augment statements can change order and be refactored at any time.
There is no order to any augmented node (at any level).
Only RPC input and output nodes require descendant nodes to stay
in the same relative order.

Import or include without revision of groupings, etc. is not deterministic,
The revision that gets used depends on the implementation.
Almost all imports and includes are without revision-date, so
this is a significant problem.

>>> 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.
>
>

Any algorithm that relies on statement order to decide which node is
rehashed
will not work.  Maybe it would be possible to rehash all collisions and
change the path for each (e.g., prepend '_') , and keep doing it until N
new hashes are found.


>>> 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.
>


I agree that the number of tools that have to know all the
complex numbering algorithms should be minimized.
The [local-id, path] tuples work no matter how the local-id was assigned.
The registry reader tool can be simple.


>
> > [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.
>


what is sequential about nested lists and choices?
Siblings may end up far apart.



>
> > [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
>

Andy


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