Module econfd_maapi

An Erlang interface equivalent to the MAAPI C-API.

Version: 6.5.4

Description

An Erlang interface equivalent to the MAAPI C-API

This modules implements the Management Agent API. All functions in this module have an equivalent function in the C library. The actual semantics of each of the API functions described here is better described in the man page confd_lib_maapi(3).

Data Types

confd_user_identification()

confd_user_identification() = #confd_user_identification{vendor = undefined | string(), product = undefined | string(), version = undefined | string(), client_identity = undefined | string()}

confd_user_info()

confd_user_info() = #confd_user_info{}

dbname()

dbname() = 0 | 1 | 2 | 3 | 4 | 6 | 7

The DB name can be either

  • 0 = CONFD_NO_DB
  • 1 = CONFD_CANDIDATE
  • 2 = CONFD_RUNNING
  • 3 = CONFD_STARTUP
  • 4 = CONFD_OPERATIONAL
  • 6 = CONFD_PRE_COMMIT_RUNNING
  • 7 = CONFD_INTENDED
Check maapi_start_trans() in confd_lib_maapi(3) for detailed information.

err()

err() = {error, {integer(), binary()}} | {error, closed}

Errors can be either

  • {error, Ecode::integer(), Reason::binary()} where Ecode is one of the error codes defined in econfd_errors.hrl, and Reason is (possibly empty) textual description
  • {error, closed} if the socket gets closed

find_next_type()

find_next_type() = 0 | 1

The type is used in find_next/3 can be either

  • 0 = CONFD_FIND_NEXT
  • 1 = CONFD_FIND_SAME_OR_NEXT
Check maapi_find_next() in confd_lib_maapi(3) for detailed information.

maapi_cursor()

maapi_cursor() = #maapi_cursor{}

proto()

proto() = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

The protocol to start user session can be either

  • 0 = CONFD_PROTO_UNKNOWN
  • 1 = CONFD_PROTO_TCP
  • 2 = CONFD_PROTO_SSH
  • 3 = CONFD_PROTO_SYSTEM
  • 4 = CONFD_PROTO_CONSOLE
  • 5 = CONFD_PROTO_SSL
  • 6 = CONFD_PROTO_HTTP
  • 7 = CONFD_PROTO_HTTPS
  • 8 = CONFD_PROTO_UDP
  • 9 = CONFD_PROTO_TLS

verbosity()

verbosity() = 0 | 1 | 2 | 3

The type is used in start_span_th/7 and can be either

  • 0 = CONFD_PROGRESS_NORMAL
  • 1 = CONFD_PROGRESS_VERBOSE
  • 2 = CONFD_PROGRESS_VERY_VERBOSE
  • 3 = CONFD_PROGRESS_DEBUG
Check maapi_start_span_th() in confd_lib_maapi(3) for detailed information.

xpath_eval_option()

xpath_eval_option() = {tracefun, term()} | {context, econfd:ikeypath()} | {varbindings, [{Name::string(), ValueExpr::string() | binary()}]} | {root, econfd:ikeypath()}

Function Index

