_confd
index
/lab/build/tailf-src/confddoc.confdbasic.confd-6.4-x86_64/confd_dir/src/confd/pyapi/_confd/__init__.py

Common functions for applications connecting to ConfD.
 
The module is used to connect to ConfD. It describes functions and data
structures that are not specific to any of the APIs described in the
submodules.
 
This documentation should be read together with the confd_lib_lib(3) man page.

 
Package Contents
       
_confd_py2
deprecated (package)

 
Classes
       
__builtin__.object
AttrValue
AuthorizationInfo
CsCase
CsChoice
CsNode
CsNodeInfo
CsType
DateTime
HKeypathRef
QueryResult
SnmpVarbind
TagValue
TransCtxRef
UserInfo
Value
XmlTag

 
class AttrValue(__builtin__.object)
    This type represents the c-type confd_attr_value_t.
 
The contructor for this type has the following signature:
 
AttrValue(attr, v) -> object
 
Keyword arguments:
attr -- attribute type
v -- value
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
attr
attribute type (int)
v
attribute value (Value)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class AuthorizationInfo(__builtin__.object)
    This type represents the c-type struct confd_authorization_info.
 
AuthorizationInfo cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
groups
authorization groups (list of strings)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CsCase(__builtin__.object)
    This type represents the c-type struct confd_cs_case.
 
CsCase cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
choices(...)
choices() -> CsChoice | None
 
Returns the CsCase choices.
first(...)
first() -> CsNode | None
 
Returns the CsCase first.
last(...)
last() -> CsNode | None
 
Returns the CsCase last.
next(...)
next() -> CsCase | None
 
Returns the CsCase next.
ns(...)
ns() -> int
 
Returns the CsCase ns hash.
parent(...)
parent() -> CsChoice | None
 
Returns the CsCase parent.
tag(...)
tag() -> int
 
Returns the CsCase tag hash.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CsChoice(__builtin__.object)
    This type represents the c-type struct confd_cs_choice.
 
CsChoice cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
case_parent(...)
case_parent() -> CsCase | None
 
Returns the CsChoice case parent.
cases(...)
cases() -> CsCase | None
 
Returns the CsChoice cases.
default_case(...)
default_case() -> CsCase | None
 
Returns the CsChoice default case.
min_occurs(...)
min_occurs() -> int
 
Returns the CsChoice minOccurs.
next(...)
next() -> CsChoice | None
 
Returns the CsChoice next.
ns(...)
ns() -> int
 
Returns the CsChoice ns hash.
parent(...)
parent() -> CsNode | None
 
Returns the CsChoice parent CsNode.
tag(...)
tag() -> int
 
Returns the CsChoice tag hash.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CsNode(__builtin__.object)
    This type represents the c-type struct confd_cs_node.
 
CsNode cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
children(...)
children() -> CsNode | None
 
Returns the children CsNode or None.
has_display_when(...)
has_display_when() -> bool
 
Returns True if CsNode has YANG 'tailf:display-when' statement(s).
has_when(...)
has_when() -> bool
 
Returns True if CsNode has YANG 'when' statement(s).
info(...)
info() -> CsNodeInfo
 
Returns a CsNodeInfo.
is_action(...)
is_action() -> bool
 
Returns True if CsNode is an action.
is_action_param(...)
is_action_param() -> bool
 
Returns True if CsNode is an action parameter.
is_action_result(...)
is_action_result() -> bool
 
Returns True if CsNode is an action result.
is_case(...)
is_case() -> bool
 
Returns True if CsNode is a case.
is_container(...)
is_container() -> bool
 
Returns True if CsNode is a container.
is_empty_leaf(...)
is_empty_leaf() -> bool
 
Returns True if CsNode is a leaf which is empty.
is_key(...)
is_key() -> bool
 
Returns True if CsNode is a key.
is_leaf(...)
is_leaf() -> bool
 
Returns True if CsNode is a leaf.
is_leaf_list(...)
is_leaf_list() -> bool
 
Returns True if CsNode is a leaf-list.
is_list(...)
is_list() -> bool
 
Returns True if CsNode is a list.
is_non_empty_leaf(...)
is_non_empty_leaf() -> bool
 
Returns True if CsNode is a leaf which is not of type empty.
is_notif(...)
is_notif() -> bool
 
