OcNOS DC : NetConf User Guide : Event Notification
Event Notification
A NetConf client registers to receive event notifications from a NetConf server by creating a subscription. The NetConf server begins notifications as events occur within the system if the subscription is successful. These event notifications will continue to be sent until either the NetConf session is terminated or the subscription terminates for some other reason.
There are four types of events supported in NetConf:
1. netconf-config-change:
2. netconf-capability-change:
3. netconf-session-start:
4. netconf-session-end:
By default the notification will not be received by the client unless the client is not subscribed.
Client Notification Subscription
To subscribe to a notification, a NetConf client should send the create-subscription RPC.
Example:
yangcli root@127.1> create-subscription
RPC OK Reply 1 for session 1:
yangcli root@127.1>
netconf-config-change
This notification is generated when the NetConf server detects that the <running> configuration data store has been changed by a management session. The notification summarizes the edits performed on the above mentioned data stores.
Steps to receive config change notification:
1. Create NetConf notification subscription (command: create-subscription).By default this will also subscribed for config-change notification.
2. Perform any of the following operations
Create
Merge
Delete
Replace
3. Do commit
4. Config change notification will be received.
5. Config change notification can be disabled for current session. (command: config-change-subscription status=disable)
6. Someone can check whether current session has been subscribed for config change notificaion. (command: show-config-change-subscription)
Notes
Config-change notification will be generated for the creation, deletion, or update of only non-leaf nodes (i.e. container, list) of YANG model.
If a leaf node is being set or unset, indicating a modification of parent non-leaf nodes (i.e., container, list), in this case, a configuration change notification will be generated for the parent non-leaf nodes (i.e., container, list) with the operation set as 'merge'.
Example
1. Create Yangcli session
2. Subscribe for notification
yangcli root@0> create-subscription
RPC OK Reply 4 for session 1
By default, this will also subscribed for config-change notification.
3. Someone can check whether current session has been subscribed for config change notification
yangcli root@0> show-config-change-subscription
RPC Data Reply 6 for session 1:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<status xmlns="http://ipinfusion.com/ns/zebmcli">ENABLED</status>
</rpc-reply>
4. Do some configuration
(config)#interface eth3
(config-if)#shut
(config-if)#commit
Config-change notification will be received
5. Config change notification will be received
yangcli root@0>
Incoming notification:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
<eventTime>2021-11-29T10:02:45Z</eventTime>
<netconf-config-change xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications">
<changed-by>
<username>root</username>
<session-id>0</session-id>
</changed-by>
<datastore>running</datastore>
<edit>
<target>/interfaces/interface[name='eth3']/config</target>
<operation>merge</operation>
</edit>
</netconf-config-change>
</notification>
netconf-capability-change
This notification is generated when the NetConf server detects that the <running> or <startup> configuration data store has been changed by a management session. The notification summarizes the edits performed on the above mentioned data stores.
Note: Currently this kind of event notification is not supported.
notification {
eventTime 2017-10-24T12:23:42Z
sysCapabilityChange {
changed-by {
userName root
sessionId 1
remoteHost 127.0.0.1
}
added-capability http://netconfcentral.org/ns/toaster?module=toaster&revision=2009-11-20
}
}
netconf-session-start
This notification is generated when a NetConf server detects client session start. Information present in this notification indicates the identity of the user.
notification {
eventTime 2019-03-09T08:16:20Z
severity info
eventClass message
sysSessionStart {
sessionId 6
remoteHost 10.12.47.71
}
}
netconf-session-end
This notification is generated when a NetConf server detects client session termination. Information present in this notification indicates the identity of the user that owned the session, and why the session was terminated.
notification {
eventTime 2019-03-09T08:18:55Z
severity info
eventClass message
sysSessionEnd {
userName ocnos
sessionId 7
remoteHost 10.12.47.71
terminationReason closed
}
}
 
notification {
eventTime 2019-03-09T08:19:36Z
severity info
eventClass message
sysSessionEnd {
userName ocnos
sessionId 8
remoteHost 10.12.47.71
killedBy 5
terminationReason killed
}
}