aaa_reload/2Tell AAA to reload external AAA data.
abort_trans/2Abort transaction.
abort_upgrade/1Abort in-service upgrade.
all_keys/3Utility function.
apply_trans/3Equivalent to apply_trans(Socket, Tid, KeepOpen, 0).
apply_trans/4Apply all in the transaction.
attach/3Attach to a running transaction.
attach2/4Attach to a running transaction.
attach_init/1Attach to the CDB init/upgrade transaction in phase0.
authenticate/4Autenticate a user using ConfD AAA.
authenticate2/8Autenticate a user using ConfD AAA.
candidate_abort_commit/1Equivalent to candidate_abort_commit(Socket, <<>>).
candidate_abort_commit/2Cancel persistent confirmed commit.
candidate_commit/1Copies candidate to running or confirms a confirmed commit.
candidate_commit/2Confirms persistent confirmed commit.
candidate_commit_info/3Like candidate_commit/1, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.
candidate_commit_info/4Combines candidate_commit/2 and candidate_commit_info/3 - set "Label" and/or "Comment" when confirming a persistent confirmed commit.
candidate_confirmed_commit/2Copy candidate into running, but rollback if not confirmed by a call of candidate_commit/1.
candidate_confirmed_commit/4Starts or extends persistent confirmed commit.
candidate_confirmed_commit_info/4Like candidate_confirmed_commit/2, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.
candidate_confirmed_commit_info/6Combines candidate_confirmed_commit/4 and candidate_confirmed_commit_info/4 - set "Label" and/or "Comment" when starting or extending a persistent confirmed commit.
candidate_reset/1Copy running into candidate.
candidate_validate/1Validate the candidate config.
cli_prompt/4Prompt CLI user for a reply.
cli_prompt/5Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.
cli_prompt_oneof/4Prompt CLI user for a reply.
cli_prompt_oneof/5Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.
cli_read_eof/3Read data from CLI until EOF.
cli_read_eof/4Read data from CLI until EOF - return error if no reply is received within Timeout seconds.
cli_write/3Write mesage to the CLI.
close/1Close socket.
commit_trans/2Commit a transaction.
commit_upgrade/1Commit in-service upgrade.
confirmed_commit_in_progress/1Is a confirmed commit in progress.
connect/1Connect a maapi socket to ConfD.
connect/2Connect a maapi socket to ConfD.
copy/3Copy data from one transaction to another.
copy_running_to_startup/1Copy running to startup.
copy_tree/4Copy an entire subtree in the configuration from one point to another.
create/3Create a new element.
delete/3 Delete an element.
delete_config/2Delete all data from a data store.
detach/2Detach from the transaction.
diff_iterate/4Equivalent to diff_iterate(Sock, Tid, Fun, 0, InitState).
diff_iterate/5Iterate through a diff.
end_progress_span/3
end_user_session/1Ends a user session.
exists/3 Check if an element exists.
find_next/3find the list entry matching Type and Key.
finish_trans/2Finish a transaction.
get_attrs/4Get the selected attributes for an element.
get_authorization_info/2Get authorization info for a user session.
get_case/4Get the current case for a choice.
get_elem/3Read an element.
get_elem_no_defaults/3(Deprecated.) Read an element, but return 'default' instead of the value if the default value is in effect.
get_my_user_session_id/1Get my user session id.
get_next/1iterate through the entries of a list.
get_object/3Read all the values in a container or list entry.
get_objects/2Read all the values for NumEntries list entries, starting at the point given by the cursor C.
get_rollback_id/2Get rollback id of commited transaction.
get_running_db_status/1Get the "running status".
get_user_session/2Get session info for a user session.
get_user_sessions/1Get all user sessions.
get_values/4Read the values for the leafs that have the "value" 'not_found' in the Values list.
hide_group/3Do hide a hide group.
hkeypath2ikeypath/2(Deprecated.) Convert a hkeypath to an ikeypath.
init_cursor/3Equivalent to init_cursor(Socket, Tik, IKeypath, undefined).
init_cursor/4Initalize a get_next() cursor.
init_upgrade/3Start in-service upgrade.
insert/3Insert an entry in an integer-keyed list.
install_crypto_keys/1Fetch keys for the encrypted data types from the server.
is_candidate_modified/1Check if candidate has been modified.
is_lock_set/2Check if a db is locked or not.
is_running_modified/1Check if running has been modified since the last copy to startup was done.
iterate/6Iterate over all the data in the transaction and the underlying data store.
keypath_diff_iterate/5Iterate through a diff.
keypath_diff_iterate/6
kill_user_session/2Kill a user session.
lock/2Lock a database.
lock_partial/3Request a partial lock on a database.
move/4Move (rename) an entry in a list.
move_ordered/4Move an entry in an "ordered-by user" list.
ncs_apply_template/7Apply a template that has been loaded into NCS.
ncs_apply_trans_params/4Apply transaction with commit parameters.
ncs_get_trans_params/2Get transaction commit parameters.
ncs_template_variables/3Retrieve the variables used in a template.
ncs_templates/1Retrieve a list of the templates currently loaded into NCS.
ncs_write_service_log_entry/5Write a service log entry.
netconf_ssh_call_home/3
netconf_ssh_call_home_opaque/4
num_instances/3 Find the number of entries in a list.
perform_upgrade/2Do in-service upgrade.
prepare_trans/2Equivalent to prepare_trans(Socket, Tid, 0).
prepare_trans/3Prepare for commit.
prio_message/3Write priority message.
progress_info/6
progress_info_th/7
reload_config/1Tell ConfD daemon to reload its configuration.
request_action/3Invoke an action defined in the data model.
request_action_th/4Invoke an action defined in the data model using the provided transaction.
revert/2Remove all changes in the transaction.
set_attr/5Set the an attribute for an element.
set_comment/3Set the "Comment" that is stored in the rollback file when a transaction towards running is committed.
set_delayed_when/3Enable/disable the "delayed when" mode for a transaction.
set_elem/4Write an element.
set_elem2/4Write an element using the textual value representation.
set_flags/3Change flag settings for a transaction.
set_label/3Set the "Label" that is stored in the rollback file when a transaction towards running is committed.
set_object/4Write an entire object, i.e.
set_readonly_mode/2Control if we can create rw transactions.
set_running_db_status/2Set the "running status".
set_user_session/2Assign a user session.
set_values/4Write a list of tagged values.
shared_create/3Create a new element, and also set an attribute indicating how many times this element has been created.
shared_set_elem/4Write an element from NCS FastMap.
shared_set_elem2/4Write an element using the textual value representation from NCS fastmap.
shared_set_values/4Write a list of tagged values from NCS FastMap.
snmpa_reload/2Tell ConfD to reload external SNMP Agent config data.
start_phase/3Tell ConfD to proceed to next start phase.
start_progress_span/6
start_progress_span_th/7
start_trans/3Start a new transaction.
start_trans/4Start a new transaction within an existing user session.
start_trans/5Start a new transaction within an existing user session and/or with flags.
start_trans_in_trans/4Start a new transaction with an existing transaction as backend.
start_trans_in_trans/5Start a new transaction with an existing transaction as backend.
start_user_session/6Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto).
start_user_session/7Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto, undefined).
start_user_session/8Initiate a new maapi user session.
stop/1Tell ConfD daemon to stop, returns when daemon has exited.
stop/2Tell ConfD daemon to stop, if Synchronous is true won't return until daemon has come to a halt.
sys_message/3Write system message.
unhide_group/3Do unhide a hide group.
unlock/2Unlock a database.
unlock_partial/2Remove the partial lock identified by LockId.
user_message/4Write user message.
validate_trans/4Validate the transaction.
wait_start/1Wait until ConfD daemon has completely started.
wait_start/2Wait until ConfD daemon has reached a certain start phase.
xpath_eval/6Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.
xpath_eval/7(Deprecated.) Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.
xpath_eval_expr/4Evaluate the XPath expression Expr, returning the result as a string.
xpath_eval_expr/5Evaluate the XPath expression Expr, returning the result as a string.

