Re: [netmod] RPC input parameter definition order (uses augment)

Jernej Tuljak <jernej.tuljak@mg-soft.si> Tue, 05 April 2022 07:14 UTC

Return-Path: <jernej.tuljak@mg-soft.si>
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 B93993A2191 for <netmod@ietfa.amsl.com>; Tue, 5 Apr 2022 00:14:04 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.109
X-Spam-Level:
X-Spam-Status: No, score=-7.109 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=mg-soft.si
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 wW7agx7h1WZO for <netmod@ietfa.amsl.com>; Tue, 5 Apr 2022 00:13:58 -0700 (PDT)
Received: from galileo.mg-soft.si (gate.mg-soft.si [212.30.73.66]) by ietfa.amsl.com (Postfix) with ESMTP id 518E53A218E for <netmod@ietf.org>; Tue, 5 Apr 2022 00:13:57 -0700 (PDT)
Received: from [10.0.0.222] (tp-x61t.mg-soft.si [10.0.0.222]) by galileo.mg-soft.si (Postfix) with ESMTP id C6AABC401147; Tue, 5 Apr 2022 09:13:54 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 galileo.mg-soft.si C6AABC401147
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mg-soft.si; s=default; t=1649142834; bh=x429wzn/SwpbUanSLiLeSu2WHkpCsZEZeygVdHT6iWI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=V6VXq2YtN3XTvxUuOj4R7ViucrRCRj8cbMB8RHJBLmAiD19DURzxGvcMs6wwB7YCM PjtIq5rDCtfWad+kJ5bcDSqXLEkp3hp7uIhCKE92XdVKlXNmEgaUmtOXuh3ebVOYuJ DcxvZb6DUUkVLAu8Y81jOOcZBHcKwGpxFviDYm3TpsiX37igK9e3bGMsejQkLQt68P xl3vpARPx70Su8TldjzfdMixL7CaH02HbYNwwTJsE98g5+jdFZfiFVl8U40P9FAjRV AgZXB3IYQI1Z5AwH7Dwl6oDPNGFtKYtUdfHUyKJgp9WWEq7tH1Lx4/M7S/QCW1YcVX BCy7v3o9YwaBA==
Content-Type: multipart/alternative; boundary="------------TO4HDNEs99cw8QPDsDed0Aon"
Message-ID: <8c9d205b-0a5a-bc37-6f8e-d683cb4e0477@mg-soft.si>
Date: Tue, 05 Apr 2022 09:13:54 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0
Content-Language: en-US
To: Andy Bierman <andy@yumaworks.com>
Cc: Kent Watsen <kent@watsen.net>, NETMOD Working Group <netmod@ietf.org>
References: <3740e8e7-5e90-f2e2-b252-0dd42690f71c@mg-soft.si> <0100017fe4dec66b-298dc5a9-2d75-4a10-b90b-d11553726957-000000@email.amazonses.com> <CABCOCHR4pGF8wouBkcZm9hJMtKN8TWNNAs8RRfUP-6fHtCPXnw@mail.gmail.com> <9a55de3d-c7bc-597a-e1c8-e11f58325049@mg-soft.si> <CABCOCHSs=1CERpQq7eb=YNr-eaqFPeyE0xo_vLABxsQn1XSzkg@mail.gmail.com>
From: Jernej Tuljak <jernej.tuljak@mg-soft.si>
In-Reply-To: <CABCOCHSs=1CERpQq7eb=YNr-eaqFPeyE0xo_vLABxsQn1XSzkg@mail.gmail.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/0MojpY1V2_Na0rRf7sF2JD2XR2I>
Subject: Re: [netmod] RPC input parameter definition order (uses augment)
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: Tue, 05 Apr 2022 07:14:05 -0000

