File: python-yuma-example.py

package info (click to toggle)
yuma123 2.14-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 22,436 kB
  • sloc: ansic: 185,144; cpp: 10,968; python: 7,990; sh: 2,676; makefile: 1,175; xml: 807; exp: 776; perl: 70
file content (32 lines) | stat: -rw-r--r-- 850 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import yuma
import sys

yuma.init()

print("Loading schema module python-yuma-example.yang")

(res, mod) = yuma.schema_module_load("python-yuma-example.yang")
if(res!=0):
	print("Error: python-yuma-example.yang failed to load!")
	sys.exit(1)

(res, root_val) = yuma.cfg_load("python-yuma-example.xml")
if(res!=0):
	print("Error: python-yuma-example.xml failed to load!")
	sys.exit(1)

(res, python_yuma_example_val) = yuma.val_find_child(root_val, "python-yuma-example", "python-yuma-example")
if(res!=0):
	print("Error: Missing /python-yuma-example container!")
	sys.exit(1)

(res, message_val) = yuma.val_find_child(python_yuma_example_val, "python-yuma-example", "message")
if(res!=0):
	print("Error: Missing /python-yuma-example/message leaf!")
	sys.exit(1)

print((yuma.val_string(message_val)))

yuma.val_dump_value(root_val,1)

print("Done.")