Function Details

aaa_reload/2

aaa_reload(Socket, Synchronous) -> ok | err()

Tell AAA to reload external AAA data.

abort_trans/2

abort_trans(Socket, Tid) -> ok | err()

Abort transaction.

abort_upgrade/1

abort_upgrade(Socket) -> ok | err()

Abort in-service upgrade.

all_keys/3

all_keys(Socket, Tid, IKeypath) -> Result

Utility function. Return all keys in a list.

apply_trans/3

apply_trans(Socket, Tid, KeepOpen) -> ok | err()

Equivalent to apply_trans(Socket, Tid, KeepOpen, 0).

apply_trans/4

apply_trans(Socket, Tid, KeepOpen, Flags) -> ok | err()

  • Socket = econfd:socket()
  • Tid = integer()
  • KeepOpen = boolean()
  • Flags = non_neg_integer()

Apply all in the transaction.

This is the combination of validate/prepare/commit done in the right order.

attach/3

attach(Socket, Ns, Tctx) -> ok | err()

Attach to a running transaction.

Give NameSpace as 0 if it doesn't matter (-1 works too but is deprecated).

attach2/4

attach2(Socket, Ns, USid, Thandle) -> ok | err()

Attach to a running transaction. Give NameSpace as 0 if it doesn't matter (-1 works too but is deprecated).

attach_init/1

attach_init(Socket) -> Result

Attach to the CDB init/upgrade transaction in phase0.

Returns the transaction handle to use in subsequent maapi calls on success.

authenticate/4

authenticate(Socket, User, Pass, Groups) -> ok | err()

Autenticate a user using ConfD AAA.

authenticate2/8

authenticate2(Socket, User, Pass, SrcIp, SrcPort, Context, Proto, Groups) -> ok | err()

  • Socket = econfd:socket()
  • User = binary()
  • Pass = binary()
  • SrcIp = econfd:ip()
  • SrcPort = non_neg_integer()
  • Context = binary()
  • Proto = integer()
  • Groups = [binary()]

Autenticate a user using ConfD AAA.

candidate_abort_commit/1

candidate_abort_commit(Socket) -> ok | err()

Equivalent to candidate_abort_commit(Socket, <<>>).

candidate_abort_commit/2

candidate_abort_commit(Socket, PersistId) -> ok | err()

Cancel persistent confirmed commit.

candidate_commit/1

candidate_commit(Socket) -> ok | err()

Equivalent to candidate_commit_info(Socket, undefined, <<>>, <<>>).

Copies candidate to running or confirms a confirmed commit.

candidate_commit/2

candidate_commit(Socket, PersistId) -> ok | err()

Equivalent to candidate_commit_info(Socket, PersistId, <<>>, <<>>).

Confirms persistent confirmed commit.

candidate_commit_info/3

candidate_commit_info(Socket, Label, Comment) -> ok | err()

Equivalent to candidate_commit_info(Socket, undefined, Label, Comment).

Like candidate_commit/1, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.

To set only the "Label", give Comment as an empty binary, and to set only the "Comment", give Label as an empty binary.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using candidate_confirmed_commit_info/4) and with the confirming commit (using this function).

candidate_commit_info/4

candidate_commit_info(Socket, PersistId, Label, Comment) -> ok | err()

  • Socket = econfd:socket()
  • PersistId = binary() | undefined
  • Label = binary()
  • Comment = binary()

Combines candidate_commit/2 and candidate_commit_info/3 - set "Label" and/or "Comment" when confirming a persistent confirmed commit.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using candidate_confirmed_commit_info/6) and with the confirming commit (using this function).

candidate_confirmed_commit/2

candidate_confirmed_commit(Socket, TimeoutSecs) -> ok | err()

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, undefined, undefined, <<>>, <<>>).

Copy candidate into running, but rollback if not confirmed by a call of candidate_commit/1.

