- NSO SDK API Reference
- NSO Python API
- ncs
- ncs.alarm
- ncs.application
- ncs.cdb
- ncs.childlist
- ncs.dp
- ncs.error
- ncs.events
- ncs.experimental
- ncs.fsm
- ncs.ha
- ncs.keypath
- ncs.log
- ncs.maagic
- ncs.maapi
- ncs.ns
- ncs.ns.ncs_ns
- ncs.ns.netconf_ncs_ns
- ncs.pool
- ncs.progress
- ncs.service_log
- ncs.template
- ncs.tm
- ncs.upgrade
- ncs.util
- _ncs
- _ncs.cdb
- _ncs.dp
- _ncs.error
- _ncs.events
- _ncs.ha
- _ncs.maapi
- NSO Java API
- API Overview
- com.tailf.cdb
- com.tailf.conf
- com.tailf.dp
- com.tailf.dp.annotations
- com.tailf.dp.proto
- com.tailf.dp.services
- com.tailf.ha
- com.tailf.maapi
- com.tailf.navu
- com.tailf.navu.traversal
- com.tailf.ncs
- com.tailf.ncs.alarmman
- com.tailf.ncs.alarmman.common
- com.tailf.ncs.alarmman.consumer
- com.tailf.ncs.alarmman.producer
- com.tailf.ncs.annotations
- com.tailf.ncs.ns
- com.tailf.ncs.proto
- com.tailf.ncs.snmp.snmp4j
- com.tailf.ncs.template
- com.tailf.ned
- com.tailf.notif
- com.tailf.progress
- com.tailf.proto
- com.tailf.util
- NSO Erlang API
- Manual Pages
- NSO Documentation Home
- NSO Guides
- NSO Change Log Explorer
- NSO NED Change Log Explorer
- NSO NED Capabilities Explorer
- NSO on DevNet
- Get Support
Module econfd
An Erlang interface equivalent to the confd_lib_dp C-API (documented in confd_lib_dp(3)).Version: 6.4.3
Description
An Erlang interface equivalent to the confd_lib_dp C-API (documented in confd_lib_dp(3)).
This module is used to connect to ConfD and provide callback functions so that ConfD can populate its northbound agent interfaces with external data. Thus the library consists of a number of API functions whose purpose is to install different callback functions at different points in the XML tree which is the representation of the device configuration. Read more about callpoints in the ConfD User Guide.Data Types
address()
address() = #econfd_conn_ip{} | #econfd_conn_local{}
cb_action()
cb_action() = cb_action_act() | cb_action_cmd() | cb_action_init()
It is the callback for #confd_action_cb.action
cb_action_act()
cb_action_act() = fun((U::#confd_user_info{}, Name::qtag(), KP::ikeypath(), [Param::tagval()]) -> ok | {ok, [Result::tagval()]} | {error, error_reason()})
It is the callback for #confd_action_cb.action when invoked as an action request. If a new worker socket was setup in the cb_action_init that socket will be closed when the callback returns.
cb_action_cmd()
cb_action_cmd() = fun((U::#confd_user_info{}, Name::binary(), Path::binary(), [Arg::binary()]) -> ok | {ok, [Result::binary()]} | {error, error_reason()})
It is the callback for #confd_action_cb.action when invoked as a CLI command callback.
cb_action_init()
cb_action_init() = fun((U::#confd_user_info{}, EconfdOpaque::term()) -> ok | {ok, #confd_user_info{}} | {error, error_reason()})
It is the callback for #confd_action_cb.init If the action should be done in a separate socket, the call to econfd:new_worker_socket/3 must be done here. The worker and its socket will be closed after the cb_action() returns.
cb_authentication()
cb_authentication() = fun((#confd_authentication_ctx{}) -> ok | error | {error, binary()})
The callback for #confd_authentication_cb.auth
cb_candidate_commit()
cb_candidate_commit() = fun((#confd_db_ctx{}, Timeout::integer()) -> ok | {error, error_reason()})
The callback for #confd_db_cbs.candidate_commit
cb_completion_action()
cb_completion_action() = fun((U::#confd_user_info{}, CliStyle::integer(), Token::binary(), CompletionChar::integer(), IKP::ikeypath(), CmdPath::binary(), Id::binary(), TP::term(), Extra::term()) -> [string() | {info, string()} | {desc, string()} | default])
It is the callback for #confd_action_cb.action when invoked as a CLI command completion.
cb_create()
cb_create() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
It is the callback for #confd_data_cbs.create. Only used when we use external database config data, e.g. not for statistics.
cb_ctx()
cb_ctx() = fun((confd_trans_ctx()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()})
The callback for #confd_trans_validate_cbs.init and #confd_trans_cbs.init as well as several other callbacks in #confd_trans_cbs{}
cb_db()
cb_db() = fun((#confd_db_ctx{}, DbName::integer()) -> ok | {error, error_reason()})
The callback for #confd_db_cbs.lock, #confd_db_cbs.unlock, and #confd_db_cbs.delete_config
cb_exists_optional()
cb_exists_optional() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> {ok, cb_exists_optional_reply()} | {ok, cb_exists_optional_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.exists_optional. The exists_optional callback must be present if our YANG model has presence containers or leafs of type empty outside of unions.
If type empty leafs are in unions, then cb_get_elem() is used instead.cb_exists_optional_reply()
cb_exists_optional_reply() = boolean()
cb_find_next()
cb_find_next() = fun((T::confd_trans_ctx(), KP::ikeypath(), FindNextType::integer(), PrevKey::key()) -> {ok, cb_find_next_reply()} | {ok, cb_find_next_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.find_next.
cb_find_next_object()
cb_find_next_object() = fun((T::confd_trans_ctx(), KP::ikeypath(), FindNextType::integer(), PrevKey::key()) -> {ok, cb_find_next_object_reply()} | {ok, cb_find_next_object_reply(), confd_trans_ctx()} | {ok, objects(), TimeoutMillisecs::integer()} | {ok, objects(), TimeoutMillisecs::integer(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
Optional callback which combines the functionality of find_next() and get_object(), and adds the possibility to return multiple objects. It is the callback for #confd_data_cbs.find_next_object. For a detailed description of the two forms of the value list, please refer to the "Value Array" and "Tag Value Array" specifications, respectively, in the XML STRUCTURES section of the confd_types(3) manual page.
cb_find_next_object_reply()
cb_find_next_object_reply() = vals_next() | tag_val_object_next() | {false, undefined}
cb_find_next_reply()
cb_find_next_reply() = {Key::key(), Next::term()} | {false, undefined}
cb_get_attrs()
cb_get_attrs() = fun((T::confd_trans_ctx(), KP::ikeypath(), [Attr::integer()]) -> {ok, cb_get_attrs_reply()} | {ok, cb_get_attrs_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.get_attrs.
cb_get_attrs_reply()
cb_get_attrs_reply() = [{Attr::integer(), V::value()}] | not_found
cb_get_case()
cb_get_case() = fun((T::confd_trans_ctx(), KP::ikeypath(), ChoicePath::[qtag()]) -> {ok, cb_get_case_reply()} | {ok, cb_get_case_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.get_case. Only used when we use 'choice' in the data model. Normally ChoicePath is just a single element with the name of the choice, but if we have nested choices without intermediate data nodes, it will be similar to an ikeypath, i.e. a reversed list of choice and case names giving the path through the nested choices.
cb_get_case_reply()
cb_get_case_reply() = qtag() | not_found
cb_get_elem()
cb_get_elem() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> {ok, cb_get_elem_reply()} | {ok, cb_get_elem_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.get_elem.
cb_get_elem_reply()
cb_get_elem_reply() = value() | not_found
cb_get_log_times()
cb_get_log_times() = fun((#confd_notification_ctx{}) -> {ok, {Created::datetime(), Aged::datetime() | not_found}} | {error, error_reason()})
The callback for #confd_notification_stream_cbs.get_log_times
cb_get_next()
cb_get_next() = fun((T::confd_trans_ctx(), KP::ikeypath(), Prev::term()) -> {ok, cb_get_next_reply()} | {ok, cb_get_next_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.get_next. Prev is the integer -1 on the first call.
cb_get_next_object()
cb_get_next_object() = fun((T::confd_trans_ctx(), KP::ikeypath(), Prev::term()) -> {ok, cb_get_next_object_reply()} | {ok, cb_get_next_object_reply(), confd_trans_ctx()} | {ok, objects(), TimeoutMillisecs::integer()} | {ok, objects(), TimeoutMillisecs::integer(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
Optional callback which combines the functionality of get_next() and get_object(), and adds the possibility to return multiple objects. It is the callback for #confd_data_cbs.get_next_object. For a detailed description of the two forms of the value list, please refer to the "Value Array" and "Tag Value Array" specifications, respectively, in the XML STRUCTURES section of the confd_types(3) manual page.
cb_get_next_object_reply()
cb_get_next_object_reply() = vals_next() | tag_val_object_next() | {false, undefined}
cb_get_next_reply()
cb_get_next_reply() = {Key::key(), Next::term()} | {false, undefined}
cb_get_object()
cb_get_object() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> {ok, cb_get_object_reply()} | {ok, cb_get_object_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
Optional callback which is used to return an entire object. It is the callback for #confd_data_cbs.get_object. For a detailed description of the two forms of the value list, please refer to the "Value Array" and "Tag Value Array" specifications, respectively, in the XML STRUCTURES section of the confd_types(3) manual page.
cb_get_object_reply()
cb_get_object_reply() = vals() | tag_val_object() | not_found
cb_lock_partial()
cb_lock_partial() = fun((#confd_db_ctx{}, DbName::integer(), LockId::integer(), [ikeypath()]) -> ok | {error, error_reason()})
The callback for #confd_db_cbs.lock_partial
cb_move_after()
cb_move_after() = fun((T::confd_trans_ctx(), KP::ikeypath(), PrevKeys::{value()}) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.move_after. PrevKeys == {} means that the list entry should become the first one.
cb_num_instances()
cb_num_instances() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> {ok, cb_num_instances_reply()} | {ok, cb_num_instances_reply(), confd_trans_ctx()} | {error, error_reason()} | delayed_response)
Optional callback, if it doesn't exist it will be emulated by consecutive calls to get_next(). It is the callback for #confd_data_cbs.num_instances.
cb_num_instances_reply()
cb_num_instances_reply() = integer()
cb_ok()
cb_ok() = fun((confd_trans_ctx()) -> ok | {error, error_reason()})
The callback for #confd_trans_cbs.finish and #confd_trans_validate_cbs.stop
cb_ok_db()
cb_ok_db() = fun((#confd_db_ctx{}) -> ok | {error, error_reason()})
The callback for #confd_db_cbs.candidate_confirming_commit and several other callbacks in #confd_db_cbs{}
cb_remove()
cb_remove() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
It is the callback for #confd_data_cbs.remove. Only used when we use external database config data, e.g. not for statistics.
cb_replay()
cb_replay() = fun((#confd_notification_ctx{}, Start::datetime(), Stop::datetime() | undefined) -> ok | {error, error_reason()})
The callback for #confd_notification_stream_cbs.replay
cb_set_attr()
cb_set_attr() = fun((T::confd_trans_ctx(), KP::ikeypath(), Attr::integer(), cb_set_attr_value()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.set_attr. Value == undefined means that the attribute should be deleted.
cb_set_attr_value()
cb_set_attr_value() = value() | undefined
cb_set_case()
cb_set_case() = fun((T::confd_trans_ctx(), KP::ikeypath(), ChoicePath::[qtag()], Case::qtag() | '$none') -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.set_case. Only used when we use 'choice' in the data model. Case == '$none' means that no case is chosen (i.e. all have been deleted). Normally ChoicePath is just a single element with the name of the choice, but if we have nested choices without intermediate data nodes, it will be similar to an ikeypath, i.e. a reversed list of choice and case names giving the path through the nested choices.
cb_set_elem()
cb_set_elem() = fun((T::confd_trans_ctx(), KP::ikeypath(), Value::value()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
It is the callback for #confd_data_cbs.set_elem. Only used when we use external database config data, e.g. not for statistics.
cb_str_to_val()
cb_str_to_val() = fun((TypeCtx::term(), String::string()) -> {ok, Value::value()} | error | {error, Reason::binary()} | none())
The callback for #confd_type_cbs.str_to_val. The TypeCtx argument is currently unused (passed as 'undefined'). The function may fail - this is equivalent to returning 'error'.
cb_trans_lock()
cb_trans_lock() = fun((confd_trans_ctx()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | confd_already_locked)
The callback for #confd_trans_cbs.trans_lock. The confd_already_locked return value is equivalent to {error, #confd_error{ code = in_use }}.
cb_unlock_partial()
cb_unlock_partial() = fun((#confd_db_ctx{}, DbName::integer(), LockId::integer()) -> ok | {error, error_reason()})
The callback for #confd_db_cbs.unlock_partial
cb_val_to_str()
cb_val_to_str() = fun((TypeCtx::term(), Value::value()) -> {ok, String::string()} | error | {error, Reason::binary()} | none())
The callback for #confd_type_cbs.val_to_str. The TypeCtx argument is currently unused (passed as 'undefined'). The function may fail - this is equivalent to returning 'error'.
cb_validate()
cb_validate() = fun((T::confd_trans_ctx(), KP::ikeypath(), Newval::value()) -> ok | {ok, confd_trans_ctx()} | {validation_warn, Reason::binary()} | {error, error_reason()})
It is the callback for #confd_valpoint_cb.validate.
cb_validate_value()
cb_validate_value() = fun((TypeCtx::term(), Value::value()) -> ok | error | {error, Reason::binary()} | none())
The callback for #confd_type_cbs.validate. The TypeCtx argument is currently unused (passed as 'undefined'). The function may fail - this is equivalent to returning 'error'.
cb_write()
cb_write() = fun((confd_trans_ctx()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | confd_in_use)
The callback for #confd_trans_cbs.write_start and #confd_trans_cbs.prepare. The confd_in_use return value is equivalent to {error, #confd_error{ code = in_use }}.
cb_write_all()
cb_write_all() = fun((T::confd_trans_ctx(), KP::ikeypath()) -> ok | {ok, confd_trans_ctx()} | {error, error_reason()} | delayed_response)
This is the callback for #confd_data_cbs.write_all. The KP argument is currently always [], since the callback does not pertain to any particular data node.
cmp_op()
cmp_op() = 0 | 1 | 2 | 3 | 4 | 5 | 6
confd_trans_ctx()
confd_trans_ctx() = #confd_trans_ctx{}
connect_result()
connect_result() = {ok, socket()} | {error, error_reason()} | {error, atom()}
This is the return type of connect() function.
datetime()
datetime() = {C_DATETIME::integer(), datetime_date_and_time()}
The value representation for yang:date-and-time, also used in the API functions for notification streams.
datetime_date_and_time()
datetime_date_and_time() = {Year::integer(), Month::integer(), Day::integer(), Hour::integer(), Minute::integer(), Second::integer(), MicroSecond::integer(), TZ::integer(), TZMinutes::integer()}
error_reason()
error_reason() = binary() | #confd_error{} | tuple()
The callback functions may return errors either as a plain string or via a #confd_error{} record - see econfd.hrl and the section EXTENDED ERROR REPORTING in confd_lib_lib(3) (tuple() is only for internal ConfD/NCS use). {error, String} is equivalent to {error, #confd_error{ code = application, str = String }}.
exec_op()
exec_op() = 7 | 8 | 9 | 10 | 11
ikeypath()
An ikeypath() is a list describing a path down into the data tree.
The Ikeypaths are used to denote specific objects in the XML instance
document. The list is in backwards order, thus the head of the list
is the leaf element. All the data callbacks defined in
#confd_data_cbs{} receive ikeypath() lists as an argument. The last
(top) element of the list is a pair [NS|XmlTag]
where NS is
the atom defining the XML namespace of the XmlTag and
XmlTag is an XmlTag::atom() denoting the toplevel XML element.
Elements in the list that have a different namespace than their parent
are also qualified through such a pair with the element's namespace,
but all other elements are represented by their unqualified tag() atom.
Thus an ikeypath() uniquely addresses an instance of an element in
the configuration XML tree. List entries are
identified by an element in the ikeypath() list expressed as {Key}
or, when we are using CDB, as [Integer]. During an individual CDB
session all the elements are implictly numbered, thus we can through
a call to econfd_cdb:num_instances/2 retrieve how many entries (N)
for a given list that we have, and then retrieve those entries
(0 - (N-1)) inserting [I] as the key.
ip()
ipv4()
ipv4() = {0..255, 0..255, 0..255, 0..255}
ipv6()
ipv6() = {0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535, 0..65535}
key()
key() = {value()} | [Index::integer()]
Keys are parts of ikeypath(). In the YANG data model we define how many keys a list node has. If we have 1 key, the key is an arity-1 tuple, 2 keys - an arity-2 tuple and so forth. The [Index] notation is only valid for keys in ikeypaths when we use CDB.
list_filter_op()
list_filter_op() = cmp_op() | exec_op()
list_filter_type()
list_filter_type() = 0 | 1 | 2 | 3 | 4 | 5 | 6
namespace()
namespace() = atom()
objects()
objects() = [vals_next() | tag_val_object_next() | false]
qtag()
qtag() = tag() | tag_cons(namespace(), tag())
A "qualified tag" is either a single tag or a pair of a namespace and a tag. An example could be 'interface' or ['http://example.com/ns/interfaces/2.1' | interface]
socket()
socket() = {gen_tcp, gen_tcp:socket()} | {local_ipc, socket:socket()} | int_ipc:sock()
tag()
tag() = atom()
tag_cons()
tag_cons(T1, T2) = nonempty_improper_list(T1, T2)
tag_val_object()
tag_val_object() = {exml, [TV::tagval()]}
tag_val_object_next()
tag_val_object_next() = {tag_val_object(), Next::term()}
tagpath()
tagpath() = [qtag()]
A tagpath() is a list describing a path down into the schema tree.
I.e. as opposed to an ikeypath(), it has no instance information.
Additionally the last (top) element is not [NS|XmlTag]
as in
ikeypath(), but only XmlTag
- i.e. it needs to be combined with
a namespace to uniquely identify a schema node. The other elements
in the path are qualified - or not - exactly as for ikeypath().
tagval()
tagval() = {qtag(), value() | start | {start, Index::integer()} | stop | leaf | delete}
This is used to represent XML elements together with their values, typically in a list representing an XML subtree as in the arguments and result of the 'action' callback. Typeless elements have the special "values":
start
- opening container or list element.{start, Index :: integer()}
- opening list element with CDB Index instead of key value(s) - only valid for CDB access.stop
- closing container or list element.leaf
- leaf with type "empty".delete
- delete list entry.
transport_error()
transport_error() = timeout | closed
type()
type() = term()
Identifies a type definition in the schema.
vals()
vals() = [V::value()]
vals_next()
vals_next() = {vals(), Next::term()}
value()
value() = binary() | tuple() | float() | boolean() | integer() | qtag() | {Tag::integer(), Value::term()} | [value()] | not_found | default
This type is central for this library. Values are returned from the CDB functions, they are used to read and write in the MAAPI module and they are also used as keys in ikeypath().
We have the following value representation for the data model types- string - Always represented as a single binary.
- int32 - This is represented as a single integer.
- int8 - {?C_INT8, Val}
- int16 - {?C_INT16, Val}
- int64 - {?C_INT64, Val}
- uint8 - {?C_UINT8, Val}
- uint16 - {?C_UINT16, Val}
- uint32 - {?C_UINT32, Val}
- uint64 - {?C_UINT64, Val}
- inet:ipv4-address - 4-tuple
- inet:ipv4-address-no-zone - 4-tuple
- inet:ipv6-address - 8-tuple
- inet:ipv6-address-no-zone - 8-tuple
- boolean - The atoms 'true' or 'false'
- xs:float() and xs:double() - Erlang floats
- leaf-list - An erlang list of values.
- binary, yang:hex-string, tailf:hex-list (etc) - {?C_BINARY, binary()}
- yang:date-and-time - {?C_DATETIME, datetime_date_and_time()}
- xs:duration - {?C_DURATION, {Y,M,D,H,M,S,Mcr}}
- instance-identifier - {?C_OBJECTREF, econfd:ikeypath()}
- yang:object-identifier - {?C_OID, Int32Binary}, where Int32Binary is a binary with OID compontents as 32-bit integers in the default big endianness.
- yang:dotted-quad - {?C_DQUAD, binary()}
- yang:hex-string - {?C_HEXSTR, binary()}
- inet:ipv4-prefix - {?C_IPV4PREFIX, {{A,B,C,D}, PrefixLen}}
- inet:ipv6-prefix - {?C_IPV6PREFIX, {{A,B,C,D,E,F,G,H}, PrefixLen}}
- tailf:ipv4-address-and-prefix-length - {?C_IPV4_AND_PLEN, {{A,B,C,D}, PrefixLen}}
- tailf:ipv6-address-and-prefix-length - {?C_IPV6_AND_PLEN, {{A,B,C,D,E,F,G,H}, PrefixLen}}
- decimal64 - {?C_DECIMAL64, {Int64, FractionDigits}}
- identityref - {?C_IDENTITYREF, {NsHash, IdentityHash}}
- bits - {?C_BIT32, Bits::integer()}, {?C_BIT64, Bits::integer()}, or {?C_BITBIG, Bits:binary()} depending on the highest bit position assigned
- enumeration - {?C_ENUM_VALUE, IntVal}, where IntVal is the integer value for a given "enum" statement according to the YANG specification. When we have compiled a YANG module into a .fxs file, we can use the --emit-hrl option to confdc(1) to create a .hrl file with macro definitions for the enum values.
- empty - {?C_EMPTY, 0}. This is applicable for type empty in union, and type empty on list keys. Type empty on a leaf without a union is not represented by a value, only existence checks can be done.
There is also a "pseudo type" that indicates a non-existing value, which is represented as the atom 'not_found'. Finally there is a "pseudo type" to indicate that a leaf with a default value defined in the data model does not have a value set - this is represented as the atom 'default'.
For all of the abovementioned (non-"pseudo") types we have the corresponding macro in econfd.hrl. We strongly suggest that the ?CONFD_xxx macros are used whenever we either want to construct a value or match towards a value: Thus we write code as:case econfd_cdb:get_elem(...) of {ok, ?CONFD_INT64(42)} -> foo; or econfd_cdb:set_elem(... ?CONFD_INT64(777), ...) or {ok, ?CONFD_INT64(I)} = econfd_cdb:get_elem(...)
Function Index
action_set_timeout/2 | Extend (or shorten) the timeout for the current action callback invocation. |
bitbig_bit_is_set/2 | Test a bit in a C_BITBIG binary. |
bitbig_clr_bit/2 | Clear a bit in a C_BITBIG binary. |
bitbig_set_bit/2 | Set a bit in a C_BITBIG binary. |
controlling_process/2 | Assigns a new controlling process Pid to Socket. |
data_get_list_filter/1 | Return list filter for the current operation if any. |
data_reply_error/2 | Reply an error for delayed_response. |
data_reply_found/1 | Reply 'found' for delayed_response. |
data_reply_next_key/3 | Reply with next key for delayed_response. |
data_reply_next_object_tag_value_array/3 | Reply with tagged values and next key for delayed_response. |
data_reply_next_object_value_array/3 | Reply with values and next key for delayed_response. |
data_reply_next_object_value_arrays/3 | Reply with multiple objects, each with values and next key, plus cache timeout, for delayed_response. |
data_reply_not_found/1 | Reply 'not found' for delayed_response. |
data_reply_ok/1 | Reply 'ok' for delayed_response. |
data_reply_tag_value_array/2 | Reply a list of tagged values for delayed_response. |
data_reply_value/2 | Reply a value for delayed_response. |
data_reply_value_array/2 | Reply a list of values for delayed_response. |
data_set_filtered/2 | Set filtered flag on transaction context in the first callback call of a list traversal. |
data_set_timeout/2 | Extend (or shorten) the timeout for the current callback invocation. |
decrypt/1 | Decrypts a value of type tailf:des3-cbc-encrypted-string or tailf:aes-cfb-128-encrypted-string. |
init_daemon/5 | Starts and links to a gen_server which connects to ConfD. |
init_daemon/6 | |
log/2 | Logs Fmt to devel.log if running internal, otherwise to standard out. |
log/3 | Logs Fmt with Args to devel.log if running internal, otherwise to standard out. |
log/4 | Logs Fmt with Args to devel.log if running internal, otherwise to IoDevice. |
new_worker_socket/2 | Create a new worker socket to be used for an action invocation. |
notification_replay_complete/1 | Call this function when replay is done. |
notification_replay_failed/2 | Call this function when replay has failed for some reason. |
notification_send/3 | Send a notification defined at the top level of a YANG module. |
notification_send/4 | Send a notification defined as a child of a container or list in a YANG 1.1 module. |
pp_kpath/1 | Pretty print an ikeypath. |
pp_value/1 | Pretty print a value. |
register_action_cb/2 | Register action callback on an actionpoint. |
register_authentication_cb/2 | Register authentication callback. |
register_data_cb/2 | Register the data callbacks. |
register_data_cb/3 | Register the data callbacks. |
register_db_cbs/2 | Register extern db callbacks. |
register_done/1 | This function must be called when all callback registrations are done. |
register_notification_stream/2 | Register notif callbacks on an streamname. |
register_range_data_cb/5 | Register data callbacks for a range of keys. |
register_trans_cb/2 | Register transaction phase callbacks. |
register_trans_validate_cb/2 | Register validation transaction callback. |
register_valpoint_cb/2 | Register validation callback on a valpoint. |
set_daemon_d_opaque/2 | Set the d_opaque field in the daemon which is typically used by the callbacks. |
set_daemon_flags/2 | Change the flag settings for a daemon. |
set_debug/3 | Change the DebugLevel and/or Estream for a running daemon. |
start/0 | Starts the econfd application. |
stop_daemon/1 | Silently stop a daemon. |
Function Details
action_set_timeout/2
action_set_timeout(Uinfo::#confd_user_info{}, Seconds::integer()) -> ok | {error, Reason::term()}
Extend (or shorten) the timeout for the current action callback invocation. The timeout is given in seconds from the point in time when the function is called.
bitbig_bit_is_set/2
bitbig_bit_is_set(Binary::binary(), Position::integer()) -> boolean()
Test a bit in a C_BITBIG binary.
bitbig_clr_bit/2
bitbig_clr_bit(Binary::binary(), Position::integer()) -> binary()
Clear a bit in a C_BITBIG binary.
bitbig_set_bit/2
bitbig_set_bit(Binary::binary(), Position::integer()) -> binary()
Set a bit in a C_BITBIG binary.
controlling_process/2
controlling_process(Socket::term(), Pid::pid()) -> ok | {error, Reason::term()}
Assigns a new controlling process Pid to Socket
data_get_list_filter/1
data_get_list_filter(Tctx::confd_trans_ctx()) -> undefined | #confd_list_filter{type = econfd:list_filter_type(), expr1 = undefined | #confd_list_filter{type = econfd:list_filter_type(), expr1 = undefined | #confd_list_filter{}, expr2 = undefined | #confd_list_filter{}, op = undefined | econfd:list_filter_op(), node = undefined | econfd:ikeypath(), val = undefined | econfd:value()}, expr2 = undefined | #confd_list_filter{type = econfd:list_filter_type(), expr1 = undefined | #confd_list_filter{}, expr2 = undefined | #confd_list_filter{}, op = undefined | econfd:list_filter_op(), node = undefined | econfd:ikeypath(), val = undefined | econfd:value()}, op = undefined | econfd:list_filter_op(), node = undefined | econfd:ikeypath(), val = undefined | econfd:value()}
Return list filter for the current operation if any.
data_reply_error/2
data_reply_error(Tctx::confd_trans_ctx(), Error::error_reason()) -> ok | {error, Reason::term()}
Reply an error for delayed_response. Like data_reply_value() - only used in combination with delayed_response.
data_reply_found/1
data_reply_found(Tctx::confd_trans_ctx()) -> ok | {error, Reason::term()}
Reply 'found' for delayed_response. Like data_reply_value() - only used in combination with delayed_response.
data_reply_next_key/3
data_reply_next_key(Tctx::confd_trans_ctx(), Key::key() | false, Next::term()) -> ok | {error, Reason::term()}
Reply with next key for delayed_response. Like data_reply_value() - only used in combination with delayed_response.
data_reply_next_object_tag_value_array/3
data_reply_next_object_tag_value_array(Tctx::confd_trans_ctx(), Values::[TV::tagval()], Next::term()) -> ok | {error, Reason::term()}
Reply with tagged values and next key for delayed_response. Like data_reply_value() - only used in combination with delayed_response, and get_next_object() callback.
data_reply_next_object_value_array/3
data_reply_next_object_value_array(Tctx::confd_trans_ctx(), Values::vals() | tag_val_object() | false, Next::term()) -> ok | {error, Reason::term()}
Reply with values and next key for delayed_response. Like data_reply_value() - only used in combination with delayed_response, and get_next_object() callback.
data_reply_next_object_value_arrays/3
data_reply_next_object_value_arrays(Tctx::confd_trans_ctx(), Objects::objects(), TimeoutMillisecs::integer()) -> ok | {error, Reason::term()}
Reply with multiple objects, each with values and next key, plus cache timeout, for delayed_response. Like data_reply_value() - only used in combination with delayed_response, and get_next_object() callback.
data_reply_not_found/1
data_reply_not_found(Tctx::confd_trans_ctx()) -> ok | {error, Reason::term()}
Reply 'not found' for delayed_response. Like data_reply_value() - only used in combination with delayed_response.
data_reply_ok/1
data_reply_ok(Tctx::confd_trans_ctx()) -> ok | {error, Reason::term()}
Reply 'ok' for delayed_response. This function can be used explicitly by the erlang application if a data callback returns the atom delayed_response. In that case it is the responsibility of the application to later invoke one of the data_reply_xxx() functions. If delayed_response is not used, none of the explicit data replying functions need to be used.
data_reply_tag_value_array/2
data_reply_tag_value_array(Tctx::confd_trans_ctx(), TagVals::[tagval()]) -> ok | {error, Reason::term()}
Reply a list of tagged values for delayed_response. Like data_reply_value() - only used in combination with delayed_response, and get_object() callback.
data_reply_value/2
data_reply_value(Tctx::confd_trans_ctx(), V::value()) -> ok | {error, Reason::term()}
Reply a value for delayed_response. This function can be used explicitly by the erlang application if a data callback returns the atom delayed_response. In that case it is the responsibility of the application to later invoke one of the data_reply_xxx() functions. If delayed_response is not used, none of the explicit data replying functions need to be used.
data_reply_value_array/2
data_reply_value_array(Tctx::confd_trans_ctx(), Values::vals() | tag_val_object() | false) -> ok | {error, Reason::term()}
Reply a list of values for delayed_response. Like data_reply_value() - only used in combination with delayed_response, and get_object() callback.
data_set_filtered/2
data_set_filtered(Tctx::confd_trans_ctx(), IsFiltered::boolean()) -> confd_trans_ctx()
Set filtered flag on transaction context in the first callback call of a list traversal. This signals that all list entries returned by the data provider for this list traversal match the filter.
data_set_timeout/2
data_set_timeout(Tctx::confd_trans_ctx(), Seconds::integer()) -> ok | {error, Reason::term()}
Extend (or shorten) the timeout for the current callback invocation. The timeout is given in seconds from the point in time when the function is called.
decrypt/1
decrypt(X1::binary()) -> {ok, binary()} | {error, {Ecode::integer(), Reason::binary()}}
Decrypts a value of type tailf:des3-cbc-encrypted-string or tailf:aes-cfb-128-encrypted-string. Requires that econfd_maapi:install_crypto_keys/1 has been called in the node.
init_daemon/5
init_daemon(Name::atom(), DebugLevel::integer(), Estream::io:device(), Dopaque::term(), Path::string()) -> {ok, Pid::pid()} | {error, Reason::term()}
Starts and links to a gen_server which connects to ConfD. This gen_server holds two sockets to ConfD, one so called control socket and one worker socket (See confd_lib_dp(3) for an explanation of those sockets.)
To avoid blocking control socket callback requests due to long-running worker socket callbacks, the control socket callbacks are run in the gen_server, while the worker socket callbacks are run in a separate process that is spawned by the gen_server. This means that applications must not share e.g. MAAPI sockets between transactions, since this could result in simultaneous use of a socket by the gen_server and the spawned process.
The gen_server is used to install sets of callback Funs. The gen_server state is a #confd_daemon_ctx{}. This structure is passed to all the callback functions.
The daemon context includes a d_opaque element holding the Dopaque term - this can be used by the application to pass application specific data into the callback functions.
The Name::atom() parameter is used in various debug printouts and is also used to uniquely identify the daemon.
The DebugLevel parameter is used to control the debug level. The following levels are available:
- ?CONFD_SILENT No debug printouts whatsoever are produced by the library.
- ?CONFD_DEBUG Various printouts will occur for various error conditions.
- ?CONFD_TRACE The execution of callback functions will be traced.
init_daemon/6
init_daemon(Name::atom(), DebugLevel::integer(), Estream::io:device(), Dopaque::term(), Ip::ip(), Port::integer()) -> {ok, Pid::pid()} | {error, Reason::term()}
log/2
log(Level::integer(), Fmt::string()) -> ok
Logs Fmt to devel.log if running internal, otherwise to standard out. Level can be one of ?CONFD_LEVEL_ERROR | ?CONFD_LEVEL_INFO | ?CONFD_LEVEL_TRACE
log/3
log(Level::integer(), Fmt::string(), Args::list()) -> ok
Logs Fmt with Args to devel.log if running internal, otherwise to standard out. Level can be one of ?CONFD_LEVEL_ERROR | ?CONFD_LEVEL_INFO | ?CONFD_LEVEL_TRACE
log/4
log(IoDevice::io:device(), Level::integer(), Fmt::string(), Args::list()) -> ok
Logs Fmt with Args to devel.log if running internal, otherwise to IoDevice. Level can be one of ?CONFD_LEVEL_ERROR | ?CONFD_LEVEL_INFO | ?CONFD_LEVEL_TRACE
new_worker_socket/2
new_worker_socket(UserInfo::#confd_user_info{}, SockId::integer()) -> {socket(), #confd_user_info{}} | {error, timeout | closed | not_owner | badarg | inet:posix() | any()}
Create a new worker socket to be used for an action invocation. When the action invocation ends remove_worker_socket/1 should be called.
notification_replay_complete/1
notification_replay_complete(Nctx::#confd_notification_ctx{}) -> ok | {error, Reason::term()}
Call this function when replay is done
notification_replay_failed/2
notification_replay_failed(Nctx::#confd_notification_ctx{}, ErrorString::binary()) -> ok | {error, Reason::term()}
Call this function when replay has failed for some reason
notification_send/3
notification_send(Nctx::#confd_notification_ctx{}, DateTime::datetime(), TagVals::[tagval()]) -> ok | {error, Reason::term()}
Send a notification defined at the top level of a YANG module.
notification_send/4
notification_send(Nctx::#confd_notification_ctx{}, DateTime::datetime(), TagVals::[tagval()], IKP::ikeypath()) -> ok | {error, Reason::term()}
Send a notification defined as a child of a container or list in a YANG 1.1 module. IKP is the fully instantiated path for the parent of the notification in the data tree.
pp_kpath/1
pp_kpath(IKP::ikeypath()) -> iolist()
Pretty print an ikeypath.
pp_value/1
pp_value(V::value()) -> iolist()
Pretty print a value.
register_action_cb/2
register_action_cb(Daemon::pid(), ActionCbs::#confd_action_cb{}) -> ok | {error, Reason::term()}
Register action callback on an actionpoint
register_authentication_cb/2
register_authentication_cb(Daemon::pid(), AuthenticationCb::#confd_authentication_cb{}) -> ok | {error, Reason::term()}
Register authentication callback. Note, this can not be used to *perform* the authentication.
register_data_cb/2
register_data_cb(Daemon::pid(), DbCbs::#confd_data_cbs{callpoint = any(), exists_optional = any(), get_elem = any(), get_next = any(), set_elem = any(), create = any(), remove = any(), find_next = any(), num_instances = any(), get_object = any(), get_next_object = any(), find_next_object = any(), get_case = undefined | econfd:cb_get_case(), set_case = undefined | econfd:cb_set_case(), get_attrs = any(), set_attr = any(), move_after = any(), write_all = any(), index = any()}) -> ok | {error, Reason::term()}
Register the data callbacks.
register_data_cb/3
register_data_cb(Daemon::pid(), DbCbs::#confd_data_cbs{callpoint = any(), exists_optional = any(), get_elem = any(), get_next = any(), set_elem = any(), create = any(), remove = any(), find_next = any(), num_instances = any(), get_object = any(), get_next_object = any(), find_next_object = any(), get_case = undefined | econfd:cb_get_case(), set_case = undefined | econfd:cb_set_case(), get_attrs = any(), set_attr = any(), move_after = any(), write_all = any(), index = any()}, Flags::non_neg_integer()) -> ok | {error, Reason::term()}
Register the data callbacks.
register_db_cbs/2
register_db_cbs(Daemon::pid(), DbCbs::#confd_db_cbs{}) -> ok | {error, Reason::term()}
Register extern db callbacks.
register_done/1
register_done(Daemon::pid()) -> ok | {error, Reason::term()}
This function must be called when all callback registrations are done.
register_notification_stream/2
register_notification_stream(Daemon::pid(), NotifCbs::#confd_notification_stream_cbs{}) -> {ok, #confd_notification_ctx{}} | {error, Reason::term()}
Register notif callbacks on an streamname
register_range_data_cb/5
register_range_data_cb(Daemon::pid(), DataCbs::#confd_data_cbs{callpoint = any(), exists_optional = any(), get_elem = any(), get_next = any(), set_elem = any(), create = any(), remove = any(), find_next = any(), num_instances = any(), get_object = any(), get_next_object = any(), find_next_object = any(), get_case = undefined | econfd:cb_get_case(), set_case = undefined | econfd:cb_set_case(), get_attrs = any(), set_attr = any(), move_after = any(), write_all = any(), index = any()}, Lower::[Lower::value()], Higher::[Higher::value()], IKP::ikeypath()) -> ok | {error, Reason::term()}
Register data callbacks for a range of keys.
register_trans_cb/2
register_trans_cb(Daemon::pid(), TransCbs::#confd_trans_cbs{}) -> ok | {error, Reason::term()}
Register transaction phase callbacks. See confd_lib_dp(3) for a thorough description of the transaction phases. The record #confd_trans_cbs{} contains callbacks for all of the phases for a transaction. If we use this external data api only for statistics data only the init() and the finish() callbacks should be used. The init() callback must return 'ok', {error, String}, or {ok, Tctx} where Tctx is the same #confd_trans_ctx that was supplied to the init callback but possibly with the opaque field filled in. This field is meant to be used by the user to manage user data.
register_trans_validate_cb/2
register_trans_validate_cb(Daemon::pid(), ValidateCbs::#confd_trans_validate_cbs{}) -> ok | {error, Reason::term()}
Register validation transaction callback. This function maps an init and a finish function for validations. See seme function in confd_lib_dp(3) The init() callback must return 'ok', {error, String}, or {ok, Tctx} where Tctx is the same #confd_trans_ctx that was supplied to the init callback but possibly with the opaque field filled in.
register_valpoint_cb/2
register_valpoint_cb(Daemon::pid(), ValpointCbs::#confd_valpoint_cb{}) -> ok | {error, Reason::term()}
Register validation callback on a valpoint
set_daemon_d_opaque/2
set_daemon_d_opaque(Daemon::pid(), Dopaque::term()) -> ok
Set the d_opaque field in the daemon which is typically used by the callbacks
set_daemon_flags/2
set_daemon_flags(Daemon, Flags) -> ok
Daemon = pid()
Flags = non_neg_integer()
Change the flag settings for a daemon. See ?CONFD_DAEMON_FLAG_XXX in econfd.hrl for the available flags. This function should be called immediately after creating the daemon context with init_daemon/6.
set_debug/3
set_debug(Daemon::pid(), DebugLevel::integer(), Estream::io:device()) -> ok
Change the DebugLevel and/or Estream for a running daemon
start/0
start() -> ok | {error, Reason::term()}
Starts the econfd application.
stop_daemon/1
stop_daemon(Daemon::pid()) -> ok
Silently stop a daemon
Generated by EDoc