Accessing NETCONF servers from Python

This is pretty basic, but it allows me to read data over NETCONF while
returning nice Python types, and to set leaf values as well. That's
awesome if you ask me.

The "nice Python types" have no way of distinguishing between different
integer sizes. I was afraid that this might be a problem, but according
to the test, it looks that libnetconf2 (and all the C++ layers in front
of that) are happy even when a number is passed in as a string. That's
nice.

This test requires running "alone" with no other sysrepo- or
NETCONF-talking tests in parallel. I do not really know why, but if I'm
running this locally (T460s) with high parallelism, I'm getting failures
about `ietf-netconf-server` module not being recognized. Strange,
perhaps it does not like parallel `sysrepoctl --install` for some
reason?

Finally, the sanitizer handling is super-ugly, but at least it unbreaks
my local workflow. That one also requires an extra fixup touch for
libyang:

diff --git a/src/common.c b/src/common.c
index 7f941196..801a523f 100755
--- a/src/common.c
+++ b/src/common.c
@@ -37,6 +37,8 @@ API LY_ERR *
 ly_errno_glob_address(void)
 {
     FUN_IN;
+    static _Thread_local LY_ERR xx;
+    return &xx;

     return (LY_ERR *)&ly_errno_glob;
 }

I'm not submitting that upstream because I think the old code is valid
as well, and I somehow doubt that upstream  would be thrilled by that.

Change-Id: I4e81f8ba44700747f9bf719fcba2c460e079babd
diff --git a/tests/python_netconfaccess.py b/tests/python_netconfaccess.py
new file mode 100644
index 0000000..a4f6c94
--- /dev/null
+++ b/tests/python_netconfaccess.py
@@ -0,0 +1,33 @@
+import netconf_cli_py as nc
+
+c = nc.NetconfAccess(socketPath = "@NETOPEER_SOCKET_PATH@")
+data = c.getItems("/ietf-netconf-server:netconf-server")
+for (k, v) in data.items():
+    print(f"{k}: {type(v)} {v}", flush=True)
+
+if len(data) == 0:
+    print("ERROR: No data returned from NETCONF")
+    exit(1)
+
+hello_timeout_xp = "/ietf-netconf-server:netconf-server/session-options/hello-timeout"
+for EXPECTED in (599, 59, "61"):
+    c.setLeaf(hello_timeout_xp, EXPECTED)
+    c.commitChanges()
+    data = c.getItems(hello_timeout_xp)
+    if (data[hello_timeout_xp] != EXPECTED):
+        if isinstance(EXPECTED, str):
+            if str(data[hello_timeout_xp]) != EXPECTED:
+                print(f"ERROR: hello-timeout not updated (via string) to {EXPECTED}")
+                exit(1)
+        else:
+            print(f"ERROR: hello-timeout not updated to {EXPECTED}")
+            exit(1)
+try:
+    c.setLeaf(hello_timeout_xp, "blesmrt")
+    c.commitChanges()
+    print("ERROR: setting integer to a string did not error out")
+    exit(1)
+except RuntimeError:
+    pass
+
+exit(0)