candidate_confirmed_commit/4

candidate_confirmed_commit(Socket, TimeoutSecs, Persist, PersistId) -> ok | err()

  • Socket = econfd:socket()
  • TimeoutSecs = integer()
  • Persist = binary() | undefined
  • PersistId = binary() | undefined

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, Persist, PersistId, <<>>, <<>>).

Starts or extends persistent confirmed commit.

candidate_confirmed_commit_info/4

candidate_confirmed_commit_info(Socket, TimeoutSecs, Label, Comment) -> ok | err()

  • Socket = econfd:socket()
  • TimeoutSecs = integer()
  • Label = binary()
  • Comment = binary()

Equivalent to candidate_confirmed_commit_info(Socket, TimeoutSecs, undefined, undefined, Label, Comment).

Like candidate_confirmed_commit/2, but set the "Label" and/or "Comment" that is stored in the rollback file when the candidate is committed to running.

To set only the "Label", give Comment as an empty binary, and to set only the "Comment", give Label as an empty binary.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using this function) and with the confirming commit (using candidate_commit_info/3).

candidate_confirmed_commit_info/6

candidate_confirmed_commit_info(Socket, TimeoutSecs, Persist, PersistId, Label, Comment) -> ok | err()

  • Socket = econfd:socket()
  • TimeoutSecs = integer()
  • Persist = binary() | undefined
  • PersistId = binary() | undefined
  • Label = binary()
  • Comment = binary()

Combines candidate_confirmed_commit/4 and candidate_confirmed_commit_info/4 - set "Label" and/or "Comment" when starting or extending a persistent confirmed commit.

Note: To ensure that the "Label" and/or "Comment" are stored in the rollback file in all cases when doing a confirmed commit, they must be given both with the confirmed commit (using this function) and with the confirming commit (using candidate_commit_info/4).

candidate_reset/1

candidate_reset(Socket) -> ok | err()

Copy running into candidate.

candidate_validate/1

candidate_validate(Socket) -> ok | err()

Validate the candidate config.

cli_prompt/4

cli_prompt(Socket, USid, Prompt, Echo) -> {ok, binary()} | err()

Prompt CLI user for a reply.

cli_prompt/5

cli_prompt(Socket, USid, Prompt, Echo, Timeout) -> {ok, binary()} | err()

  • Socket = econfd:socket()
  • USid = integer()
  • Prompt = binary()
  • Echo = boolean()
  • Timeout = non_neg_integer()

Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.

cli_prompt_oneof/4

cli_prompt_oneof(Socket, USid, Prompt, Choice) -> {ok, binary()} | err()

Prompt CLI user for a reply.

cli_prompt_oneof/5

cli_prompt_oneof(Socket, USid, Prompt, Choice, Timeout) -> {ok, binary()} | err()

  • Socket = econfd:socket()
  • USid = integer()
  • Prompt = binary()
  • Choice = binary()
  • Timeout = non_neg_integer()

Prompt CLI user for a reply - return error if no reply is received within Timeout seconds.

cli_read_eof/3

cli_read_eof(Socket, USid, Echo) -> {ok, binary()} | err()

Read data from CLI until EOF.

cli_read_eof/4

cli_read_eof(Socket, USid, Echo, Timeout) -> {ok, binary()} | err()

  • Socket = econfd:socket()
  • USid = integer()
  • Echo = boolean()
  • Timeout = non_neg_integer()

Read data from CLI until EOF - return error if no reply is received within Timeout seconds.

cli_write/3

cli_write(Socket, USid, Message) -> ok | err()

Write mesage to the CLI.

close/1

close(Socket) -> Result

Close socket.

commit_trans/2

commit_trans(Socket, Tid) -> ok | err()

Commit a transaction.

commit_upgrade/1

commit_upgrade(Socket) -> ok | err()

Commit in-service upgrade.

confirmed_commit_in_progress/1

confirmed_commit_in_progress(Socket) -> Result

Is a confirmed commit in progress.

connect/1

connect(Path) -> econfd:connect_result()

  • Path = string()

Connect a maapi socket to ConfD.

connect/2

connect(Address, Port) -> econfd:connect_result()

Connect a maapi socket to ConfD.

copy/3

copy(Socket, FromTH, ToTH) -> ok | err()

Copy data from one transaction to another.

copy_running_to_startup/1

copy_running_to_startup(Socket) -> ok | err()

Copy running to startup.

copy_tree/4

copy_tree(Socket, Tid, FromIKeypath, ToIKeypath) -> ok | err()

Copy an entire subtree in the configuration from one point to another.

create/3

create(Socket, Tid, IKeypath) -> ok | err()

Create a new element.

delete/3

delete(Socket, Tid, IKeypath) -> ok | err()

Delete an element.

delete_config/2

delete_config(Socket, DbName) -> ok | err()

Delete all data from a data store.

detach/2

detach(Socket, Thandle) -> ok | err()

Detach from the transaction.

diff_iterate/4

diff_iterate(Sock, Tid, Fun, InitState) -> any()

