From 42d10d3079fc835ae86521565a20fcf99a9b9a23 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 25 May 2019 22:18:09 +0200 Subject: [PATCH] add etcd tests --- test-etcd.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test-etcd.py diff --git a/test-etcd.py b/test-etcd.py new file mode 100644 index 0000000..4912cd4 --- /dev/null +++ b/test-etcd.py @@ -0,0 +1,26 @@ +import etcd +import json + +client = etcd.Client(port=2379) # this will create a client against etcd server running on localhost on port 4001 + +some_vm = {} +some_vm['network'] = {} +some_vm['network']['ipv6'] = [] +some_vm['network']['ipv6'].append("2a0a:e5c0:4::42/64") +some_vm['network']['ipv6'].append("2a0a:e5c0:1::42/64") + + +for node in range(20000): + client.delete('/nodes/n{}'.format(node), j) + + +for node in range(200): + ip = some_vm['network']['ipv6'].append("2a0a:e5c0:3::{}/64".format(node)) + j = json.dumps(some_vm) + + client.write('/nodes/n{}'.format(node), j) + +result = client.read('/nodes', recursive=True, sorted=True) +print(result) +for child in result.children: + print("%s: %s" % (child.key,child.value))