The device uses NETCONF to report alarms or events to the NMS through notifications, facilitating device management by the NMS. You can perform the <create-subscription> operation to subscribe to device alarms or events. If the <rpc-reply> element returned by the device contains an <ok> element, the <create-subscription> operation is successful, and the device will proactively report its alarms or events through NETCONF to the NMS.
Long-term subscription: After the subscription is successful, if the <startTime> element is specified in the subscription packet, the device sends the historical alarms or events to the NMS and then sends a <replayComplete> packet to notify the NMS that replay is complete. If a new alarm or events is generated on the device, the device also sends the alarm or events to the NMS. If the <startTime> element is not specified in the subscription packet, the device sends all generated alarms or events to the NMS. After a NETCONF session is terminated, the subscription is automatically canceled.
Subscription within a specified period: After the subscription is successful, the device sends the alarms or events that are generated from the start time to the end time and meet the filtering conditions to the NMS. Because the <startTime> element is specified in the subscription packet, the device sends historical alarms or events to the NMS and then sends a <replayComplete> packet to notify the NMS that the replay is complete. When the specified <stopTime> arrives, the NETCONF module sends a <notificationComplete> packet to notify the NMS that the subscription is terminated.
Historical alarms or events refer to alarms or events generated from the <startTime> specified in the subscription packet to when the user performs the subscription operation.
The format of the subscription packet sent by the device to the NMS is as follows. If <stopTime> is not specified, the subscription is a long-term one. If both <startTime> and <stopTime> are specified, the subscription is within a specified period.
Reply example:
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <create-subscription xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <stream>NETCONF</stream> <filter type="subtree"> <hwCPUUtilizationRisingAlarm xmlns="urn:huawei:yang:huawei-sem" /> </filter> <startTime>2016-10-20T14:50:00Z</startTime> <stopTime>2016-10-23T06:22:04Z</stopTime> </create-subscription> </rpc>
Response example:
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <ok/> </rpc-reply>
Element |
Description |
Value Range |
Mandatory |
Restriction |
---|---|---|---|---|
stream |
Event flow type |
The value is an enumerated type and case-sensitive. The value is NETCONF, indicating that the NETCONF notification mechanism is used to report alarms or events. |
N |
N/A |
filter |
Alarm or event filter |
The value is a string of characters in the format of < alarm name xmlns=name space of the alarm name/> or < event name xmlns=name space of the event name/>. |
N |
If no filter is specified, all alarms or events that can be reported through notifications are subscribed to. |
startTime |
Start time |
The value is in the time format. |
N |
The start time must be earlier than the time when the subscription operation is performed. |
stopTime |
End time |
The value is in the time format. |
N |
The end time must be later than the start time. |
2. After the subscription is successful, the device encapsulates the alarm and event information into notification messages and sends them to the NMS. The Notification message format is as follows:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <eventTime>2016-11-26T13:51:00Z</eventTime> <hwCPUUtilizationResume xmlns="urn:huawei:yang:huawei-sem"> <TrapSeverity>0</TrapSeverity> <ProbableCause>0</ProbableCause> <EventType>0</EventType> <PhysicalIndex>0</PhysicalIndex> <PhysicalName>SimulateStringData</PhysicalName> <RelativeResource>SimulateStringData</RelativeResource> <UsageType>0</UsageType> <SubIndex>0</SubIndex> <CpuUsage>0</CpuUsage> <Unit>0</Unit> <CpuUsageThreshold>0</CpuUsageThreshold> </hwCPUUtilizationResume> </notification>
After historical alarms or events are reported to the NMS, the NETCONF module sends a replayComplete packet to the NMS. The format of the replayComplete packet is as follows:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <eventTime>2016-11-29T11:57:15Z</eventTime> <replayComplete xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0" /> </notification>
When the <stopTime> specified in the subscription packet arrives, the NETCONF module sends a notification message to notify the NMS that the subscription is terminated. The format of the notificationComplete packet is as follows:
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <eventTime>2016-11-29T11:57:25Z</eventTime> <notificationComplete xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0" /> </notification>
Element |
Description |
Value Range |
Mandatory |
Restriction |
---|---|---|---|---|
replayComplete |
After historical alarms or events are reported to the NMS, the NETCONF module sends a replayComplete packet to the NMS. |
N/A |
N |
N/A |
notificationComplete |
At the specified <stopTime>, the NETCONF module sends a NotificationComplete packet to notify the NMS of subscription termination. |
N/A |
N |
N/A |