Re: [netmod] Common etag, timestamp on all interfaces (draft-lindblad-netconf-transaction-id)

Jan Lindblad <janl@tail-f.com> Thu, 24 March 2022 20:38 UTC

Return-Path: <janl@tail-f.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 1AAF83A0A73 for <netmod@ietfa.amsl.com>; Thu, 24 Mar 2022 13:38:06 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.908
X-Spam-Level:
X-Spam-Status: No, score=-1.908 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=unavailable 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 GpF8teYysY1B for <netmod@ietfa.amsl.com>; Thu, 24 Mar 2022 13:38:00 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 049563A0A85 for <netmod@ietf.org>; Thu, 24 Mar 2022 13:37:59 -0700 (PDT)
Received: from smtpclient.apple (unknown [173.38.220.41]) by mail.tail-f.com (Postfix) with ESMTPSA id B81121AE0A66; Thu, 24 Mar 2022 21:37:56 +0100 (CET)
From: Jan Lindblad <janl@tail-f.com>
Message-Id: <F9E14193-2EC9-41AE-8788-1EA115CC2F20@tail-f.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_DFBB5E79-60AD-441D-962C-B956B7150951"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\))
Date: Thu, 24 Mar 2022 21:37:55 +0100
In-Reply-To: <CABCOCHSBHUy4gdQ9vnxMEKGkB4azv5Hjw0shiorVV2-WW_Unrw@mail.gmail.com>
Cc: "netmod@ietf.org" <netmod@ietf.org>
To: Andy Bierman <andy@yumaworks.com>, =?utf-8?Q?Bal=C3=A1zs_Lengyel?= <balazs.lengyel=40ericsson.com@dmarc.ietf.org>, Kent Watsen <kent@watsen.net>
References: <VI1PR0701MB2351D399AB78445A66E16DD1F0189@VI1PR0701MB2351.eurprd07.prod.outlook.com> <0100017fb906d433-172359f0-01a8-4a82-8e25-8079bdafef76-000000@email.amazonses.com> <VI1PR0701MB2351A58EB0EC5973DAD7454EF0189@VI1PR0701MB2351.eurprd07.prod.outlook.com> <CABCOCHSBHUy4gdQ9vnxMEKGkB4azv5Hjw0shiorVV2-WW_Unrw@mail.gmail.com>
X-Mailer: Apple Mail (2.3696.80.82.1.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/0qpJ-K0x5ybsphJwwwKbijopPg0>
Subject: Re: [netmod] Common etag, timestamp on all interfaces (draft-lindblad-netconf-transaction-id)
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: Thu, 24 Mar 2022 20:38:07 -0000

Andy, Balazs, Kent,

Thanks for your very good questions. Comments inline.
> I assume that the etag defined in your I-D is the same as the one defined in Restconf. Does or should your draft include a statement like:
> 
> “The etag values maintained by the server are protocol/interface independent. If requested the same etag values will be visible on all interface including Restconf, Netconf, CLI etc.”
> 
>  
> 
> While it makes sense that a server would use the same values across protocols, I'm unsure if it's needed and, if we do, if we could state it in a NETCONF-specific draft.
> 
> BALAZS2: I see it as a VERY important advantage of the whole YANG/Netconf/Restconf ecosystem that the separate protocols (practically including the CLI and possibly a gui too) are just views of the same central configuration datastore. So IMO this is important and should be stated.
> 
As an implementor, I think it makes great sense to use the same underlaying mechanism for all mgmt interfaces.

I could imagine some implementors planning to lean on the wire representation to compute hashes over the data as their ETag implementation. That would not be possible under this requirement, but ruling out that particular idea would not be problematic, imo.

Long ago, I pondered this question for a while, but then I wasn't able to think of a use case where a client would benefit from a guarantee that all interfaces have common ETags, so I left it out in order to not produce a CLR. I'm not against adding this requirement if we can think of a reasonable reason why. Adding a requirement for CLI+GUI sounds hard in practice, though.
> I strongly support this approach.
> It applies to the entire server API, including notifications.
> E.g., a client should be able to reuse code for processing NETCONF notifications,
> even if the protocol is RESTCONF or the new YANG-Push over UDP.
> 
> The RESTCONF mechanisms adapted from HTTP should be extended to be
> protocol-independent.  Our goal should be code to the YANG models, NOT the protocols.

Yes, I certainly like that. 
> Restconf also includes timestamps. What was your reason to exclude them from your I-D ? IMHO if the server maintains timestamps they would be protocol/interface independent just as etags, so the task is to make them available on Netconf too (and maybe the CLI).
> 
> I agree and have mentioned before.  LastModified either needs to be added, or justified why not added, to get my adoption support.
> 
I'm not against having Last-Modified in there. In fact, it was in the draft initially. Here's the justification why I removed it :-)

+ When I started the cost/benefit analysis for what I proposed, I soon found that it's not unimportant how many and how large ETag attributes are added to the payload. Having two mechanisms (i.e. both ETag and Last-Modified) doing pretty much the same thing started to look expensive in performance.
+ Since it's essential that the time stamp would have to be the same on all touched elements, all the components/subsystems/subagents involved would still have to be fed the exact time from the central management agent.
+ Then there's one or two more things with If-Unmodified-Since that I discuss below.

> I agree. They both need to be supported in RESTCONF.

RESTCONF has a SHOULD for the (single) datastore root level and MAY for the deeper levels. 

> A timestamp can be applied to multiple servers, unlike the ETag values.

I don't think this analysis is correct. A client connecting with 15 servers in a network wide transaction would surely receive several differing timestamps. The times may be fairly close if NTP is running fine, latency is low, network and cpu load is even and the servers are running similar code, but they will rarely all be the same even with the low 1s Last-Modified resolution. If you allow clients to set the ETag in the request (which is trivial to allow), then the tags could be exactly the same across all servers (and known to the client before the request is even sent to the servers, allowing request pipelining).

> Typical usage is for the client to track its own polling timestamps,
> and use If-Modified-Since to retrieve data only if needed.
> The same timestamp can also be used with If-Unmodified-Since for edits.

If-Unmodified-Since is what set me going with this whole draft, so obviously I value that mechanism highly. The fact that it works with timestamps worries me a bit, however. 

First, the resolution is pretty low, 1s. It is quite possible that a server could process more than one edit/POST in the same second, in which case this mechanism might indicate no change has taken place when in fact it has.

Secondly, while the idea with timestamps and "unmodified since" is very convenient, it's also quite brittle. If a client ever sends an edit request to a server without using the If-Unmodified-Since, it may miss an update made by another client. The ETag mechanism does not have that issue.

If this isn't obvious, here's an example:
1. Client A sends an edit to the server If-Unmodified-Since t0. Successful. Receives a Last-Modified timestamp t1.
2. Client B sends a an edit to the server. Last-Modified timestamp on server is now t2.
3. Client A sends an edit to the server without If-Unmodified-Since. It just sets one tiny little leaf off in one corner. Successful. Received a Last-Modified timestamp t3.
4. Client A sends an edit to the server If-Unmodified-Since t3. Successful, but clobbers Client B's edit, leading to a misconfiguration, which opens a security hole.

This is because the If-Unmodified-Since uses less than or equal in its test. The ETag mechanism is not susceptible to this issue, as it uses an equality test.

Best Regards,
/jan