On 04/04/2022 17:16, Andy Bierman wrote:
>
>
> On Mon, Apr 4, 2022 at 4:48 AM Jernej Tuljak 
> <jernej.tuljak@mg-soft.si> wrote:
>
>     On 01/04/2022 15:49, Andy Bierman wrote:
>>
>>
>>     On Fri, Apr 1, 2022 at 4:24 AM Kent Watsen <kent@watsen.net> wrote:
>>
>>
>>         Hi Jernej,
>>
>>         > RFC7950, 7.14.4. says:
>>         >
>>         >    Input parameters are encoded as child XML elements to
>>         the rpc node's
>>         >    XML element, in the same order as they are defined
>>         within the "input"
>>         >    statement.
>>         >
>>         > For the following model:
>>         >
>>         > module b {
>>         >   namespace "b:uri";
>>         >   prefix b;
>>         >
>>         >   grouping params {
>>         >     container params {
>>         >       leaf x {
>>         >         type string;
>>         >       }
>>         >     }
>>         >   }
>>         >
>>         >   rpc foo {
>>         >     input {
>>         >       uses params {
>>         >         augment params {
>>         >           leaf y {
>>         >             type string;
>>         >           }
>>         >         }
>>         >       }
>>         >     }
>>         >   }
>>         > }
>>         >
>>         > If both "leaf" data nodes are instantiated (XML encoding)
>>         as part of <rpc> for "foo", does <x> come before or after <y>
>>         (in document order)?
>>
>>         Augmented-in nodes come after other nodes.
>>
>>
>>
>>     Maybe this is an implementation convention, but the RFC says they
>>     are encoded in any order.
>>     https://datatracker.ietf.org/doc/html/rfc7950#section-7.17.2
>>
>
>     You are referring to this:
>
>        When a node is augmented, the augmenting child nodes are encoded as
>        subelements to the augmented node, in any order.
>
>     This implies interleaving of augmenting and non-augmenting child
>     nodes within "input" parameters for XML encoding?
>
>
> There is no data node order defined except in 4 places:
>   - rpc or action input (just the child nodes or all descendants?)
>   - rpc or action output  (just the child nodes or all descendants?)
>   - ordered by user applies to list and leaf-list entries
>     (not the nodes within a list, just the list entries themselves)
>   - list key leafs are encoded in key-stmt order, before other list 
> child nodes.
>     This is true even if the list is affected by previous 3 rules (but 
> this is not specified)

Additionally, there are interleaving rules for list and leaf-list entries.

    The XML elements representing
    list entries MAY be interleaved with elements for siblings of the
    list, unless the list defines RPC or action input or output
    parameters.

    The XML elements
    representing leaf-list entries MAY be interleaved with elements for
    siblings of the leaf-list, unless the leaf-list defines RPC or action
    input or output parameters.

Until augmentation comes along?

>
> It is not clear if the phrase "in any order" (appearing about a dozen 
> times)
> is in addition to these rules or instead of them.

I'm not convinced of your interpretation of "in any order" in text you 
were originally referring to (and I later quoted). No matter how many 
times I read that, the "in any order" there only becomes relevant if 
there is more than one augmenting child present - to me, the intention 
behind that text was to handle multiple augments targeting the same 
node, not to introduce interleaving with non-augmenting children.

There should be text present in that section clarifying what that 
sentence means in contexts where order matters.

>
> What about an 'anyxml' or  'anydata' for a <config> node?
> Since it is a terminal node, it could be interpreted that it is ordered,
> but it is converted to regular nodes when applied to a datastore.

The way I see it, only the node representing the <config> node is an 
input/output parameter. The content is an opaque blob of data. No 
different to a leaf of type binary, which contains bytes of an XML document.

With such ambiguity in the RFC it would not be surprising if 
implementations chose to ignore these rules entirely and just accepted 
RPC payloads with arbitrary order of their content, even for the cases 
where things are somewhat clear. Or hope that all other implementations 
follow the same implementation convention.

Jernej

>
>
> Andy
>
>
>
>     Jernej
>
>>
>>         I’ve always wished there were a way to specify where they’re
>>         placed, for readability, but it’s too inconsequential to
>>         raise as an issue here.
>>
>>
>>     There is no canonical order defined for any schema nodes.
>>     There is no order at all defined for top-level or augmenting
>>     schema nodes.
>>
>>
>>
>>         > Jernej
>>
>>         Kent
>>
>>
>>     Andy
>>
>>         _______________________________________________
>>         netmod mailing list
>>         netmod@ietf.org
>>         https://www.ietf.org/mailman/listinfo/netmod
>>
>