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

From Yuma123 Wiki
Jump to navigationJump to search
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'),..."
The work on this project should help validate hands-on the latest state of the ietf-alarms model. Provide an opensource implementation and yield a report that can be taken into account in the further acceptance of the model.
 
  +
 
==Project goals==
 
==Project goals==
  +
===General/Reusable standalone module and C library code===
* ietf-alarms.c - implementation of ietf-alarms.yang allowing:
 
  +
* ietf-alarms.c - implementation of ietf-alarms.yang. Handles list management container registrations etc.
** ...
 
* alarms-simulator.yang - test model to simulate generation of alarm events featuring:
+
* alarmctrl.[c,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:
* alarms-simulator.c - implementation of alarms-simulator.yang
 
  +
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===
  +
* 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
   
==Usecases==
+
==Usage==
  +
===Starting the netconf server===
The ietf-alarms and alarms-simulator loadable modules will allow going through different usage scenarios:
 
/usr/sbin/netconfd --module=ietf-alarms --module=alarms-simulator
+
/usr/sbin/netconfd --module=ietf-interfaces --module=interfaces-notifications --module=ietf-alarms@2016-10-27 --module=alarms-interfaces --superuser=vladimir
   
  +
===Device implementation side: C API===
... yangcli will be used for interaction.
 
  +
===User side: yangcli===
  +
<nowiki>
  +
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
  +
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
  +
perceived-severity major
  +
}
  +
}
  +
}
  +
}
  +
}
  +
</nowiki>

Revision as of 05:33, 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'),..."

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,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

  • 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=alarms-interfaces --superuser=vladimir

Device implementation side: C API

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 
          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 
          perceived-severity major
        }
      }
    }
  }
}