IETF 97 Hackathon ietf-alarms model implementation for yuma123 report
From Yuma123 Wiki
Jump to navigationJump to searchContents
Description
ietf-alarms.yang is new standards track model proposal defined in draft-vallin-netmod-alarm-module-01. Lets implement the example the description text of the module has e.g. "...('link-alarm', 'GigabitEthernet0/25'),..."
The implementation is available at sourceforge and github yuma123 repositories.
Project goals
General/Reusable standalone module and C library code
- ietf-alarms.c - implementation of ietf-alarms.yang. Handles list management container registrations etc.
- alarmctrl.c,alarmctrl.h - device side alarm generation helper library (handles the registration of alarm entries). Simple 1 API function:
Usage example code
- interfaces-alarms.yang (NEW) - model defining link-alarm
- interfaces-alarms.c (NEW) - implementation of alarms-interfaces.yang based on interception of link-up and link-down
- interfaces-notifications.yang (NEW) - define link-up and link-down
- ietf-interfaces.c (MODIFIED) - implement support for link-up and link-down when the interfaces-notifications.yang is loaded
Usage
Starting the netconf server
/usr/sbin/netconfd --module=ietf-interfaces --module=interfaces-notifications --module=ietf-alarms@2016-10-27 --module=interfaces-alarms --superuser=vladimir
Device side: Simple 1 C function API
int alarmctrl_event(char* resource_str, char* alarm_type_id_str, char* alarm_type_qualifier_str, char* severity_str, char* alarm_text_str, int enable);
Example:
alarmctrl_event("/interfaces/interface[name=\'eth0\']", "link-alarm"/*alarm_type_id_str*/, ""/*alarm_type_qualifier_str*/, "major", "Probably someone disconnected something?!", down?1:0);
User side: yangcli
yangcli vladimir@localhost> xget /alarms rpc-reply { data { alarms { alarm-list { number-of-alarms 2 alarm /interfaces/interface[name='eth0'] alarms-if:link-alarm { resource /interfaces/interface[name='eth0'] alarm-type-id alarms-if:link-alarm alarm-type-qualifier time-created 2016-11-13T05:04:11Z is-cleared false last-changed 2016-11-13T05:16:26Z perceived-severity major } alarm /interfaces/interface[name='eth1'] alarms-if:link-alarm { resource /interfaces/interface[name='eth1'] alarm-type-id alarms-if:link-alarm alarm-type-qualifier time-created 2016-11-13T05:04:11Z is-cleared false last-changed 2016-11-13T05:16:26Z perceived-severity major } } } } }
Feedback
- Looking good.
- Had to define link-down/link-up notifications. They are not standardized.