Re: [netmod] Modeling unknown bits in YANG (draft-haas-netmod-unknown-bits-00)

Jeffrey Haas <jhaas@pfrc.org> Fri, 27 January 2023 14:33 UTC

Return-Path: <jhaas@slice.pfrc.org>
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 1B866C14CF13 for <netmod@ietfa.amsl.com>; Fri, 27 Jan 2023 06:33:46 -0800 (PST)
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, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M8ZEPvvNzI4p for <netmod@ietfa.amsl.com>; Fri, 27 Jan 2023 06:33:45 -0800 (PST)
Received: from slice.pfrc.org (slice.pfrc.org [67.207.130.108]) by ietfa.amsl.com (Postfix) with ESMTP id 06665C14CF12 for <netmod@ietf.org>; Fri, 27 Jan 2023 06:33:44 -0800 (PST)
Received: by slice.pfrc.org (Postfix, from userid 1001) id 2282B1E2D3; Fri, 27 Jan 2023 09:33:44 -0500 (EST)
Date: Fri, 27 Jan 2023 09:33:43 -0500
From: Jeffrey Haas <jhaas@pfrc.org>
To: netmod@ietf.org
Message-ID: <20230127143343.GA12211@pfrc.org>
References: <20230126205157.GC27893@pfrc.org> <20230126224033.wmogu3borbctlcaz@anna>
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20230126224033.wmogu3borbctlcaz@anna>
User-Agent: Mutt/1.5.21 (2010-09-15)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/j3d3O15IYKxmtDioZC28bVDRVLg>
Subject: Re: [netmod] Modeling unknown bits in YANG (draft-haas-netmod-unknown-bits-00)
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.39
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: Fri, 27 Jan 2023 14:33:46 -0000

Jürgen,

Thank you for your comments.

On Thu, Jan 26, 2023 at 11:40:33PM +0100, Jürgen Schönwälder wrote:
> On Thu, Jan 26, 2023 at 03:51:57PM -0500, Jeffrey Haas wrote:
> - I suggest to avoid talking about displaying data, the verb 'display'
>   is never used in RFC 7950.

What is the suggested verbiage for such things?

> - In the scenario, you seem to model the 'bits understood by the BGP
>   engine' and the 'unknown bits presumably ignored by the BGP engine'.
>   Having two separate leafs for this seems to be fine.
> 
>    <flags>restart</flags>               # what the BGP engine understood
>    <unknown-flags>b1</unknown-flags>    # what the BGP engine ignored
> 
>   Obviously, the presence of <unknown-flags> indicates that there were
>   unknown (presumably ignored) flags.

"Presumably ignored" is generally what we expect for such things out of most
of our protocols.  We tend to be interested in them for two reasons:
1. Things are not working as expected, and an unexpected bit may be the root cause.
2. Seeing such a bit tells us there is a user of these bits in the network.
This may be a new protocol extension.  This may also be an attempted
security breach.

> - Note that exposing bit-fields may be a slightly different thing,
>   i.e. exposing the bits understood by a BGP engine and the bit-field
>   contained in a protocol message received by a BGP engine should
>   likely look like this:
> 
>    <flags>restart</flags>               # what the BGP engine understood
>    <raw-flags>b0 b1</raw-flags>         # what was received by the BGP engine
> 
>   Obviously, raw flags would always be present and for wider bit-fields
>   one may choose types giving a more compact representation.

I have chosen to not use this form partly for the reason you note - it gets
noisy.

The "more compact representation" also doesn't have any guidance that I'm
aware of for general YANG modeling.  For example, if the field in question
can fit into one of the unsigned integer types, good advice may be to pick
the smallest unsigned integer type that can hold it.  The place where I
expect there to be some content is whether you start such a bit vector's
position 0 in the most significant bit, or position the bit vector's last
bit in the least significant bit position?  (Shove to the left or right.)
I've seen both forms in implementations.  It's also been the source of bugs
in both forms and sometimes seen in SNMP MIB implementation issues.

What I would have preferred to exist in the YANG language is a bits type
that provides for automatic default naming for unassigned positions.  Thus,
using your example:
<flags>restart b1</flags>

I understand the motivations to not do this since there's a desire to have
stable naming for the position 1 element.  Thus, we're driven to this
discussion.

The motivation for the unknown-flags representation is the expectation that
they are unusual, and it should be trivial to note the things that are
unexpected.  One should not have to dig through the raw bits to find that
there's one that doesn't have a mapping.  In your example above, seeing b0
means I have to know that "restart" is given position 0 and is expected, but
that "b1" hasn't been assigned anything.

Fundamentally, the contents of unknown flags would be, in C syntax:
unknown_flags = ~known_flags & received_value

> - Concerning the type definition, I suggest to simplify the
>   description statements:
> 
>   OLD
> 
>           "Bit 0 currently has no known mapping for this state.";
> 
>   NEW
> 
>           "Bit 0 is unknown";

This a reasonable change, and I'll incorporate it into the next revision.

>   And since there can be many unknown bits, I would probably just name
>   the bits b0, b1, ... instead of unknown-0, unknown-1, ....
> 
> /js (old fashioned person with a fable for 80 column terminals)

I'm sympathetic for this point, but not yet fully convinced.  Let me
consider and also see what feedback the rest of the Working Group has.

If we truly worried about the older terminals, we wouldn't be using XML. :-)

-- Jeff