Difference between revisions of "IETF 97 Hackathon ietf-alarms model implementation for yuma123 report"

From Yuma123 Wiki
Jump to navigationJump to search
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Description==
 
==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'),..."
+
[https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-alarms/ietf-alarms%402016-10-27.yang 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==
 
==Project goals==
 
===General/Reusable standalone module and C library code===
 
===General/Reusable standalone module and C library code===
* ietf-alarms.c - implementation of ietf-alarms.yang. Handles list management container registrations etc.
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-alarms/ietf-alarms.c ietf-alarms.c] - implementation of ietf-alarms.yang. Handles list management container registrations etc.
* alarmctrl.[c,h] - device side alarm generation helper library (handles the registration of alarm entries). Simple 1 API function:
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-alarms/alarmctrl.c alarmctrl.c],[https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-alarms/alarmctrl.h alarmctrl.h] - device side alarm generation helper library (handles the registration of alarm entries). Simple 1 API function:
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:
 
ret=alarmctrl_event(resource_str, "link-alarm"/*alarm_type_id_str*/, ""/*alarm_type_qualifier_str*/, "major", "Probably someone disconnected something?!", down?1:0);
 
   
 
===Usage example code===
 
===Usage example code===
* interfaces-alarms.yang (NEW) - model defining link-alarm
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-interfaces/interfaces-alarms.yang 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
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-interfaces/interfaces-alarms.c 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
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-interfaces/interfaces-notifications.yang 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
+
* [https://sourceforge.net/p/yuma123/git/ci/master/tree/example-modules/ietf-interfaces/ietf-interfaces.c ietf-interfaces.c] (MODIFIED) - implement support for link-up and link-down when the interfaces-notifications.yang is loaded
   
 
==Usage==
 
==Usage==
 
===Starting the netconf server===
 
===Starting the netconf server===
/usr/sbin/netconfd --module=ietf-interfaces --module=interfaces-notifications --module=ietf-alarms@2016-10-27 --module=alarms-interfaces --superuser=vladimir
+
/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);
   
===Device implementation side: C API===
 
 
===User side: yangcli===
 
===User side: yangcli===
 
<nowiki>
 
<nowiki>
Line 33: Line 37:
 
alarm-type-id alarms-if:link-alarm
 
alarm-type-id alarms-if:link-alarm
 
alarm-type-qualifier
 
alarm-type-qualifier
  +
time-created 2016-11-13T05:04:11Z
  +
is-cleared false
  +
last-changed 2016-11-13T05:16:26Z
 
perceived-severity major
 
perceived-severity major
 
}
 
}
Line 39: Line 46:
 
alarm-type-id alarms-if:link-alarm
 
alarm-type-id alarms-if:link-alarm
 
alarm-type-qualifier
 
alarm-type-qualifier
  +
time-created 2016-11-13T05:04:11Z
  +
is-cleared false
  +
last-changed 2016-11-13T05:16:26Z
 
perceived-severity major
 
perceived-severity major
 
}
 
}
Line 46: Line 56:
 
}
 
}
 
</nowiki>
 
</nowiki>
  +
  +
==Feedback==
  +
* Looking good.
  +
* Had to define link-down/link-up notifications. They are not standardized.

Latest revision as of 08:16, 13 November 2016

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

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.