Returns True if CsNode is a notification.
is_np_container(...)
is_np_container() -> bool
 
Returns True if CsNode is a non presence container.
is_oper(...)
is_oper() -> bool
 
Returns True if CsNode is OPER data.
is_p_container(...)
is_p_container() -> bool
 
Returns True if CsNode is a presence container.
is_writable(...)
is_writable() -> bool
 
Returns True if CsNode is writable.
next(...)
next() -> CsNode | None
 
Returns the next CsNode or None.
ns(...)
ns() -> int
 
Returns the namespace value.
parent(...)
parent() -> CsNode | None
 
Returns the parent CsNode or None.
tag(...)
tag() -> int
 
Returns the tag value.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CsNodeInfo(__builtin__.object)
    This type represents the c-type struct confd_cs_node_info.
 
CsNodeInfo cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
choices(...)
choices() -> CsChoice | None
 
Returns CsNodeInfo choices.
cmp(...)
cmp() -> int
 
Returns CsNodeInfo cmp.
defval(...)
defval() -> Value
 
Returns CsNodeInfo value.
flags(...)
flags() -> int
 
Returns CsNodeInfo flags.
keys(...)
keys() -> list(unsigned int)
 
Returns a list of hashed key values.
max_occurs(...)
max_occurs() -> int
 
Returns CsNodeInfo max_occurs.
meta_data(...)
meta_data() -> PyDict | None
 
Returns CsNodeInfo meta_data.
min_occurs(...)
min_occurs() -> int
 
Returns CsNodeInfo min_occurs.
shallow_type(...)
shallow_type() -> int
 
Returns CsNodeInfo shallow_type.
type(...)
type() -> int
 
Returns CsNodeInfo type.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class CsType(__builtin__.object)
    This type represents the c-type struct confd_type.
 
CsType cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
defval(...)
defval() -> CsType | None
 
Returns the CsType defval.
parent(...)
parent() -> CsType | None
 
Returns the CsType parent.

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class DateTime(__builtin__.object)
    This type represents the c-type struct confd_datetime.
 
The contructor for this type has the following signature:
 
DateTime(year, month, day, hour, min, sec, micro, timezone,
         timezone_minutes) -> object
 
Keyword arguments:
year -- the year (int)
month -- the month (int)
day -- the day (int)
hour -- the hour (int)
min -- minutes (int)
sec -- seconds (int)
micro -- micro seconds (int)
timezone -- the timezone (int)
timezone_minutes -- number of timezone_minutes (int)
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
day
the day
hour
the hour
micro
micro seconds
min
minutes
month
the month
sec
seconds
timezone
timezone
timezone_minutes
timezone minutes
year
the year

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class HKeypathRef(__builtin__.object)
    This type represents the c-type confd_hkeypath_t.
 
HKeypathRef implements some sequence methods which enables indexing,
iteration and length checking. There is also support for slicing, e.g:
 
Lets say the variable hkp is a valid hkeypath pointing to '/foo/bar{a}/baz'
and we slice that object like this:
 
  newhkp = hkp[1:]
 
In this case newhkp will be a new hkeypath pointing to '/foo/bar{a}'.
Note that the last element must always be included, so trying to create
a slice with hkp[1:2] will fail.
 
The example above could also be written using the dup_len() method:
 
  newhkp = hkp.dup_len(3)
 
Retrieving an element of the HKeypathRef when the underlying Value is of
type C_XMLTAG returns a XmlTag instance. In all other cases a tuple of
Values is returned.
 
When receiving an HKeypathRef object as on argument in a callback method,
the underlying object is only borrowed, so this particular instance is only
valid inside that callback method. If one, for some reason, would like
to keep the HKeypathRef object 'alive' for any longer than that, use
dup() or dup_len() to get a copy of it. Slicing also creates a copy.
 
HKeypathRef cannot be directly instantiated from Python.
 
  Methods defined here:
__getitem__(...)
x.__getitem__(y) <==> x[y]
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__len__(...)
x.__len__() <==> len(x)
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
dup(...)
dup() -> HKeypathRef
 
Duplicates this hkeypath.
dup_len(...)
dup_len(len) -> HKeypathRef
 
Duplicates the first len elements of this hkeypath.
 
Keyword arguments:
len -- number of elements to include in the copy

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class QueryResult(__builtin__.object)
    This type represents the c-type struct confd_query_result.
 
QueryResult implements some sequence methods which enables indexing,
iteration and length checking.
 
QueryResult cannot be directly instantiated from Python.
 
  Methods defined here:
__getitem__(...)
x.__getitem__(y) <==> x[y]
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__len__(...)
x.__len__() <==> len(x)
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
nelements
number of elements (int)
nresults
number of results (int)
offset
the offset (int)
type
the query result type (int)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class SnmpVarbind(__builtin__.object)
    This type represents the c-type struct confd_snmp_varbind.
 
The contructor for this type has the following signature:
 
SnmpVarbind(type, val, vartype, name, oid, cr) -> object
 
Keyword arguments:
type -- SNMP_VARIABLE, SNMP_OID or SNMP_COL_ROW (int)
val -- value (Value)
vartype -- snmp type (optional)
name -- mandatory if type is SNMP_VARIABLE (string)
oid -- mandatory if type is SNMP_OID (list of integers)
cr -- mandatory if type is SNMP_COL_ROW (described below)
 
When type is SNMP_COL_ROW the cr argument must be provided. It is built up
as a 2-tuple like this: tuple(string, list(int)).
 
The first element of the 2-tuple is the column name.
 
The second element (the row index) is a list of up to 128 integers.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
type
the SnmpVarbind type

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class TagValue(__builtin__.object)
    This type represents the c-type confd_tag_value_t.
 
In addition to the 'ns' and 'tag' attributes there is an additional
attribute 'v' which containes the Value object.
 
The contructor for this type has the following signature:
 
TagValue(xmltag, v, tag, ns) -> object
 
There are two ways to contruct this object. The first one requires that both
xmltag and v are specified. The second one requires that both tag and ns are
specified.
 
Keyword arguments:
xmltag -- a XmlTag instance (optional)
v -- a Value instance (optional)
tag -- tag hash (optional)
ns -- namespace hash (optional)
 
  Methods defined here:
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
ns
namespace hash
tag
tag hash

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class TransCtxRef(__builtin__.object)
    This type represents the c-type struct confd_trans_ctx.
 
Available attributes:
fd -- worker socket (int)
th -- transaction handle (int)
secondary_index -- secondary index number for list traversal (int)
username -- from user session (string)
context -- from user session (string)
 
TransCtxRef cannot be directly instantiated from Python.
 
  Methods defined here:
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class UserInfo(__builtin__.object)
    This type represents the c-type struct confd_user_info.
 
UserInfo cannot be directly instantiated from Python.
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
actx_thandle
actx_thandle -- action context transaction handle
addr
addr -- ip address (string)
af
af -- address family AF_INIT or AF_INET6 (int)
clearpass
clearpass -- password if available (string)
context
context -- the context (string)
flags
flags -- CONFD_USESS_FLAG_... (int)
lmode
lmode -- the lock we have (int)
logintime
logintime -- time for login (long)
port
port -- source port (int)
proto
proto -- protocol (int)
snmp_v3_ctx
snmp_v3_ctx -- SNMP context (string)
username
username -- the username (string)
usid
usid -- user session id (int)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class Value(__builtin__.object)
    This type represents the c-type confd_value_t.
 
The contructor for this type has the following signature:
 
Value(init, type) -> object
 
If type is not provided it will be automatically set by inspecting the type
of argument init according to this table:
 
Python type         Value type
------------------------------
bool                C_BOOL
int                 C_INT32
long                C_INT64
float               C_DOUBLE
string              C_BUF
 
If any other type is provided for the init argument, the type will be set to
C_BUF and the value will be the string representation of init.
 
For types C_XMLTAG, C_XMLBEGIN and C_XMLEND the init argument must be a
2-tuple which specifies the tag and ns values like this: (tag, ns).
 
For type C_IDENTITYREF the init argument must be a
2-tuple which specifies the ns and id values like this: (ns, id).
 
For types C_IPV4, C_IPV6, C_DATETIME, C_DATE, C_TIME, C_DURATION, C_OID,
C_IPV4PREFIX and C_IPV6PREFIX, the init argument must be a string.
 
For type C_DECIMAL64 the init argument must be a string, or a 2-tuple which
specifies value and fraction digits like this: (value, fraction_digits).
 
For type C_BINARY the init argument must be a string.
 
Keyword arguments:
init -- the initial value
type -- type (optional, see confd_types(3))
 
  Methods defined here:
__eq__(...)
x.__eq__(y) <==> x==y
__float__(...)
x.__float__() <==> float(x)
__ge__(...)
x.__ge__(y) <==> x>=y
__getitem__(...)
x.__getitem__(y) <==> x[y]
__gt__(...)
x.__gt__(y) <==> x>y
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__int__(...)
x.__int__() <==> int(x)
__iter__(...)
x.__iter__() <==> iter(x)
__le__(...)
x.__le__(y) <==> x<=y
__len__(...)
x.__len__() <==> len(x)
__long__(...)
x.__long__() <==> long(x)
__lt__(...)
x.__lt__(y) <==> x<y
__ne__(...)
x.__ne__(y) <==> x!=y
__nonzero__(...)
x.__nonzero__() <==> x != 0
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)
as_decimal64(...)
as_decimal64() -> tuple(int, int)
 
Returns a tuple containing (value, fraction_digits) if this value is of
type C_DECIMAL64.
as_list(...)
as_list() -> list
 
Returns a list of Value's if this value is of type C_LIST.
as_pyval(...)
as_pyval() -> PyObject
 
Tries to convert a Value to a native Python type. If possible the object
returned will be of the same type as used when initializing a Value object.
If the type cannot be represented as something useful in Python a string
will be returned. Note that not all Value types are supported.
 
E.g. assuming you already have a value object, this should be possible
in most cases:
 
  newvalue = Value(value.as_pyval(), value.confd_type())
as_xmltag(...)
as_xmltag() -> XmlTag
 
Returns a XmlTag instance if this value is of type C_XMLTAG.
confd_type(...)
confd_type() -> int
 
Returns the confd type.
confd_type_str(...)
confd_type_str() -> str
 
Returns a string representation for the Value type.
str2val(...)
str2val(value, schema_type) -> Value
(class method)
 
Create and return a Value from a string. The schema_type argument must be
either a 2-tuple with namespace and keypath, a CsNode instance or a CsType
instance.
 
Keyword arguments:
value -- string value
schema_type -- either (ns, keypath), a CsNode or a CsType
val2str(...)
val2str(schema_type) -> str
 
Return a string representation of Value. The schema_type argument must be
either a 2-tuple with namespace and keypath, a CsNode instance or a CsType
instance.
 
Keyword arguments:
schema_type -- either (ns, keypath), a CsNode or a CsType

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
class XmlTag(__builtin__.object)
    This type represent the c-type struct xml_tag.
 
The contructor for this type has the following signature:
 
XmlTag(ns, tag) -> object
 
Keyword arguments:
ns -- namespace hash
tag -- tag hash
 
  Methods defined here:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature
__repr__(...)
x.__repr__() <==> repr(x)
__str__(...)
x.__str__() <==> str(x)

Data descriptors defined here:
ns
namespace hash value (unsigned int)
tag
tag hash value (unsigned int)

Data and other attributes defined here:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

 
Functions
       
cs_node_cd(...)
cs_node_cd(start, path) -> CsNode | None
 
Utility function which finds the resulting CsNode given an (optional)
starting node and a (relative or absolute) string keypath.
 
Keyword arguments:
start -- a CsNode instance or None
path -- the path
decrypt(...)
decrypt(ciphertext) -> str
 
When data is read over the CDB interface, the MAAPI interface or received
in event notifications, the data for the two builtin types
tailf:des3-cbc-encrypted-string or tailf:aes-cfb-128-encrypted-string is
encrypted. This function decrypts ciphertext and returns the clear text as
a string.
 
Keyword arguments:
ciphertext -- encrypted string
fatal(...)
fatal(str) -> None
 
Utility function which formats a string, prints it to stderr and exits with
exit code 1. This function will never return.
 
Keyword arguments:
str -- a message string
find_cs_node(...)
find_cs_node(hkeypath, len) -> CsNode | None
 