Equivalent to diff_iterate(Sock, Tid, Fun, 0, InitState).

diff_iterate/5

diff_iterate(Socket, Tid, Fun, Flags, State) -> Result

Iterate through a diff.

This function is used in combination with the notifications API where we get a chance to iterate through the diff of a transaction just before it gets commited. The transaction hangs until we have called econfd_notif:notification_done/2. The function can also be called from within validate() callbacks to traverse a diff while validating. Currently OldValue is always the atom 'undefined'. When Op == ?MOP_MOVED_AFTER (only for "ordered-by user" list entry), Value == {} means that the entry was moved first in the list, otherwise Value is a econfd:key() tuple that identifies the entry it was moved after.

end_progress_span/3

end_progress_span(Socket, SpanId1, Annotation) -> Result

  • Socket = econfd:socket()
  • SpanId1 = binary()
  • Annotation = iolist()
  • Result = {ok, {SpanId2::binary() | undefined, TraceId::binary() | undefined}}

end_user_session/1

end_user_session(Socket) -> ok | err()

Ends a user session.

exists/3

exists(Socket, Tid, IKeypath) -> Result

Check if an element exists.

find_next/3

find_next(Cursor, Type, Key) -> Result

find the list entry matching Type and Key.

finish_trans/2

finish_trans(Socket, Tid) -> ok | err()

Finish a transaction.

get_attrs/4

get_attrs(Socket, Tid, IKeypath, AttrList) -> Result

Get the selected attributes for an element.

Calling with an empty attribute list returns all attributes.

get_authorization_info/2

get_authorization_info(Socket, USid) -> Result

Get authorization info for a user session.

get_case/4

get_case(Socket, Tid, IKeypath, Choice) -> Result

Get the current case for a choice.

get_elem/3

get_elem(Socket, Tid, IKeypath) -> Result

Read an element.

get_elem_no_defaults/3

get_elem_no_defaults(Socket, Tid, IKeypath) -> Result

This function is deprecated: Use set_flags/3 with ?MAAPI_FLAG_NO_DEFAULTS instead - this will take effect for all the functions that read values.

Read an element, but return 'default' instead of the value if the default value is in effect.

get_my_user_session_id/1

get_my_user_session_id(Socket) -> Result

Get my user session id.

get_next/1

get_next(Cursor) -> Result

iterate through the entries of a list.

get_object/3

get_object(Socket, Tid, IKeypath) -> Result

Read all the values in a container or list entry.

get_objects/2

get_objects(Cursor, NumEntries) -> Result

Read all the values for NumEntries list entries, starting at the point given by the cursor C.

The return value has one Erlang list for each YANG list entry, i.e. it is a list of at most NumEntries lists. If we reached the end of the YANG list, {done, Values} is returned, and there will be fewer than NumEntries lists in Values - otherwise {ok, C2, Values} is returned, where C2 can be used to continue the traversal.

get_rollback_id/2

get_rollback_id(Socket, Tid) -> non_neg_integer() | -1

Get rollback id of commited transaction.

get_running_db_status/1

get_running_db_status(Socket) -> Result

Get the "running status".

get_user_session/2

get_user_session(Socket, USid) -> Result

Get session info for a user session.

get_user_sessions/1

get_user_sessions(Socket) -> Result

Get all user sessions.

get_values/4

get_values(Socket, Tid, IKeypath, Values) -> Result

Read the values for the leafs that have the "value" 'not_found' in the Values list.

This can be used to read an arbitrary set of sub-elements of a container or list entry. The return value is a list of the same length as Values, i.e. the requested leafs are in the same position in the returned list as in the Values argument. The elements in the returned list are always "canonical" though, i.e. of the form econfd:tagval().

hide_group/3

hide_group(Socket, Tid, GroupName) -> ok | err()

Do hide a hide group.

Hide all nodes belonging to a hide group in a transaction that started with flag FLAG_HIDE_ALL_HIDEGROUPS.

hkeypath2ikeypath/2

hkeypath2ikeypath(Socket, HKeypath) -> Result

This function is deprecated: hkeypaths are not used in the erlang API.

Convert a hkeypath to an ikeypath.

init_cursor/3

init_cursor(Socket, Tid, IKeypath) -> maapi_cursor()

Equivalent to init_cursor(Socket, Tik, IKeypath, undefined).

init_cursor/4

init_cursor(Socket, Tid, IKeypath, XPath) -> maapi_cursor()

Initalize a get_next() cursor.

init_upgrade/3

init_upgrade(Socket, TimeoutSecs, Flags) -> ok | err()

Start in-service upgrade.

insert/3

insert(Socket, Tid, IKeypath) -> ok | err()

Insert an entry in an integer-keyed list.

install_crypto_keys/1

install_crypto_keys(Socket) -> ok | err()

Fetch keys for the encrypted data types from the server.

Encrypted data type can be tailf:aes-cfb-128-encrypted-string and tailf:aes-256-cfb-128-encrypted-string.

is_candidate_modified/1

is_candidate_modified(Socket) -> Result

Check if candidate has been modified.

is_lock_set/2

is_lock_set(Socket, DbName) -> Result

Check if a db is locked or not.

Return 0 or the Usid of the lock owner.

is_running_modified/1

is_running_modified(Socket) -> Result

Check if running has been modified since the last copy to startup was done.

iterate/6

iterate(Socket, Tid, IKeypath, Fun, Flags, State) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • IKeypath = econfd:ikeypath()
  • Fun = fun((IKeypath, Value, Attrs, State) -> {ok, Ret, State} | {error, term()})
  • Value = econfd:value() | undefined
  • Attrs = [{Attr, Value}] | undefined
  • Attr = integer()
  • State = term()
  • Ret = integer()
  • Flags = non_neg_integer()
  • Result = {ok, State} | {error, term()}

Iterate over all the data in the transaction and the underlying data store.

Flags can be given as ?MAAPI_ITER_WANT_ATTR to request that attributes (if any) are passed to the Fun, otherwise it should be 0. The possible values for Ret in the return value for Fun are the same as for diff_iterate/5.

keypath_diff_iterate/5

keypath_diff_iterate(Socket, Tid, IKeypath, Fun, State) -> Result

Iterate through a diff.

This function behaves like diff_iterate/5 with the exception that the provided keypath IKP, prunes the tree and only diffs below that path are considered.

keypath_diff_iterate/6

keypath_diff_iterate(Sock, Tid, IKP, Fun, Flags, InitState) -> any()

kill_user_session/2

kill_user_session(Socket, USid) -> ok | err()

Kill a user session.

lock/2

lock(Socket, DbName) -> ok | err()

Lock a database.

lock_partial/3

lock_partial(Socket, DbName, XPath) -> Result

Request a partial lock on a database.

The set of nodes to lock is specified as a list of XPath expressions.

move/4

move(Socket, Tid, IKeypath, ToKey) -> ok | err()

Move (rename) an entry in a list.

move_ordered/4

move_ordered(Socket, Tid, IKeypath, To) -> ok | err()

Move an entry in an "ordered-by user" list.

ncs_apply_template/7

ncs_apply_template(Socket, Tid, TemplateName, RootIKeypath, Variables, Documents, Shared) -> ok | err()

Apply a template that has been loaded into NCS.

The TemplateName parameter gives the name of the template. The Variables parameter is a list of variables and names for substitution into the template.

ncs_apply_trans_params/4

ncs_apply_trans_params(Socket, Tid, KeepOpen, Params) -> Result

Apply transaction with commit parameters.

This is a version of apply_trans that takes commit parameters in form of a list of tagged values according to the input parameters for rpc prepare-transaction as defined in tailf-netconf-ncs.yang module. The result of this function may include a list of tagged values according to the output parameters of rpc prepare-transaction or output parameters of rpc commit-transaction as defined in tailf-netconf-ncs.yang module.

ncs_get_trans_params/2

ncs_get_trans_params(Socket, Tid) -> Result

Get transaction commit parameters.

ncs_template_variables/3

ncs_template_variables(Socket, Tid, TemplateName) -> {ok, binary()} | err()

Retrieve the variables used in a template.

ncs_templates/1

ncs_templates(Socket) -> {ok, binary()} | err()

Retrieve a list of the templates currently loaded into NCS.

ncs_write_service_log_entry/5

ncs_write_service_log_entry(Socket, IKeypath, Message, Type, Level) -> ok | err()

Write a service log entry.

netconf_ssh_call_home/3

netconf_ssh_call_home(Socket, Host, Port) -> ok | err()

netconf_ssh_call_home_opaque/4

netconf_ssh_call_home_opaque(Socket, Host, Opaque, Port) -> ok | err()

num_instances/3

num_instances(Socket, Tid, IKeypath) -> Result

Find the number of entries in a list.

perform_upgrade/2

perform_upgrade(Socket, LoadPathList) -> ok | err()

Do in-service upgrade.

prepare_trans/2

prepare_trans(Socket, Tid) -> ok | err()

Equivalent to prepare_trans(Socket, Tid, 0).

prepare_trans/3

prepare_trans(Socket, Tid, Flags) -> ok | err()

Prepare for commit.

prio_message/3

prio_message(Socket, To, Message) -> ok | err()

Write priority message.

progress_info/6

progress_info(Socket, Verbosity, Msg, SIKP, Attrs, Links) -> ok

progress_info_th/7

progress_info_th(Socket, Tid, Verbosity, Msg, SIKP, Attrs, Links) -> ok

  • Socket = econfd:socket()
  • Tid = integer()
  • Verbosity = verbosity()
  • Msg = iolist()
  • SIKP = econfd:ikeypath()
  • Attrs = [{K::binary(), V::binary() | integer()}]
  • Links = [{TraceId::binary() | undefined, SpanId::binary() | undefined}]

reload_config/1

reload_config(Socket) -> ok | err()

Tell ConfD daemon to reload its configuration.

request_action/3

request_action(Socket, Params, IKeypath) -> Result

Invoke an action defined in the data model.

request_action_th/4

request_action_th(Socket, Tid, Params, IKeypath) -> Result

Invoke an action defined in the data model using the provided transaction.

Does the same thing as request_action/3, but uses the current namespace, the path position, and the user session from the transaction indicated by the 'Tid' handle.

revert/2

revert(Socket, Tid) -> ok | err()

Remove all changes in the transaction.

set_attr/5

set_attr(Socket, Tid, IKeypath, Attr, Value) -> ok | err()

Set the an attribute for an element. Value == undefined means that the attribute should be deleted.

set_comment/3

set_comment(Socket, Tid, Comment) -> ok | err()

Set the "Comment" that is stored in the rollback file when a transaction towards running is committed.

set_delayed_when/3

set_delayed_when(Socket, Tid, Value) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • Value = boolean()
  • Result = {ok, OldValue} | err()
  • OldValue = boolean()

Enable/disable the "delayed when" mode for a transaction.

Returns the old setting on success.

set_elem/4

set_elem(Socket, Tid, IKeypath, Value) -> ok | err()

Write an element.

set_elem2/4

set_elem2(Socket, Tid, IKeypath, BinValue) -> ok | err()

Write an element using the textual value representation.

set_flags/3

set_flags(Socket, Tid, Flags) -> ok | err()

Change flag settings for a transaction.

See ?MAAPI_FLAG_XXX in econfd.hrl for the available flags, however ?MAAPI_FLAG_HIDE_INACTIVE ?MAAPI_FLAG_DELAYED_WHEN and ?MAAPI_FLAG_HIDE_ALL_HIDEGROUPS cannot be changed after transaction start (but see set_delayed_when/3).

set_label/3

set_label(Socket, Tid, Label) -> ok | err()

Set the "Label" that is stored in the rollback file when a transaction towards running is committed.

set_object/4

set_object(Socket, Tid, IKeypath, ValueList) -> ok | err()

Write an entire object, i.e. YANG list entry or container.

set_readonly_mode/2

set_readonly_mode(Socket, Mode) -> {ok, boolean()} | err()

Control if we can create rw transactions.

set_running_db_status/2

set_running_db_status(Socket, Status) -> ok | err()

Set the "running status".

set_user_session/2

set_user_session(Socket, USid) -> ok | err()

Assign a user session.

set_values/4

set_values(Socket, Tid, IKeypath, ValueList) -> ok | err()

Write a list of tagged values.

This function is an alternative to set_object/4, and allows for writing more complex structures (e.g. multiple entries in a list).

shared_create/3

shared_create(Socket, Tid, IKeypath) -> ok | err()

Create a new element, and also set an attribute indicating how many times this element has been created.

shared_set_elem/4

shared_set_elem(Socket, Tid, IKeypath, Value) -> ok | err()

Write an element from NCS FastMap.

shared_set_elem2/4

shared_set_elem2(Socket, Tid, IKeypath, BinValue) -> ok | err()

Write an element using the textual value representation from NCS fastmap.

shared_set_values/4

shared_set_values(Socket, Tid, IKeypath, ValueList) -> ok | err()

Write a list of tagged values from NCS FastMap.

snmpa_reload/2

snmpa_reload(Socket, Synchronous) -> ok | err()

Tell ConfD to reload external SNMP Agent config data.

start_phase/3

start_phase(Socket, Phase, Synchronous) -> ok | err()

Tell ConfD to proceed to next start phase.

start_progress_span/6

start_progress_span(Socket, Verbosity, Msg, SIKP, Attrs, Links) -> Result

  • Socket = econfd:socket()
  • Verbosity = verbosity()
  • Msg = iolist()
  • SIKP = econfd:ikeypath()
  • Attrs = [{K::binary(), V::binary() | integer()}]
  • Links = [{TraceId::binary() | undefined, SpanId1::binary() | undefined}]
  • Result = {ok, {SpanId2::binary() | undefined, TraceId::binary() | undefined}}

start_progress_span_th/7

start_progress_span_th(Socket, Tid, Verbosity, Msg, SIKP, Attrs, Links) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • Verbosity = verbosity()
  • Msg = iolist()
  • SIKP = econfd:ikeypath()
  • Attrs = [{K::binary(), V::binary() | integer()}]
  • Links = [{TraceId::binary() | undefined, SpanId1::binary() | undefined}]
  • Result = {ok, {SpanId2::binary() | undefined, TraceId::binary() | undefined}}

start_trans/3

start_trans(Socket, DbName, RwMode) -> Result

Start a new transaction.

start_trans/4

start_trans(Socket, DbName, RwMode, USid) -> Result

Start a new transaction within an existing user session.

start_trans/5

start_trans(Socket, DbName, RwMode, USid, Flags) -> Result

Start a new transaction within an existing user session and/or with flags.

See ?MAAPI_FLAG_XXX in econfd.hrl for the available flags. To use the existing user session of the socket, give Usid = 0.

start_trans_in_trans/4

start_trans_in_trans(Socket, RwMode, USid, Tid) -> Result

  • Socket = econfd:socket()
  • RwMode = integer()
  • USid = integer()
  • Tid = integer()
  • Result = {ok, integer()} | err()

Start a new transaction with an existing transaction as backend.

To use the existing user session of the socket, give Usid = 0.

start_trans_in_trans/5

start_trans_in_trans(Socket, RwMode, USid, Tid, Flags) -> Result

  • Socket = econfd:socket()
  • RwMode = integer()
  • USid = integer()
  • Tid = integer()
  • Flags = non_neg_integer()
  • Result = {ok, integer()} | err()

Start a new transaction with an existing transaction as backend.

To use the existing user session of the socket, give Usid = 0.

start_user_session/6

start_user_session(Socket, UserName, Context, Groups, SrcIp, Proto) -> ok | err()

Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto).

start_user_session/7

start_user_session(Socket, UserName, Context, Groups, SrcIp, SrcPort, Proto) -> ok | err()

Equivalent to start_user_session(Socket, UserName, Context, Groups, SrcIp, 0, Proto, undefined).

start_user_session/8

start_user_session(Socket, UserName, Context, Groups, SrcIp, SrcPort, Proto, UId) -> ok | err()

Initiate a new maapi user session.

returns a maapi session id. Before we can execute any maapi functions we must always have an associated user session.

stop/1

stop(Socket) -> ok

Equivalent to stop(Sock, true).

Tell ConfD daemon to stop, returns when daemon has exited.

stop/2

stop(Socket, Synchronous) -> ok

Tell ConfD daemon to stop, if Synchronous is true won't return until daemon has come to a halt.

Note that the socket will most certainly not be possible to use again, since ConfD will close its end when it exits.

sys_message/3

sys_message(Socket, To, Message) -> ok | err()

Write system message.

unhide_group/3

unhide_group(Socket, Tid, GroupName) -> ok | err()

Do unhide a hide group.

Unhide all nodes belonging to a hide group in a transaction that started with flag FLAG_HIDE_ALL_HIDEGROUPS.

unlock/2

unlock(Socket, DbName) -> ok | err()

Unlock a database.

unlock_partial/2

unlock_partial(Socket, LockId) -> ok | err()

Remove the partial lock identified by LockId.

user_message/4

user_message(Socket, To, From, Message) -> ok | err()

Write user message.

validate_trans/4

validate_trans(Socket, Tid, UnLock, ForceValidation) -> ok | err()

  • Socket = econfd:socket()
  • Tid = integer()
  • UnLock = boolean()
  • ForceValidation = boolean()

Validate the transaction.

wait_start/1

wait_start(Socket) -> ok | err()

Equivalent to wait_start(Socket, 2).

Wait until ConfD daemon has completely started.

wait_start/2

wait_start(Socket, Phase) -> ok | err()

Wait until ConfD daemon has reached a certain start phase.

xpath_eval/6

xpath_eval(Socket, Tid, Expr, ResultFun, State, Options) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • Expr = binary() | {compiled, Source, Compiled}
  • Source = binary()
  • Compiled = [binary() | tuple()]
  • ResultFun = fun((IKeypath, Value, State) -> {Ret, State})
  • IKeypath = econfd:ikeypath()
  • Value = term()
  • State = term()
  • Ret = integer()
  • Options = [xpath_eval_option()]
  • Result = {ok, State} | err()

Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.

The possible values for Ret in the return value for ResultFun are ?ITER_CONTINUE and ?ITER_STOP.

xpath_eval/7

xpath_eval(Socket, Tid, Expr, ResultFun, TraceFun, State, Context) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • Expr = binary()
  • ResultFun = fun((IKeypath, Value, State) -> {Ret, State})
  • IKeypath = econfd:ikeypath()
  • Value = econfd:value() | undefined
  • State = term()
  • Ret = integer()
  • TraceFun = fun((binary()) -> none()) | undefined
  • Context = econfd:ikeypath() | []
  • Result = {ok, State} | {error, term()}

This function is deprecated: This function is kept for backwards compatibility, use xpath_eval/6.

Evaluate the XPath expression Expr, invoking ResultFun for each node in the resulting node set.

The possible values for Ret in the return value for ResultFun are ?ITER_CONTINUE and ?ITER_STOP.

xpath_eval_expr/4

xpath_eval_expr(Socket, Tid, Expr, Options) -> Result

  • Socket = econfd:socket()
  • Tid = integer()
  • Expr = binary() | {compiled, Source, Compiled}
  • Source = binary()
  • Compiled = [binary() | tuple()]
  • Options = [xpath_eval_option()]
  • Result = {ok, binary()} | err()

Evaluate the XPath expression Expr, returning the result as a string.

xpath_eval_expr/5

xpath_eval_expr(Socket, Tid, Expr, TraceFun, Context) -> Result

Evaluate the XPath expression Expr, returning the result as a string.


Generated by EDoc