| |
- diff_notification_done(...)
- diff_notification_done(sock, tctx) -> None
If the received event was NOTIF_COMMIT_DIFF it is important that we call
this function when we are done reading the transaction diffs over MAAPI.
The transaction is hanging until this function gets called. This function
also releases memory associated to the transaction in the library.
Keyword arguments:
sock -- a previously connected notification socket
tctx -- a transaction context
- notifications_connect(...)
- notifications_connect(sock, mask, ip, port, path) -> None
This function creates a notification socket.
Keyword arguments:
sock -- a Python socket instance
mask -- a bitmask of one or several notification type values
ip -- the ip address if socket is AF_INET (optional)
port -- the port if socket is AF_INET (optional)
path -- a filename if socket is AF_UNIX (optional).
- notifications_connect2(...)
- notifications_connect2(sock, mask, data, ip, port, path) -> None
This variant of notifications_connect is required if we wish to subscribe
to NOTIF_HEARTBEAT, NOTIF_HEALTH_CHECK, or NOTIF_STREAM_EVENT events.
Keyword arguments:
sock -- a Python socket instance
mask -- a bitmask of one or several notification type values
data -- a _events.NotificationsData instance
ip -- the ip address if socket is AF_INET (optional)
port -- the port if socket is AF_INET (optional)
path -- a filename if socket is AF_UNIX (optional)
- read_notification(...)
- read_notification(sock) -> dict
The application is responsible for polling the notification socket. Once
data is available to be read on the socket the application must call
read_notification() to read the data from the socket. On success a
dictionary containing notification information will be returned (see below).
Keyword arguments:
sock -- a previously connected notification socket
On success the returned dict will contain information corresponding to the
c struct confd_notification. The notification type is accessible through
the 'type' key. The remaining information will be different depending on
which type of notification this is (described below).
Keys for type NOTIF_AUDIT (struct confd_audit_notification):
logno
user
msg
usid
Keys for type NOTIF_DAEMON, NOTIF_NETCONF, NOTIF_DEVEL or
NOTIF_TAKEOVER_SYSLOG (struct confd_syslog_notification):
prio
logno
msg
Keys for type NOTIF_COMMIT_SIMPLE (struct confd_commit_notification):
database
diff_available
flags
uinfo
Keys for type NOTIF_COMMIT_DIFF (struct confd_commit_diff_notification):
database
flags
uinfo
tctx
Keys for type NOTIF_USER_SESSION (struct confd_user_sess_notification):
type
uinfo
database
Keys for type NOTIF_HA_INFO (struct confd_ha_notification):
type (1)
nomaster - if (1) is HA_INFO_NOMASTER
slave_died - if (1) is HA_INFO_SLAVE_DIED (see below)
slave_arrived - if (1) is HA_INFO_SLAVE_ARRIVED (see below)
cb_initialized_by_copy - if (1) is HA_INFO_SLAVA_INITIALIZED
beslave_result - if (1) is HA_INFO_BESLAVE_RESULT
If slave_died or slave_arrived is present they will in turn contain a
dictinary with the following keys:
nodeid
af (1)
ip4 - if (1) is AF_INET
ip6 - if (1) is AF_INET6
str - if (1) if AF_UNSPEC
Keys for type NOTIF_SUBAGENT_INFO (struct confd_subagent_notification):
type
name
Keys for type NOTIF_COMMIT_FAILED (struct confd_commit_failed_notification):
provider (1)
dbname
port - if (1) is DP_NETCONF
af (2) - if (1) is DP_NETCONF
ip4 - if (2) is AF_INET
ip6 - if (2) is AF_INET6
daemon_name - if (1) is DP_EXTERNAL
Keys for type NOTIF_SNMPA (struct confd_snmpa_notification):
pdu_type (1)
request_id
error_status
error_index
port
af (2)
ip4 - if (3) is AF_INET
ip6 - if (3) is AF_INET6
vb (optional)
generic_trap - if (1) is SNMPA_PDU_V1TRAP
specific_trap - if (1) is SNMPA_PDU_V1TRAP
time_stamp - if (1) is SNMPA_PDU_V1TRAP
enterprise - if (1) is SNMPA_PDU_V1TRAP (optional)
Keys for type NOTIF_FORWARD_INFO (struct confd_forward_notification):
type
target
uinfo
Keys for type NOTIF_CONFIRMED_COMMIT
(struct confd_confirmed_commit_notification):
type
timeout
uinfo
Keys for type NOTIF_UPGRADE_EVENT (struct confd_upgrade_notification):
event
Keys for type NOTIF_COMMIT_PROGRESS (struct confd_progress_notification):
database
usid
thandle
msg
Keys for type NOTIF_STREAM_EVENT (struct confd_stream_notification):
type (1)
error - if (1) is STREAM_REPLAY_FAILED
event_time - if (1) is STREAM_NOTIFICATION_EVENT
values - if (1) is STREAM_NOTIFICATION_EVENT
Keys for type NOTIF_CQ_PROGRESS (struct ncs_cq_progress_notification):
type
timestamp
cq_tag
cq_id
completed_devices (optional)
transient_devices (optional)
failed_devices (optional)
failed_reasons - if failed_devices is present
- sync_audit_notification(...)
- sync_audit_notification(sock, usid) -> None
If the received event was NOTIF_AUDIT, and we are subscribing to
notifications with the flag NOTIF_AUDIT_SYNC, this function must be called
when we are done processing the notification. The user session is hanging
until this function gets called.
Keyword arguments:
sock -- a previously connected notification socket
usid -- the user session id
- sync_ha_notification(...)
- sync_ha_notification(sock) -> None
If the received event was NOTIF_HA_INFO, and we are subscribing to
notifications with the flag NOTIF_HA_INFO_SYNC, this function must be
called when we are done processing the notification. All HA processing is
blocked until this function gets called.
Keyword arguments:
sock -- a previously connected notification socket
|