Utility function which finds the CsNode corresponding to the len first
elements of the hashed keypath. To make the search consider the full
keypath leave out the len parameter.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
len -- number of elements to return (optional)
find_cs_node_child(...)
find_cs_node_child(parent, xmltag) -> CsNode | None
 
Utility function which finds the CsNode corresponding to the child node
given as xmltag.
 
See confd_find_cs_node_child() in confd_lib_lib(3).
 
Keyword arguments:
parent -- the parent CsNode
xmltag -- the child node
find_cs_root(...)
find_cs_root(ns) -> CsNode | None
 
When schema information is available to the library, this function returns
the root of the tree representaton of the namespace given by ns for the
(first) toplevel node. For namespaces that are augmented into other
namespaces such that they do not have a toplevel node, this function returns
None - the nodes of such a namespace are found below the augment target
node(s) in other tree(s).
 
Keyword arguments:
ns -- the namespace id
find_ns_type(...)
find_ns_type(nshash, name) -> CsType | None
 
Returns a CsType type definition for the type named name, which is defined
in the namespace identified by nshash, or None if the type could not be
found. If nshash is 0, the type name will be looked up among the built-in
types (i.e. the YANG built-in types, the types defined in the YANG
"tailf-common" module, and the types defined in the "confd" and "xs"
namespaces).
 
Keyword arguments:
nshash -- a namespace hash or 0 (0 searches for built-in types)
name -- the name of the type
get_leaf_list_type(...)
get_leaf_list_type(node) -> CsType
 
For a leaf-list node, the type() method in the CsNodeInfo identifies a
"list type" for the leaf-list "itself". This function returns the type
of the elements in the leaf-list, i.e. corresponding to the type
substatement for the leaf-list in the YANG module.
 
Keyword arguments:
node -- The CsNode of the leaf-list
get_nslist(...)
get_nslist() -> list
 
Provides a list of the namespaces known to the library as a list of
four-tuples. Each tuple contains the the namespace hash (int), the prefix
(string), the namespace uri (string) and the revision (string).
 
If schemas are not loaded an empty list will be returned.
hash2str(...)
hash2str(hash) -> str | None
 
Returns a string representing the node name given by hash, or None if the
hash value is not found. Requires that schema information has been loaded
from the NCS daemon into the library - otherwise it always returns None.
 
Keyword arguments:
hash -- a hash
hkeypath_dup(...)
hkeypath_dup(hkeypath) -> HKeypathRef
 
Duplicates a HKeypathRef object.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
hkeypath_dup_len(...)
hkeypath_dup_len(hkeypath, len) -> HKeypathRef
 
Duplicates the first len elements of hkeypath.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
len -- number of elements to include in the copy
hkp_prefix_tagmatch(...)
hkp_prefix_tagmatch(hkeypath, tags) -> bool
 
A simplified version of hkp_tagmatch() - it returns True if the tagpath
matches a prefix of the hkeypath, i.e. it is equivalent to calling
hkp_tagmatch() and checking if the return value includes CONFD_HKP_MATCH_TAGS.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
tags -- a list of XmlTag instances
hkp_tagmatch(...)
hkp_tagmatch(hkeypath, tags) -> int
 
When checking the hkeypaths that get passed into each iteration in e.g.
cdb_diff_iterate() we can either explicitly check the paths, or use this
function to do the job. The tags list (typically statically initialized)
specifies a tagpath to match against the hkeypath. See cdb_diff_match().
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
tags -- a list of XmlTag instances
init(...)
init(name, file, level) -> None
 
Initializes the ConfD library. Must be called before any other NCS API
functions are called. There should be no need to call this function
directly. It is called internally when the Python module is loaded.
 
Keyword arguments:
name -- e
file -- (optional)
level -- (optional)
max_object_size(...)
max_object_size(object) -> int
 
Utility function which returns the maximum size (i.e. the needed length of
the confd_value_t array) for an "object" retrieved by cdb_get_object(),
maapi_get_object(), and corresponding multi-object functions.
 
Keyword arguments:
object -- the CsNode
mmap_schemas(...)
mmap_schemas(filename) -> None
 
If shared memory schema support has been enabled, this function will
will map a shared memory segment into the current process address space
and make it ready for use.
 
The filename can be obtained by using the get_schema_file_path() function
 
The filename argument specifies the pathname of the file that is used as
backing store.
 
Keyword arguments:
filename -- a filename string
next_object_node(...)
next_object_node(object, cur, value) -> CsNode | None
 
Utility function to allow navigation of the confd_cs_node schema tree in
parallel with the confd_value_t array populated by cdb_get_object(),
maapi_get_object(), and corresponding multi-object functions.
 
The cur parameter is the CsNode for the current value, and the value
parameter is the current value in the array. The function returns a CsNode
for the next value in the array, or None when the complete object has been
traversed. In the initial call for a given traversal, we must pass
children() for the cur parameter - this always points to the CsNode
for the first value in the array.
 
Keyword arguments:
object -- CsNode of the list container node
cur -- The CsNode of the current value
value -- The current value
ns2prefix(...)
ns2prefix(ns) -> str | None
 
Returns a string giving the namespace prefix for the namespace ns, if the
namespace is known to the library - otherwise it returns None.
 
Keyword arguments:
ns -- a namespace hash
pp_kpath(...)
pp_kpath(hkeypath) -> str
 
Utility function which pretty prints a string representation of the path
hkeypath. This will use the NCS curly brace notation, i.e.
"/servers/server{www}/ip". Requires that schema information is available
to the library.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance
pp_kpath_len(...)
pp_kpath_len(hkeypath, len) -> str
 
A variant of pp_kpath() that prints only the first len elements of hkeypath.
 
Keyword arguments:
hkeypath -- a _lib.HKeypathRef instance
len -- number of elements to print
set_debug(...)
set_debug(level, file) -> None
 
Sets the debug level
 
Keyword arguments:
file -- (optional)
level -- (optional)
str2hash(...)
str2hash(str) -> int
 
Returns the hash value representing the node name given by str, or 0 if the
string is not found.  Requires that schema information has been loaded from
the NCS daemon into the library - otherwise it always returns 0.
 
Keyword arguments:
str -- a name string
stream_connect(...)
stream_connect(sock, id, flags, ip, port, path) -> None
 
Connects a stream socket to NCS.
 
Keyword arguments:
sock -- a Python socket instance
id -- id
flags -- flags
ip -- ip address - if sock family is AF_INET or AF_INET6 (optional)
port -- port - if sock family is AF_INET or AF_INET6 (optional)
path -- a filename - if sock family is AF_UNIX (optional)
xpath_pp_kpath(...)
xpath_pp_kpath(hkeypath) -> str
 
Utility function which pretty prints a string representation of the path
hkeypath. This will format the path as an XPath, i.e.
"/servers/server[name="www"']/ip". Requires that schema information is
available to the library.
 
Keyword arguments:
hkeypath -- a HKeypathRef instance

 
Data
        ACCUMULATE = 1
ALREADY_LOCKED = -4
ATTR_ANNOTATION = 2147483649
ATTR_INACTIVE = 0
ATTR_TAGS = 2147483648
CANDIDATE = 1
CONFD_EOF = -2
CONFD_ERR = -1
CONFD_OK = 0
CONFD_PORT = 4565
CS_NODE_CMP_NORMAL = 0
CS_NODE_CMP_SNMP = 1
CS_NODE_CMP_SNMP_IMPLIED = 2
CS_NODE_CMP_UNSORTED = 4
CS_NODE_CMP_USER = 3
CS_NODE_HAS_DISPLAY_WHEN = 1024
CS_NODE_HAS_META_DATA = 2048
CS_NODE_HAS_WHEN = 512
CS_NODE_IS_ACTION = 8
CS_NODE_IS_CASE = 128
CS_NODE_IS_CDB = 4
CS_NODE_IS_CONTAINER = 256
CS_NODE_IS_DYN = 1
CS_NODE_IS_LIST = 1
CS_NODE_IS_NOTIF = 64
CS_NODE_IS_PARAM = 16
CS_NODE_IS_RESULT = 32
CS_NODE_IS_WRITE = 2
CS_NODE_IS_WRITE_ALL = 4096
C_BINARY = 39
C_BIT32 = 29
C_BIT64 = 30
C_BOOL = 17
C_BUF = 5
C_CDBBEGIN = 37
C_DATE = 20
C_DATETIME = 19
C_DECIMAL64 = 43
C_DEFAULT = 42
C_DOUBLE = 14
C_DQUAD = 46
C_DURATION = 27
C_ENUM_HASH = 28
C_ENUM_VALUE = 28
C_HEXSTR = 47
C_IDENTITYREF = 44
C_INT16 = 7
C_INT32 = 8
C_INT64 = 9
C_INT8 = 6
C_IPV4 = 15
C_IPV4PREFIX = 40
C_IPV4_AND_PLEN = 48
C_IPV6 = 16
C_IPV6PREFIX = 41
C_IPV6_AND_PLEN = 49
C_LIST = 31
C_NOEXISTS = 1
C_OBJECTREF = 34
C_OID = 38
C_PTR = 36
C_QNAME = 18
C_STR = 4
C_SYMBOL = 3
C_TIME = 23
C_UINT16 = 11
C_UINT32 = 12
C_UINT64 = 13
C_UINT8 = 10
C_UNION = 35
C_XMLBEGIN = 32
C_XMLBEGINDEL = 45
C_XMLEND = 33
C_XMLTAG = 2
DEBUG = 1
DELAYED_RESPONSE = 2
EOF = -2
ERR = -1
ERRCODE_ACCESS_DENIED = 3
ERRCODE_APPLICATION = 4
ERRCODE_APPLICATION_INTERNAL = 5
ERRCODE_DATA_MISSING = 8
ERRCODE_INCONSISTENT_VALUE = 2
ERRCODE_INTERNAL = 7
ERRCODE_INTERRUPT = 9
ERRCODE_IN_USE = 0
ERRCODE_PROTO_USAGE = 6
ERRCODE_RESOURCE_DENIED = 1
ERRINFO_KEYPATH = 0
ERRINFO_STRING = 1
ERR_ABORTED = 49
ERR_ACCESS_DENIED = 3
ERR_ALREADY_EXISTS = 2
ERR_APPLICATION_INTERNAL = 39
ERR_BADPATH = 8
ERR_BADSTATE = 17
ERR_BADTYPE = 5
ERR_BAD_CONFIG = 36
ERR_BAD_KEYREF = 14
ERR_CLI_CMD = 59
ERR_DATA_MISSING = 58
ERR_EOF = 45
ERR_EXTERNAL = 19
ERR_HA_BADFXS = 27
ERR_HA_BADNAME = 29
ERR_HA_BADTOKEN = 28
ERR_HA_BADVSN = 52
ERR_HA_BIND = 30
ERR_HA_CLOSED = 26
ERR_HA_CONNECT = 25
ERR_HA_NOTICK = 31
ERR_HA_WITH_UPGRADE = 47
ERR_INCONSISTENT_VALUE = 38
ERR_INTERNAL = 18
ERR_INUSE = 11
ERR_INVALID_INSTANCE = 43
ERR_LIB_NOT_INITIALIZED = 34
ERR_LOCKED = 10
ERR_MALLOC = 20
ERR_MISSING_INSTANCE = 42
ERR_MUST_FAILED = 41
ERR_NOEXISTS = 1
ERR_NON_UNIQUE = 13
ERR_NOSESSION = 22
ERR_NOSTACK = 9
ERR_NOTCREATABLE = 6
ERR_NOTDELETABLE = 7
ERR_NOTMOVABLE = 46
ERR_NOTRANS = 61
ERR_NOTSET = 12
ERR_NOT_IMPLEMENTED = 51
ERR_NOT_WRITABLE = 4
ERR_OS = 24
ERR_POLICY_COMPILATION_FAILED = 54
ERR_POLICY_EVALUATION_FAILED = 55
ERR_POLICY_FAILED = 53
ERR_PROTOUSAGE = 21
ERR_RESOURCE_DENIED = 37
ERR_START_FAILED = 57
ERR_SUBAGENT_DOWN = 33
ERR_TIMEOUT = 48
ERR_TOOMANYTRANS = 23
ERR_TOO_FEW_ELEMS = 15
ERR_TOO_MANY_ELEMS = 16
ERR_TOO_MANY_SESSIONS = 35
ERR_UNAVAILABLE = 44
ERR_UNSET_CHOICE = 40
ERR_UPGRADE_IN_PROGRESS = 60
ERR_VALIDATION_WARNING = 32
ERR_XPATH = 50
FALSE = 0
FIND_NEXT = 0
FIND_SAME_OR_NEXT = 1
HKP_MATCH_FULL = 3
HKP_MATCH_HKP = 2
HKP_MATCH_NONE = 0
HKP_MATCH_TAGS = 1
IN_USE = -5
ITER_CONTINUE = 3
ITER_RECURSE = 2
ITER_STOP = 1
ITER_SUSPEND = 4
ITER_UP = 5
ITER_WANT_ANCESTOR_DELETE = 2
ITER_WANT_ATTR = 4
ITER_WANT_CLI_STR = 8
ITER_WANT_LEAF_FIRST_ORDER = 32
ITER_WANT_LEAF_LAST_ORDER = 64
ITER_WANT_PREV = 1
ITER_WANT_P_CONTAINER = 256
ITER_WANT_REVERSE = 128
ITER_WANT_SCHEMA_ORDER = 16
LIB_API_VSN = 100925440
LIB_API_VSN_STR = '06040000'
LIB_PROTO_VSN = 64
LIB_PROTO_VSN_STR = '64'
LIB_VSN = 100925440
LIB_VSN_STR = '06040000'
LISTENER_CLI = 8
LISTENER_IPC = 1
LISTENER_NETCONF = 2
LISTENER_SNMP = 4
LISTENER_WEBUI = 16
LOAD_SCHEMA_HASH = 65536
LOAD_SCHEMA_NODES = 1
LOAD_SCHEMA_TYPES = 2
MMAP_SCHEMAS_FIXED_ADDR = 2
MMAP_SCHEMAS_KEEP_SIZE = 1
MOP_ATTR_SET = 6
MOP_CREATED = 1
MOP_DELETED = 2
MOP_MODIFIED = 3
MOP_MOVED_AFTER = 5
MOP_VALUE_SET = 4
NCS_ERR_CONNECTION_CLOSED = 64
NCS_ERR_CONNECTION_REFUSED = 56
NCS_ERR_CONNECTION_TIMEOUT = 63
NCS_ERR_DEVICE = 65
NCS_ERR_SERVICE_CONFLICT = 62
NCS_ERR_TEMPLATE = 66
NCS_PORT = 4569
NO_DB = 0
OK = 0
OPERATIONAL = 4
PORT = 4565
PRE_COMMIT_RUNNING = 6
PROTO_CONSOLE = 4
PROTO_HTTP = 6
PROTO_HTTPS = 7
PROTO_SSH = 2
PROTO_SSL = 5
PROTO_SYSTEM = 3
PROTO_TCP = 1
PROTO_TRACE = 3
PROTO_UDP = 8
PROTO_UNKNOWN = 0
QUERY_HKEYPATH = 1
QUERY_HKEYPATH_VALUE = 2
QUERY_STRING = 0
QUERY_TAG_VALUE = 3
READ = 1
READ_WRITE = 2
RUNNING = 2
SERIAL_HKEYPATH = 2
SERIAL_NONE = 0
SERIAL_TAG_VALUE = 3
SERIAL_VALUE_T = 1
SILENT = 0
SNMP_COL_ROW = 3
SNMP_Counter32 = 6
SNMP_Counter64 = 9
SNMP_INTEGER = 1
SNMP_Interger32 = 2
SNMP_IpAddress = 5
SNMP_NULL = 0
SNMP_OBJECT_IDENTIFIER = 4
SNMP_OCTET_STRING = 3
SNMP_OID = 2
SNMP_Opaque = 8
SNMP_TimeTicks = 7
SNMP_Unsigned32 = 10
SNMP_VARIABLE = 1
STARTUP = 3
TIMEZONE_UNDEF = -111
TRACE = 2
TRANSACTION = 5
TRUE = 1
USESS_FLAG_FORWARD = 1
USESS_FLAG_HAS_IDENTIFICATION = 2
USESS_FLAG_HAS_OPAQUE = 4
USESS_LOCK_MODE_EXCLUSIVE = 2
USESS_LOCK_MODE_NONE = 0
USESS_LOCK_MODE_PRIVATE = 1
USESS_LOCK_MODE_SHARED = 3
VALIDATION_FLAG_COMMIT = 2
VALIDATION_FLAG_TEST = 1
VALIDATION_WARN = -3