Re: [netconf] Trouble with RFC 8040 (Restconf) fields Query Parameter

Henning Rogge <hrogge@gmail.com> Fri, 08 May 2020 13:59 UTC

Return-Path: <hrogge@gmail.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B68BB3A0ADE for <netconf@ietfa.amsl.com>; Fri, 8 May 2020 06:59:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 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, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 GLujlEGkqte7 for <netconf@ietfa.amsl.com>; Fri, 8 May 2020 06:59:42 -0700 (PDT)
Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) (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 22FE03A0927 for <netconf@ietf.org>; Fri, 8 May 2020 06:59:42 -0700 (PDT)
Received: by mail-lf1-x135.google.com with SMTP id t2so1497008lfc.3 for <netconf@ietf.org>; Fri, 08 May 2020 06:59:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d3pF0cEMa1VKgLwJXrE4OlZVPsx2Vmw0gF99F/Knft4=; b=OoYv6PBvqh2WfvkAIjuwKTUKclSAuMvgGUdZrXv46Zxpl3NUhhrb6cIR+Anuf56/zM CREFgVBnfKtofeoFMPpKLKTBhBvKFCpyhwkMppFSuWjSxCZqz2El0YpcpUhfJgIQLoPw EDOc8Ik3GNH+MRgzyUMoUkk7UQzd/zFxRcoDdMsloSRmQEbS1M+ujsqZER0lhz2NtFms o3nDeVfp7jU3n2Jd9JY6eE2VWJssMiOYq7OoVLRVkzrMK4q104g5Yb6VZ/EqvcI42Kwb 6217I7V8uWPxgjIkMvSBdlizbjCdQGM1h74dBiPKjxhZpse64fcVLqXLd2GcOHnrdbw5 a89A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d3pF0cEMa1VKgLwJXrE4OlZVPsx2Vmw0gF99F/Knft4=; b=erfdDJh35wtz/siQLhYlQI3moGd9HtfGq7uAvB+NY4o4FASD4KGMfVWwVvLHg4UM4r lWtPA6UdLzb4+3XSto7izUTdik10E3TD/bEC4nwwnDgZv46VMzyZsedH3RSe1gp0HcbL aBfNIZeUqcTYmQk9LV6czzYB84cvhoAaQ1A9eIHTK14WRfkgq3BWR44VJgI3kKkJAKes DJS4oISJjI2vU2Y8/ZJBoWLE41tiexNn4tC+VGk/rur2f/WKDNnp/Ip5w8y+RUgTM5OI w1H8/LVrBrQfW1eOmZKkVoIKbOCfLsJ5v3oKYZ/q25u6juEjxEnowqyMYCB8RJMglaqQ ryXA==
X-Gm-Message-State: AOAM530br4YCldWVdq60x5fMjF9LL6bLUQHj+nRefVeLryOpUzbN8CB3 csLrGYH2NUfubMjtjnMhQSoPEjdrp+Cx07omPH4=
X-Google-Smtp-Source: ABdhPJyH/nXqeKuJbmS2ZRJ/NpgSR767svCO6p2ystBykKnsJfA1ubQTHR0jyY1opnXyxaYQNcwuH1C71tgb16ZMIWc=
X-Received: by 2002:ac2:58d0:: with SMTP id u16mr1981252lfo.114.1588946380094; Fri, 08 May 2020 06:59:40 -0700 (PDT)
MIME-Version: 1.0
References: <CAGnRvup-pLVYgxAx7PnbJJ1gS-GTkD6t5jGD_Ayhh7ctpPothw@mail.gmail.com> <CAGnRvuq=ESLkeyWsgiqE9sXqFwHGUef3A4QRuW=H8ompVO3C4Q@mail.gmail.com> <20200414.222236.518728457229433184.id@4668.se> <CAGnRvurVJBHbRbwtnLXQFeSrDUFSGKWhL1UUjUDjw5-Gc44ozg@mail.gmail.com> <9C6D0A8A-2BD4-4578-8CB3-6969078CE10A@gmail.com> <CAGnRvupqew3Gqow+U4AwAH7ry1f_91=yiX9N2DikNBpF5raOVQ@mail.gmail.com> <CALAkb6em3Qb2-rbhacqsbsmqAaWz83Q0_nyUHW0kOJ375F=91g@mail.gmail.com>
In-Reply-To: <CALAkb6em3Qb2-rbhacqsbsmqAaWz83Q0_nyUHW0kOJ375F=91g@mail.gmail.com>
From: Henning Rogge <hrogge@gmail.com>
Date: Fri, 08 May 2020 15:59:13 +0200
Message-ID: <CAGnRvuquS_DsyoYNO4xt6w_fgc+FY-C2Jg8OgWNmwso-+G3ctg@mail.gmail.com>
To: Douglas Hubler <douglas@hubler.us>
Cc: Mahesh Jethanandani <mjethanandani@gmail.com>, Netconf <netconf@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/piNaTSBlGvJW-SeT4_iZj7-ejA0>
Subject: Re: [netconf] Trouble with RFC 8040 (Restconf) fields Query Parameter
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 08 May 2020 13:59:44 -0000

On Fri, May 8, 2020 at 3:11 PM Douglas Hubler <douglas@hubler.us> wrote:
>
> I've been very interested in restconf test cases and glad to see some activity here.
>
> So is the idea restconf server implementations stand up a server that loads each config/state one-by-one then a utility will also read in same test cases, exercise queries and assert the expected results?

Yes.

> I'd definitely like to hear more about how you're using this currently and if you have a working model.

I use python with two threads... one thread starts the server and
loads the "before" state into the datamodel.
The other one waits 100ms, sends the HTTP request, parses the answer,
check the answers body and headers and then checks the (possibly)
changed internal state of the server.
Both before and after uses the standard Restconf JSON encoding.
After this the server thread is stopped and the client closes the connection.

This is iterated for each test.

At the moment the "/restconf" part of the URL is hardcoded... I will
definitely change this when I switch to the "unified data store".
I think I also have some tests where "before.json" and "after.json"
are the same, so I could replace them with a single "state.json" file
(easier to read).

The trickiest part was to write a compare function for the servers
response body and for the final server state (and setup and teardown
of the second thread ^^).

My tests use "pytest", so no special things involved. I am currently
trying to get permission to share the code of the server under LGPLv3,
same licence as the yangson library I use.
I have also written a couple of extensions for the yangson library
(e.g. XML input/output support), but I am trying to get them pulled
into the upstream implementation.

In theory the "write initial state" and "read final state" could be
done with Restconf HTTP commands, but I would like to keep each test
using only a single HTTP request.

Henning Rogge