ncs.experimental Module
Experimental stuff.
This module contains experimental and totally unsupported things that may change or disappear at any time in the future. If used, it must be explicitly imported.
Classes
class DataCallbacks
High-level API for implementing data callbacks.
Higher level abstraction for the DP API. Currently supports read operations only, as such it is suitable for config false; data.
Registered callbacks are searched for in registration order. Most specific points must be registered first.
args parameter to handler callbacks is a dictionary with keys matching list names in the keypath. If multiple lists with the same name exists the keys are named list-0, list-1 etc where 0 is the top-most list with name list. Values in the dictionary are python types (.as_pyval()), if the list has multiple keys it is set as a list else the single key value is set.
Example args for keypath /root/single-key-list{name}/conflict{first}/conflict{second}/multi{1 one}
{'single-key-list': 'name',
'conflict-0': 'first',
'conflict-1': 'second',
'multi': [1, 'one']}
Example handler and registration:
class Handler(object):
def get_object(self, tctx, kp, args):
return {'leaf1': 'value', 'leaf2': 'value'}
def get_next(self, tctx, kp, args, next):
return None
def count(self):
return 0
dcb = DataCallbacks(log)
dcb.register('/namespace:container', Handler())
_confd.dp.register_data_cb(dd.ctx(), example_ns.callpoint_handler, dcb)
DataCallbacks(log)
Members:
class Query
Class encapsulating a MAAPI query operation.
Supports the pattern of executing a query and iterating over the result sets as they are requested. The class handles the calls to query_start, query_result and query_stop, which means that one can focus on describing the query and handle the result.
Example query:
with Query(trans, 'device', '/devices', ['name', 'address', 'port'],
result_as=ncs.QUERY_TAG_VALUE) as q:
for r in q:
print(r)
Query(trans, expr, context_node, select, chunk_size=1000, initial_offset=1, result_as=3, sort=[])
Initialize a Query.
Members:
Last updated
Was this helpful?