Some testing utilities added

parent da1423e9
#!/bin/bash
CLIENT_CERT="/home/pspirek/sslclient/pavel_curl.pem"
echo "--- conf-start 1"
POST_DATA='{ "jetconf:input": {"name": "Edit 1", "options": "config"} }'
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-start"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST -d "$POST_DATA" "$URL"
echo "--- POST new album"
POST_DATA="@jb_album_input.json"
URL="https://127.0.0.1:8443/restconf/data/example-jukebox:jukebox/library/artist=New%20Artist"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST -d "$POST_DATA" "$URL"
echo "--- conf-commit"
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-commit"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST "$URL"
#!/bin/bash
CLIENT_CERT="/home/pspirek/sslclient/pavel_curl.pem"
echo "--- conf-start 1"
POST_DATA='{ "jetconf:input": {"name": "Edit 1", "options": "config"} }'
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-start"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST -d "$POST_DATA" "$URL"
echo "--- POST new artist"
POST_DATA="@jb_artist_input.json"
URL="https://127.0.0.1:8443/restconf/data/example-jukebox:jukebox/library"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST -d "$POST_DATA" "$URL"
echo "--- conf-commit"
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-commit"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST "$URL"
#!/bin/bash
CLIENT_CERT="/home/pspirek/sslclient/pavel_curl.pem"
echo "--- conf-start 1"
POST_DATA='{ "jetconf:input": {"name": "Edit 1", "options": "config"} }'
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-start"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST -d "$POST_DATA" "$URL"
echo "--- DELETE album Wasting Time"
URL="https://127.0.0.1:8443/restconf/data/example-jukebox:jukebox/library/artist=New%20Artist/album=Wasting%20Time"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X DELETE -d "$POST_DATA" "$URL"
echo "--- conf-commit"
URL="https://127.0.0.1:8443/restconf/operations/jetconf:conf-commit"
curl --http2 -k --cert-type PEM -E $CLIENT_CERT -X POST "$URL"
{
"example-jukebox:album": {
"name": "Wasting Time",
"genre": "example-jukebox:alternative",
"year": 2017,
"song" : [
{
"name": "Wasting Time",
"location": "/media/foo/a7/wasting-time.mp3",
"format": "MP3",
"length": 100
}
]
}
}
{
"example-jukebox:artist": {
"name": "New Artist"
}
}
from yangson.datamodel import DataModel
from yangson.instance import InstanceRoute
module_dir = "../yang-data/"
yang_library_file = "../yang-data/yang-library-data.json"
with open(yang_library_file) as ylfile:
yl = ylfile.read()
dm = DataModel(yl, [module_dir])
with open("data.json", "rt") as fp:
json_data = dm.from_raw(json.load(fp))
handler_sn = dm.get_data_node("/dns-server:dns-server-state/zone")
handler_generated = [
{
'domain': 'example.com',
'class': 'IN',
'server-role': 'master',
'serial': 2010111201
}
]
cooked_val = handler_sn.from_raw(handler_generated)
ii_str_abs = "/dns-server:dns-server-state/zone=example.com/class"
ii_abs = dm.parse_resource_id(ii_str_abs)
print("Absolute II: {}".format(ii_abs))
ii_rel = InstanceRoute(ii_abs[2:])
print("Relative II (hardcoded for now): {}".format(ii_rel))
handler_n = handler_sn.orphan_instance(cooked_val)
n_desired = handler_n.goto(ii_rel)
# crashes here
print(n_desired.value)
n = handler_n[0]
print(n.value)
for i in n:
print(i)
print(type(i))
"""Python libknot interface."""
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment