| |
- aaa_reload(...)
- aaa_reload(sock, synchronous) -> None
Start a reload of aaa from external data provider.
Used by external data provider to notify that there is a change to the AAA
data. Calling the function with the argument 'synchronous' set to 1 or True
means that the call will block until the loading is completed.
Keyword arguments:
sock -- a python socket instance
synchronous -- if 1, will wait for the loading complete and return when the
loading is complete, if 0 will only initiate the loading of AAA data and
return immediately
- aaa_reload_path(...)
- aaa_reload_path(sock, synchronous, path) -> None
Start a reload of aaa from external data provider.
A variant of _maapi_aaa_reload() that causes only the AAA subtree given by
path to be loaded.
Keyword arguments:
sock -- a python socket instance
synchronous -- if 1, will wait for the loading complete and return when the
loading is complete, if 0 will only initiate the loading of AAA data and
return immediately
path -- the subtree to be loaded
- abort_trans(...)
- abort_trans(sock, thandle) -> None
Final phase of a two phase transaction, aborting the trans.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- abort_upgrade(...)
- abort_upgrade(sock) -> None
Can be called before committing upgrade in order to abort it.
Final step in an upgrade.
Keyword arguments:
sock -- a python socket instance
- apply_trans(...)
- apply_trans(sock, thandle, keepopen) -> None
Apply a transaction.
Validates, prepares and eventually commits or aborts the transaction. If
the validation fails and the 'keep_open' argument is set to 1 or True, the
transaction is left open and the developer can react upon the validation
errors.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
keepopen -- if true, transaction is not discared if validation fails
- apply_trans_flags(...)
- apply_trans_flags(sock, thandle, keepopen, flags) -> None
A variant of apply_trans() that takes an additional 'flags' argument.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
keepopen -- if true, transaction is not discared if validation fails
flags -- flags to set in the transaction
- attach(...)
- attach(sock, hashed_ns, ctx) -> None
Attach to a existing transaction.
Keyword arguments:
sock -- a python socket instance
hashed_ns -- the namespace to use
ctx -- transaction context
- attach2(...)
- attach2(sock, hashed_ns, usid, thandle) -> None
Used when there is no transaction context beforehand, to attach to a
existing transaction.
Keyword arguments:
sock -- a python socket instance
hashed_ns -- the namespace to use
usid -- user session id, can be set to 0 to use the owner of the transaction
thandle -- transaction handle
- attach_init(...)
- attach_init(sock) -> int
Attach the _MAAPI socket to the special transaction available during phase0.
Returns the thandle as an integer.
Keyword arguments:
sock -- a python socket instance
- authenticate(...)
- authenticate(sock, user, password, n) -> tuple
Authenticate a user session. Use the 'n' to get a list of n-1 groups that
the user is a member of. Use n=1 if the function is used in a context
where the group names are not needed. Returns 1 if accepted without groups.
If the authentication failed or was accepted a tuple with first element
status code, 0 for rejection and 1 for accepted is returned. The second
element either contains the reason for the rejection as a string OR a list
groupnames.
Keyword arguments:
sock -- a python socket instance
user -- username
pass -- password
n -- number of groups to return
- authenticate2(...)
- authenticate2(sock, user, password, src_addr, src_port, context, prot, n) -> tuple
This function does the same thing as maapi_authenticate(), but allows for
passing of the additional parameters src_addr, src_port, context, and prot,
which otherwise are passed only to maapi_start_user_session()/
maapi_start_user_session2(). The parameters are passed on to an external
authentication executable.
Keyword arguments:
sock -- a python socket instance
user -- username
pass -- password
src_addr -- ip address
src_port -- port number
context -- context for the session
prot -- the protocol used by the client for connecting
n -- number of groups to return
- candidate_abort_commit(...)
- candidate_abort_commit(sock) -> None
Cancel an ongoing confirmed commit.
Keyword arguments:
sock -- a python socket instance
- candidate_abort_commit_persistent(...)
- candidate_abort_commit_persistent(sock, persist_id) -> None
Cancel an ongoing confirmed commit with the cookie given by persist_id.
Keyword arguments:
sock -- a python socket instance
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
- candidate_commit(...)
- candidate_commit(sock) -> None
This function copies the candidate to running.
Keyword arguments:
sock -- a python socket instance
- candidate_commit_info(...)
- candidate_commit_info(sock, persist_id, label, comment) -> None
Commit the candidate to running, or confirm an ongoing confirmed commit,
and set the Label and/or Comment that is stored in the rollback file when
the candidate is committed to running.
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 maapi_candidate_confirmed_commit_info())
and with the confirming commit (using this function).
Keyword arguments:
sock -- a python socket instance
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
label -- the Label
comment -- the Comment
- candidate_commit_persistent(...)
- candidate_commit_persistent(sock, persist_id) -> None
Confirm an ongoing persistent commit with the cookie given by persist_id.
Keyword arguments:
sock -- a python socket instance
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
- candidate_commit_persistent_flags(...)
- candidate_commit_persistent_flags(sock, persist_id, flags) -> None
Confirm an ongoing persistent commit with the cookie given by persist_id
using flags.
Keyword arguments:
sock -- a python socket instance
- candidate_confirmed_commit(...)
- candidate_confirmed_commit(sock, timeoutsecs) -> None
This function also copies the candidate into running. However if a call to
maapi_candidate_commit() is not done within timeoutsecs an automatic
rollback will occur.
Keyword arguments:
sock -- a python socket instance
timeoutsecs -- timeout in seconds
- candidate_confirmed_commit_info(...)
- candidate_confirmed_commit_info(sock, timeoutsecs, persist, persist_id, label, comment) -> None
Like candidate_confirmed_commit_persistent, but also allows for setting the
Label and/or Comment that is stored in the rollback file when the candidate
is committed to running.
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()).
Keyword arguments:
sock -- a python socket instance
timeoutsecs -- timeout in seconds
persist -- sets the cookie for the persistent confirmed commit
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
label -- the Label
comment -- the Comment
- candidate_confirmed_commit_persistent(...)
- candidate_confirmed_commit_persistent(sock, timeoutsecs, persist, persist_id) -> None
Start or extend a confirmed commit using persist id.
Keyword arguments:
sock -- a python socket instance
timeoutsecs -- timeout in seconds
persist -- sets the cookie for the persistent confirmed commit
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
- candidate_confirmed_commit_persistent_flags(...)
- candidate_commit_persistent_flags(sock, timeoutsecs, persist, persist_id, flags) -> None
Like candidate_confirmed_commit_persistent, but also takes a set of flags.
Keyword arguments:
sock -- a python socket instance
timeoutsecs -- timeout in seconds
persist -- sets the cookie for the persistent confirmed commit
persist_id -- gives the cookie for an already ongoing persistent confirmed commit
flags -- flags
- candidate_reset(...)
- candidate_reset(sock) -> None
Copy running into candidate.
Keyword arguments:
sock -- a python socket instance
- candidate_validate(...)
- candidate_validate(sock) -> None
This function validates the candidate.
Keyword arguments:
sock -- a python socket instance
- cd(...)
- cd(sock, thandle, path) -> None
Change current position in the tree.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position to change to
- clear_opcache(...)
- clear_opcache(sock, path) -> None
Clearing of operational data cache.
Keyword arguments:
sock -- a python socket instance
path -- the path to the subtree to clear
- cli_accounting(...)
- cli_accounting(sock, user, usid, cmdstr) -> None
Generates an audit log entry in the CLI audit log.
Keyword arguments:
sock -- a python socket instance
user -- user to generate the entry for
thandle -- transaction handle
- cli_cmd(...)
- cli_cmd(sock, usess, buf) -> None
Execute CLI command in the ongoing CLI session.
Keyword arguments:
sock -- a python socket instance
usess -- user session
buf -- string to write
- cli_cmd2(...)
- cli_cmd2(sock, usess, buf, flags) -> None
Execute CLI command in a ongoing CLI session. With flags:
CMD_NO_FULLPATH - Do not perform the fullpath check on show commands.
CMD_NO_HIDDEN - Allows execution of hidden CLI commands.
Keyword arguments:
sock -- a python socket instance
usess -- user session
buf -- string to write
flags -- as above
- cli_cmd3(...)
- cli_cmd3(sock, usess, buf, flags, unhide) -> None
Execute CLI command in a ongoing CLI session.
Keyword arguments:
sock -- a python socket instance
usess -- user session
buf -- string to write
flags -- as above
unhide -- The unhide parameter is used for passing a hide group which is
unhidden during the execution of the command.
- cli_cmd4(...)
- cli_cmd4(sock, usess, buf, flags, unhide) -> None
Execute CLI command in a ongoing CLI session.
Keyword arguments:
sock -- a python socket instance
usess -- user session
buf -- string to write
flags -- as above
unhide -- The unhide parameter is used for passing a hide group which is
unhidden during the execution of the command.
- cli_cmd_to_path(...)
- cli_cmd_to_path(sock, line, nsize, psize) -> tuple
Returns string of the C/I namespaced CLI path that can be associated with
the given command. Returns a tuple ns and path.
Keyword arguments:
sock -- a python socket instance
line -- data model path as string
nsize -- limit length of namespace
psize -- limit length of path
- cli_cmd_to_path2(...)
- cli_cmd_to_path2(sock, thandle, line, nsize, psize) -> tuple
Returns string of the C/I namespaced CLI path that can be associated with
the given command. In the context of the provided transaction handle.
Returns a tuple ns and path.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
line -- data model path as string
nsize -- limit length of namespace
psize -- limit length of path
- cli_diff_cmd(...)
- cli_diff_cmd(sock, thandle, thandle_old, flags, path, size) -> string
Get the diff between two sessions as a series C/I cli commands. Returns a
string.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
thandle_old -- transaction handle
flags -- as for cli_path_cmd
path -- as for cli_path_cmd
size -- limit diff
- cli_get(...)
- cli_get(sock, usess, opt) -> string
Read CLI session parameter or attribute.
Keyword arguments:
sock -- a python socket instance
usess -- user session
opt -- option to get
- cli_path_cmd(...)
- cli_path_cmd(sock, thandle, flags, path, size) -> string
Returns string of the C/I CLI command that can be associated with the given
path. The flags can be given as FLAG_EMIT_PARENTS to enable the commands to
reach the submode for the path to be emitted. The flags can be given as
FLAG_DELETE to emit the command to delete the given path. The flags can be
given as FLAG_NON_RECURSIVE to prevent that all children to a container or
list item are displayed.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
flags -- as above
path -- the path for the cmd
size -- limit cmd
- cli_prompt(...)
- cli_prompt(sock, usess, prompt, echo) -> None
Prompt user for a string.
Keyword arguments:
sock -- a python socket instance
usess -- user session
prompt -- string to show the user
echo -- determines wether to control if the input should be echoed or not.
ECHO shows the input, NOECHO does not
- cli_prompt_oneof(...)
- Prompt user for a string.
- cli_prompt_oneof2(...)
- Prompt user for a string.
- cli_read_eof(...)
- Prompt user for a string.
- cli_read_eof2(...)
- Prompt user for a string.
- cli_set(...)
- cli_set(sock, usess, opt, value) -> None
Set CLI session parameter.
Keyword arguments:
sock -- a python socket instance
usess -- user session
opt -- option to set
value -- the new value of the session parameter
- cli_write(...)
- cli_write(sock, usess, buf) -> None
Write to the cli.
Keyword arguments:
sock -- a python socket instance
usess -- user session
buf -- string to write
- close(...)
- close(sock) -> None
Ends session and closes socket.
Keyword arguments:
sock -- a python socket instance
- commit_queue_result(...)
- commit_queue_result(sock, thandle, timeoutsecs) -> tuple
Get result from commit queue. Returns tuple(int, int) containing queue id
and status.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
timeoutsecs -- timeout in seconds
- commit_trans(...)
- commit_trans(sock, thandle) -> None
Final phase of a two phase transaction, committing the trans.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
keepopen -- if true, transaction is not discared if validation fails
- commit_upgrade(...)
- commit_upgrade(sock) -> None
Final step in an upgrade.
Keyword arguments:
sock -- a python socket instance
- confirmed_commit_in_progress(...)
- confirmed_commit_in_progress(sock) -> None
Checks wether a confirmed commit is ongoing. Returns boolean.
Keyword arguments:
sock -- a python socket instance
- connect(...)
- connect(sock, ip, port, path) -> None
Connect to the system daemon.
Keyword arguments:
sock -- a python socket instance
ip -- the ip address
port -- the port
path -- the path if socket is AF_UNIX (optional)
- copy(...)
- copy(sock, from_thandle, to_thandle) -> None
Copy all data from one data store to another.
Keyword arguments:
sock -- a python socket instance
from_thandle -- transaction handle
to_thandle -- transaction handle
- copy_path(...)
- copy(sock, from_thandle, to_thandle, path) -> None
Copy subtree rooted at path from one data store to another.
Keyword arguments:
sock -- a python socket instance
from_thandle -- transaction handle
to_thandle -- transaction handle
path -- the subtree rooted at path is copied
- copy_running_to_startup(...)
- copy_running_to_startup(sock) -> None
Copies running to startup.
Keyword arguments:
sock -- a python socket instance
- copy_tree(...)
- copy_tree(sock, thandle, frompath, topath) -> None
Copy subtree rooted at frompath to topath.
Keyword arguments:
sock -- a python socket instance
frompath -- the subtree rooted at path is copied
topath -- to which path the subtree is copied
- create(...)
- create(socket, thandle, path) -> None
Create a new list entry, a presence container or a leaf of type empty
in the data tree.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- path of item to create
- delete(...)
- delete(sock, thandle, path) -> None
Delete an existing list entry, a presence container or a leaf of type empty
from the data tree.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- path of item to delete
- delete_all(...)
- delete_all(sock, thandle, how) -> None
Delete all data within a transaction.
The how argument specifies how to delete:
DEL_SAFE - Delete everything except namespaces that were exported with
tailf:export none. Top-level nodes that cannot be deleted
due to AAA rules are left in place (descendant nodes may be
deleted if the rules allow it).
DEL_EXPORTED - As DEL_SAFE, but AAA rules are ignored.
DEL_ALL - Delete everything, AAA rules are ignored.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
how -- DEL_SAFE, DEL_EXPORTED or DEL_ALL
- delete_config(...)
- delete_config(sock, name) -> None
Empties a datastore.
Keyword arguments:
sock -- a python socket instance
name -- name of the datastore to empty
- destroy_cursor(...)
- destroy_cursor(mc) -> None
Deallocates memory which is associated with the cursor.
Keyword arguments:
mc -- maapiCursor
- detach(...)
- detach(sock, ctx) -> None
Detaches an attached _MAAPI socket.
Keyword arguments:
sock -- a python socket instance
ctx -- transaction context
- detach2(...)
- detach2(sock, thandle) -> None
Detaches an attached _MAAPI socket when we do not have a transaction context
available.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- diff_iterate(...)
- diff_iterate(sock, thandle, iter, flags) -> None
Iterate through a transaction diff.
For each diff in the transaction the callback function 'iter' will be
called. The iter function needs to have the following signature:
def iter(keypath, operation, oldvalue, newvalue)
And return one of:
ITER_STOP - Stop further iteration
ITER_RECURSE - Recurse further down the node children
ITER_CONTINUE - Ignore node children and continue with the node's siblings
One could also define a class implementing the call function as:
class DiffIterator(object):
def __init__(self):
self.count = 0
def __call__(self, kp, op, oldv, newv):
print('kp={0}, op={1}, oldv={2}, newv={3}'.format(
str(kp), str(op), str(oldv), str(newv)))
self.count += 1
return _confd.ITER_RECURSE
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
iter -- iterator function, will be called for every diff in the transaction
flags -- bitmask of ITER_WANT_ATTR and ITER_WANT_P_CONTAINER
- disconnect_remote(...)
- disconnect_remote(sock, address) -> None
Disconnect all remote connections to 'address' except HA connections.
Keyword arguments:
sock -- a python socket instance
address -- ip address (string)
- disconnect_sockets(...)
- disconnect_remote(sock, sockets) -> None
Disconnect 'sockets' which is a list of sockets (fileno).
Keyword arguments:
sock -- a python socket instance
sockets -- list of sockets (int)
- do_display(...)
- do_display(sock, thandle, path) -> int
If the data model uses the YANG when or tailf:display-when statement, this
function can be used to determine if the item given by 'path' should
be displayed or not.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- path to the 'display-when' statement
- end_user_session(...)
- end_user_session(sock) -> None
End the MAAPI user session associated with the socket
Keyword arguments:
sock -- a python socket instance
- exists(...)
- exists(sock, thandle, path) -> boolean
Check wether a node in the data tree exists. Returns boolean.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position to check
- find_next(...)
- find_next(mc, type, inkeys) -> list(Value) | False
Update the cursor mc with the key(s) for the list entry designated by the
type and inkeys parameters. This function may be used to start a traversal
from an arbitrary entry in a list. Keys for subsequent entries may be
retrieved with the get_next() function. When no more keys are found, False
is returned.
The strategy to use is defined by type:
FIND_NEXT - The keys for the first list entry after the one
indicated by the inkeys argument.
FIND_SAME_OR_NEXT - If the values in the inkeys array completely
identifies an actual existing list entry, the keys for
this entry are requested. Otherwise the same logic as
for FIND_NEXT above.
Keyword arguments:
mc -- maapiCursor
type -- CONFD_FIND_NEXT or CONFD_FIND_SAME_OR_NEXT
inkeys -- where to start finding
- finish_trans(...)
- finish_trans(sock, thandle) -> None
Finish a transaction.
If the transaction is implemented by an external database, this will invoke
the finish() callback.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- get_attrs(...)
- get_attrs(sock, thandle, attrs, keypath) -> list
Get attributes for a node. Returns a list of attributes.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
attrs -- list of type of attributes to get
keypath -- path to choice
- get_authorization_info(...)
- get_authorization_info(sock, usessid) -> confdAuthorizationInfo
This function retrieves authorization info for a user session,i.e. the groups that the user has been assigned to.
Keyword arguments:
sock -- a python socket instance
usessid -- user session id
- get_case(...)
- get_case(sock, thandle, choice, keypath) -> confdValue
Get the case from a YANG choice statement.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
choice -- choice name
keypath -- path to choice
- get_elem(...)
- get_elem(sock, thandle, path) -> confdValue
Path must be a valid leaf node in the data tree. Returns a Value object.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position of elem
- get_my_user_session_id(...)
- get_my_user_session_id(sock) -> int
Returns user session id
Keyword arguments:
sock -- a python socket instance
- get_next(...)
- get_next(mc) -> list(Value) | False
Iterates and gets the keys for the next entry in a list. When no more keys
are found, False is returned.
Keyword arguments:
mc -- maapiCursor
- get_object(...)
- get_object(sock, thandle, n, keypath) -> list(Value)
Read at most n values from keypath in a list.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position of list entry
- get_objects(...)
- get_objects(mc, n, nobj) -> list(Value)
Read at most n values from each nobj lists starting at Cursor mc.
Returns a list of Value's.
Keyword arguments:
mc -- maapiCursor
n -- at most n values will be read
nobj -- number of nobj lists which n elements will be taken from
- get_running_db_status(...)
- get_running_db_status(sock) -> int
If a transaction fails in the commit() phase, the configuration database is
in in a possibly inconsistent state. This function queries ConfD on the
consistency state. Returns 1 if the configuration is consistent and 0
otherwise.
Keyword arguments:
sock -- a python socket instance
- get_schema_file_path(...)
- get_schema_file_path(sock) -> string
If shared memory schema support has been enabled, this function will
return the pathname of the file used for the shared memory mapping,
which can then be passed to the mmap_schemas() function>
If creation of the schema file is in progress when the function
is called, the call will block until the creation has completed.
Keyword arguments:
sock -- a python socket instance
- get_stream_progress(...)
- get_stream_progress(sock, id) -> int
Used in conjunction with a maapi stream to see how much data has been
consumed.
This function allows us to limit the amount of data 'in flight' between the
application and the system. The sock parameter must be the maapi socket
used for a function call that required a stream socket for writing
(currently the only such function is load_config_stream()), and the id
parameter is the id returned by that function.
Keyword arguments:
sock -- a python socket instance
id -- the id returned from load_config_stream()
- get_user_session(...)
- get_user_session(sock, usessid) -> UserInfo
Return user info.
Keyword arguments:
sock -- a python socket instance
usessid -- session id
- get_user_session_identification(...)
- get_user_session_identification(sock, usessid) -> dict
Get user session identification data.
Get the user identification data related to a user session provided by the
'usessid' argument. The function returns a dict with the user
identification data.
Keyword arguments:
sock -- a python socket instance
usessid -- user session id
- get_user_session_opaque(...)
- get_user_session_opaque(sock, usessid) -> string
Returns a string containing additional 'opaque' information, if additional
'opaque' information is available.
Keyword arguments:
sock -- a python socket instance
usessid -- user session id
- get_user_sessions(...)
- get_user_sessions(sock) -> list
Return a list of session ids.
Keyword arguments:
sock -- a python socket instance
- get_values(...)
- get_values(sock, thandle, values, keypath) -> list
Get values from keypath based on the Tag Value array values.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
values -- list of tagValues
- getcwd(...)
- getcwd(sock, thandle) -> string
Get the current position in the tree as a string.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- getcwd_kpath(...)
- getcwd_kpath(sock, thandle) -> HKeypathRef
Get the current position in the tree as a HKeypathRef.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- init_cursor(...)
- init_cursor(sock, thandle, path) -> _maapiCursor
Whenever we wish to iterate over the entries in a list in the data tree, we
must first initialize a cursor.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position of elem
- init_upgrade(...)
- init_upgrade(sock, timeoutsecs, flags) -> None
First step in an upgrade, initializes the upgrade procedure.
Keyword arguments:
sock -- a python socket instance
timeoutsecs -- maximum time to wait for user to voluntarily exit from
'configuration' mode
flags -- 0 or 'UPGRADE_KILL_ON_TIMEOUT' (will terminate all ongoing
transactions
- insert(...)
- insert(sock, thandle, path) -> None
Insert a new entry in a list, the key of the list must be a integer.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- the subtree rooted at path is copied
- install_crypto_keys(...)
- install_crypto_keys(sock) -> None
Copy configured DES3 and AES keys into the memory in the library.
Keyword arguments:
sock -- a python socket instance
- is_candidate_modified(...)
- is_candidate_modified(sock) -> boolean
Checks if candidate is modified.
Keyword arguments:
sock -- a python socket instance
- is_lock_set(...)
- is_lock_set(sock, name) -> int
Check if db name is locked. Return the 'usid' of the user holding the lock
or 0 if not locked.
Keyword arguments:
sock -- a python socket instance
- is_running_modified(...)
- is_running_modified(sock) -> boolean
Checks if running is modified.
Keyword arguments:
sock -- a python socket instance
- iterate(...)
- iterate(sock, thandle, iter, flags, path) -> None
Used to iterate over all the data in a transaction and the underlying data
store as opposed to only iterate over changes like diff_iterate.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
iter -- iterator function, will be called for every diff in the transaction
flags -- ITER_WANT_ATTR or 0
path -- receive only changes from this path and below
The iter callback function should have the following signature:
def my_iterator(kp, v, attr_vals)
- keypath_diff_iterate(...)
- keypath_diff_iterate(sock, thandle, iter, flags, path) -> None
Like diff_iterate but takes an additional path argument.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
iter -- iterator function, will be called for every diff in the transaction
flags -- bitmask of ITER_WANT_ATTR and ITER_WANT_P_CONTAINER
path -- receive only changes from this path and below
- kill_user_session(...)
- kill_user_session(sock, usessid) -> None
Kill MAAPI user session with session id.
Keyword arguments:
sock -- a python socket instance
usessid -- the MAAPI session id to be killed
- list_rollbacks(...)
- list_rollbacks(sock, rp_size) -> list
Get a list of rollbacks, at most rp_size big.
Keyword arguments:
sock -- a python socket instance
rp_size -- maximum number of rollback files to list
- load_config(...)
- load_config(sock, thandle, flags, filename) -> None
Loads configuration from 'filename'.
The caller of the function has to indicate which format the file has by
using one of the following flags:
CONFIG_XML -- XML format
CONFIG_J -- Juniper curly bracket style
CONFIG_C -- Cisco XR style
CONFIG_C_IOS -- Cisco IOS style
Keyword arguments:
sock -- a python socket instance
thandle -- a transaction handle
flags -- as above
filename -- to read the configuration from
- load_config_cmds(...)
- load_config_cmds(sock, thandle, flags, cmds, path) -> None
Loads configuration from the string 'cmds'
Keyword arguments:
sock -- a python socket instance
thandle -- a transaction handle
cmds -- a string of cmds
flags -- as above
- load_config_stream(...)
- load_config_stream(sock, th, flags) -> int
Loads configuration from the stream socket. The th and flags parameters are
the same as for load_config(). Returns and id.
Keyword arguments:
sock -- a python socket instance
thandle -- a transaction handle
flags -- as for load_config()
- load_config_stream_result(...)
- load_config_stream_result(sock, id) -> int
We use this function to verify that the configuration we wrote on the
stream socket was successfully loaded.
Keyword arguments:
sock -- a python socket instance
id -- the id returned from load_config_stream()
- load_rollback(...)
- load_rollback(sock, thandle, rollback_num) -> None
Install a rollback file with number 'rollback_num'.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
rollback_num -- rollback file no
- load_schemas(...)
- load_schemas(sock) -> None
Loads all schema information into the lib.
Keyword arguments:
sock -- a python socket instance
- load_schemas_list(...)
- load_schema_list(sock, flags, nshash, nsflags) -> None
Loads selected schema information into the lib.
Keyword arguments:
sock -- a python socket instance
flags -- the flags to set
nshash -- the listed namespaces that schema information should beloaded for
nsflags -- namespace specific flags
- lock(...)
- lock(sock, name) -> None
Lock database with name.
Keyword arguments:
sock -- a python socket instance
name -- name of the database to lock
- lock_partial(...)
- lock_partial(sock, name, xpaths) -> int
Lock a subset (xpaths) of database name. Returns lockid.
Keyword arguments:
sock -- a python socket instance
xpaths -- a list of strings
- move(...)
- move(sock, thandle, tokey, path) -> None
Moves an existing list entry, i.e. renames the entry using the tokey
parameter.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
tokey -- confdValue list
path -- the subtree rooted at path is copied
- move_ordered(...)
- move_ordered(sock, thandle, where, tokey, path) -> None
Moves an entry in an 'ordered-by user' statement to a new position.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
where -- FIRST, LAST, BEFORE or AFTER
tokey -- confdValue list
path -- the subtree rooted at path is copied
- num_instances(...)
- num_instances(sock, thandle, path) -> int
Return the number of instances in a list in the tree.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position to check
- perform_upgrade(...)
- perform_upgrade(sock, loadpathdirs) -> None
Second step in an upgrade. Loads new data model files.
Keyword arguments:
sock -- a python socket instance
loadpathdirs -- list of directories that are searched for CDB 'init' files
- popd(...)
- popd(sock, thandle) -> None
Return to earlier saved (pushd) position in the tree.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- prepare_trans(...)
- prepare_trans(sock, thandle) -> None
First phase of a two-phase trans.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- prepare_trans_flags(...)
- prepare_trans_flags(sock, thandle, flags) -> None
First phase of a two-phase trans with flags.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
flags -- flags to set in the transaction
- prio_message(...)
- prio_message(sock, to, message) -> None
Like sys_message but will be output directly instead of delivered when the
receiver terminates any ongoing command.
Keyword arguments:
sock -- a python socket instance
to -- user to send message to or 'all' to send to all users
message -- the message
- pushd(...)
- pushd(sock, thandle, path) -> None
Like cd, but saves the previous position in the tree. This can later be used
by popd to return.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- position to change to
- query_free_result(...)
- query_free_result(qrs) -> None
Deallocates the struct returned by 'query_result()'.
Keyword arguments:
qrs -- the query result structure to free
- query_reset(...)
- query_reset(sock, qh) -> None
Reset the query to the beginning again.
Keyword arguments:
sock -- a python socket instance
qh -- query handle
- query_reset_to(...)
- query_reset_to(sock, qh, offset) -> None
Reset the query to offset.
Keyword arguments:
sock -- a python socket instance
qh -- query handle
offset -- offset counted from the beginning
- query_result(...)
- query_result(sock, qh) -> QueryResult
Fetches the next available chunk of results associated with query handle
qh.
Keyword arguments:
sock -- a python socket instance
qh -- query handle
- query_result_count(...)
- query_result_count(sock, qh) -> int
Counts the number of query results
Keyword arguments:
sock -- a python socket instance
qh -- query handle
- query_start(...)
- query_start(sock, thandle, expr, context_node, chunk_size, initial_offset,
result_as, select, sort) -> int
Starts a new query attached to the transaction given in 'th'.
Returns a query handle.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
expr -- the XPath Path expression to evaluate
context_node -- The context node (an ikeypath) for the primary expression,
or None (which means that the context node will be /).
chunk_size -- How many results to return at a time. If set to 0 a default
number will be used.
initial_offset -- Which result in line to begin with (1 means to start from
the beginning).
result_as -- The format the results will be returned in.
select -- An array of XPath 'select' expressions.
sort -- An array of XPath expressions which will be used for sorting
- query_stop(...)
- query_stop(sock, qh) -> None
Stop the running query.
Keyword arguments:
sock -- a python socket instance
qh -- query handle
- rebind_listener(...)
- rebind_listener(sock, listener) -> None
Request that the subsystems specified by 'listeners' rebinds its listener
socket(s).
Keyword arguments:
sock -- a python socket instance
listener -- One of the following parameters (ORed together if more than one)
LISTENER_IPC
LISTENER_NETCONF
LISTENER_SNMP
LISTENER_CLI
LISTENER_WEBUI
- reload_config(...)
- reload_config(sock) -> None
Request that the system reloads its configuration files.
Keyword arguments:
sock -- a python socket instance
- reopen_logs(...)
- reopen_logs(sock) -> None
Request that the system closes and re-opens its log files.
Keyword arguments:
sock -- a python socket instance
- request_action(...)
- request_action(sock, params, hashed_ns, path) -> list
Invoke an action defined in the data model. Returns a list oftagValues.
Keyword arguments:
sock -- a python socket instance
params -- tagValue parameters for the action
hashed_ns -- namespace
path -- path to action
- request_action_str_th(...)
- request_action_str_th(sock, thandle, cmd, path) -> string
The same as request_action_th but takes the parameters as a string and
returns the result as a string.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
cmd -- string parameters
path -- path to action
- request_action_th(...)
- request_action_th(sock, thandle, params, path) -> list
Same as for request_action() but uses the current namespace.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
params -- tagValue parameters for the action
path -- path to action
- revert(...)
- revert(sock, thandle) -> None
Removes all changes done to the transaction.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
- roll_config(...)
- roll_config(sock, thandle, path) -> int
This function can be used to save the equivalent of a rollback file for a
given configuration before it is committed (or a subtree thereof) in curly
bracket format. Returns an id
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
path -- tree for which to save the rollback configuration
- roll_config_result(...)
- roll_config_result(sock, id) -> int
We use this function to assert that we received the entire rollback
configuration over a stream socket.
Keyword arguments:
sock -- a python socket instance
id -- the id returned from roll_config()
- save_config(...)
- save_config(sock, thandle, flags, path) -> int
Save the config, returns an id.
The flags parameter controls the saving as follows. The value is a bitmask.
MAAPI_CONFIG_XML - The configuration format is XML.
MAAPI_CONFIG_XML_PRETTY - The configuration format is pretty printed
XML.
MAAPI_CONFIG_J - The configuration is in curly bracket Juniper CLI
format.
MAAPI_CONFIG_C - The configuration is in Cisco XR style format.
MAAPI_CONFIG_C_IOS - The configuration is in Cisco IOS style format.
MAAPI_CONFIG_XPATH - The path gives an XPath filter instead of a
keypath. Can only be used with MAAPI_CONFIG_XML and
MAAPI_CONFIG_XML_PRETTY.
MAAPI_CONFIG_WITH_DEFAULTS - Default values are part of the
configuration dump.
MAAPI_CONFIG_SHOW_DEFAULTS - Default values are also shown next to
the real configuration value. Applies only to the CLI formats.
MAAPI_CONFIG_WITH_OPER - Include operational data in the dump.
MAAPI_CONFIG_HIDE_ALL - Hide all hidden nodes (see below).
MAAPI_CONFIG_UNHIDE_ALL - Unhide all hidden nodes (see below).
MAAPI_CONFIG_WITH_SERVICE_META - Include NCS service-meta-data
attributes(refcounter, backpointer, and original-value) in the
dump.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
flags -- as above
path -- save only configuration below path
- save_config_result(...)
- save_config_result(sock, id) -> None
Verify that we received the entire configuration over the stream socket.
Keyword arguments:
sock -- a python socket instance
id -- the id returned from save_config
- set_attr(...)
- set_attr(sock, thandle, attr, v, keypath) -> None
Set attributes for a node.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
attr -- attributes to set
v -- value to set the attribute to
keypath -- path to choice
- set_comment(...)
- set_comment(sock, thandle, comment) -> None
Set the Comment that is stored in the rollback file when a transaction
towards running is committed.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
comment -- the Comment
- set_delayed_when(...)
- set_delayed_when(sock, thandle, on) -> None
This function enables (on non-zero) or disables (on == 0) the 'delayed when'
mode of a transaction.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
on -- disables when on=0, enables for all other n
- set_elem(...)
- set_elem(sock, thandle, v, path) -> None
Set element to confdValue.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
v -- confdValue
path -- position of elem
- set_elem2(...)
- set_elem(sock, thandle, strval, path) -> None
Set element to string.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
strval -- confdValue
path -- position of elem
- set_flags(...)
- set_flags(sock, thandle, flags) -> None
Modify read/write session aspect. See MAAPI_FLAG_xyz.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
flags -- flags to set
- set_label(...)
- set_label(sock, thandle, label) -> None
Set the Label that is stored in the rollback file when a transaction
towards running is committed.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
label -- the Label
- set_namespace(...)
- set_namespace(sock, thandle, hashed_ns) -> None
Indicate which namespace to use in case of ambiguities.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
hashed_ns -- the namespace to use
- set_next_user_session_id(...)
- set_next_user_session_id(sock, usessid) -> None
Set the user session id that will be assigned to the next user session
started. The given value is silently forced to be in the range 100 .. 2^31-1.
This function can be used to ensure that session ids for user sessions
started by northbound agents or via MAAPI are unique across a restart.
Keyword arguments:
sock -- a python socket instance
usessid -- user session id
- set_object(...)
- set_object(sock, thandle, values, keypath) -> None
Set leafs at path to object.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
values -- list of values
keypath -- path to set
- set_readonly_mode(...)
- set_readonly_mode(sock, flag) -> None
Control if northbound agents should be able to write or not.
Keyword arguments:
sock -- a python socket instance
flag -- non-zero means read-only mode
- set_running_db_status(...)
- set_running_db_status(sock, status) -> None
Sets the notion of consistent state of the running db.
Keyword arguments:
sock -- a python socket instance
status -- integer status to set
- set_user_session(...)
- set_user_session(sock, usessid) -> None
Associate a socket with an already existing user session.
Keyword arguments:
sock -- a python socket instance
usessid -- user session id
- set_values(...)
- set_values(sock, thandle, values, keypath) -> None
Set leafs at path to values.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
values -- list of tagValues
keypath -- path to set
- start_phase(...)
- start_phase(sock, phase, synchronous) -> None
When the system has been started in phase0, this function tells the system
to proceed to start phase 1 or 2.
Keyword arguments:
sock -- a python socket instance
phase -- phase to start, 1 or 2
synchronous -- if 1, will wait for the loading complete and return when the
loading is complete, if 0 will only initiate the loading of AAA data and
return immediately
- start_trans(...)
- start_trans(sock, name, readwrite) -> int
Creates a new transaction towards the data store specified by name, which
can be one of CONFD_CANDIDATE, CONFD_RUNNING, or CONFD_STARTUP (however
updating the startup data store is better done via
maapi_copy_running_to_startup()). The readwrite parameter can be either
CONFD_READ, to start a readonly transaction, or CONFD_READ_WRITE, to start
a read-write transaction. The function returns the transaction id.
Keyword arguments:
sock -- a python socket instance
name -- name of the database
readwrite -- CONFD_READ or CONFD_WRITE
- start_trans2(...)
- start_trans2(sock, name, readwrite, usid) -> int
Start a transaction within an existing user session, returns the transaction
id.
Keyword arguments:
sock -- a python socket instance
name -- name of the database
readwrite -- CONFD_READ or CONFD_WRITE
usid -- user session id
- start_trans_flags(...)
- start_trans_flags(sock, name, readwrite, usid) -> int
The same as start_trans2, but can also set the same flags that 'set_flags'
can set.
Keyword arguments:
sock -- a python socket instance
name -- name of the database
readwrite -- CONFD_READ or CONFD_WRITE
usid -- user session id
flags -- same as for 'set_flags'
- start_trans_flags2(...)
- start_trans_flags2(sock, name, readwrite, usid, vendor, product, version,
client_id) -> int
This function does the same as start_trans_flags() but allows for
additional information to be passed to ConfD/NCS.
Keyword arguments:
sock -- a python socket instance
name -- name of the database
readwrite -- CONFD_READ or CONFD_WRITE
usid -- user session id
flags -- same as for 'set_flags'
vendor -- vendor string (may be None)
product -- product string (may be None)
version -- version string (may be None)
client_id -- client identification string (may be None)
- start_trans_in_trans(...)
- start_trans_in_trans(sock, readwrite, usid, thandle) -> int
Start a transaction within an existing transaction, using the started
transaction as backend instead of an actual data store. Returns the
transaction id as an integer.
Keyword arguments:
sock -- a python socket instance
readwrite -- CONFD_READ or CONFD_WRITE
usid -- user session id
thandle -- identifies the backend transaction to use
- start_user_session(...)
- start_user_session(sock, username, context, groups, src_addr, prot) -> None
Establish a user session on the socket.
Keyword arguments:
sock -- a python socket instance
username -- the user for the session
context -- context for the session
groups -- groups
src-addr -- src address of e.g. the client connecting
prot -- the protocol used by the client for connecting
- start_user_session2(...)
- start_user_session2(sock, username, context, groups, src_addr, src_port, prot) -> None
Establish a user session on the socket.
Keyword arguments:
sock -- a python socket instance
username -- the user for the session
context -- context for the session
groups -- groups
src-addr -- src address of e.g. the client connecting
src-port -- src port of e.g. the client connecting
prot -- the protocol used by the client for connecting
- start_user_session3(...)
- start_user_session3(sock, username, context, groups, src_addr, src_port, prot, vendor, product, version, client_id) -> None
Establish a user session on the socket.
This function does the same as start_user_session2() but allows for
additional information to be passed to ConfD/NCS.
Keyword arguments:
sock -- a python socket instance
username -- the user for the session
context -- context for the session
groups -- groups
src-addr -- src address of e.g. the client connecting
src-port -- src port of e.g. the client connecting
prot -- the protocol used by the client for connecting
vendor -- vendor string (may be None)
product -- product string (may be None)
version -- version string (may be None)
client_id -- client identification string (may be None)
- stop(...)
- stop(sock) -> None
Request that the system stops.
Keyword arguments:
sock -- a python socket instance
- sys_message(...)
- sys_message(sock, to, message) -> None
Send a message to a specific user, a specific session or all user depending
on the 'to' parameter. 'all', <session-id> or <user-name> can be used.
Keyword arguments:
sock -- a python socket instance
to -- user to send message to or 'all' to send to all users
message -- the message
- unlock(...)
- unlock(sock, name) -> None
Unlock database with name.
Keyword arguments:
sock -- a python socket instance
name -- name of the database to unlock
- unlock_partial(...)
- unlock_partial(sock, lockid) -> None
Unlock a subset of a database which is locked by lockid.
Keyword arguments:
sock -- a python socket instance
lockid -- id of the lock
- user_message(...)
- user_message(sock, to, message, sender) -> None
Send a message to a specific user.
Keyword arguments:
sock -- a python socket instance
to -- user to send message to or 'all' to send to all users
message -- the message
sender -- send as
- validate_trans(...)
- validate_trans(sock, thandle, unlock, forcevalidation) -> None
Validates all data written in a transaction.
If unlock is 1 (or True), the transaction is open for further editing even
if validation succeeds. If unlock is 0 (or False) and the function returns
CONFD_OK, the next function to be called MUST be maapi_prepare_trans() or
maapi_finish_trans().
unlock = 1 can be used to implement a 'validate' command which can be
given in the middle of an editing session. The first thing that happens is
that a lock is set. If unlock == 1, the lock is released on success. The
lock is always released on failure.
The forcevalidation argument should normally be 0 (or False). It has no
effect for a transaction towards the running or startup data stores,
validation is always performed. For a transaction towards the candidate
data store, validation will not be done unless forcevalidation is non-zero.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
unlock -- int or bool
forcevalidation -- int or bool
- wait_start(...)
- wait_start(sock, phase) -> None
Wait for the system to reach a certain start phase (0,1 or 2).
Keyword arguments:
sock -- a python socket instance
phase -- phase to wait for, 0, 1 or 2
- xpath2kpath(...)
- xpath2kpath(sock, xpath) -> HKeypathRef
Convert an xpath to a hashed keypath.
Keyword arguments:
sock -- a python socket instance
xpath - to convert
- xpath_eval(...)
- xpath_eval(sock, thandle, expr, result, trace, path) -> None
Evaluate the xpath expression in 'expr'. For each node in the resulting
node the function 'result' is called with the keypath to the resulting
node as the first argument and, if the node is a leaf and has a value. the
value of that node as the second argument. For each invocation of 'result'
the function should return ITER_CONTINUE to tell the XPath evaluator to
continue or ITER_STOP to stop the evaluation. A trace function, 'pytrace',
could be supplied and will be called with a single string as an argument.
'None' can be used if no trace is needed. Unless a 'path' is given the
root node will be used as a context for the evaluations.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
expr -- the XPath Path expression to evaluate
result -- the result function
trace -- a trace function that takes a string as a parameter
path -- the context node
- xpath_eval_expr(...)
- xpath_eval_expr(sock, thandle, expr, trace, path) -> string
Like xpath_eval but returns a string.
Keyword arguments:
sock -- a python socket instance
thandle -- transaction handle
expr -- the XPath Path expression to evaluate
trace -- a trace function that takes a string as a parameter
path -- the context node
|