ConfD User Community

Netconf - Sending notification which include identity Statement

Hi Community,

I’m trying to build a POC application that sends notification to a Netconf stream.
I’m using the standard ietf-alarms.yang model where alarm-type-id is defined as identity.
The model also define ‘notification alarm-notification’ which is what I’m trying to use.

I have the following code which try to build the notification XML:

static void send_notifalarm()
    confd_tag_value_t vals[7];
    int i = 0;

    struct confd_identityref idref; = al_alarm_type_id;
    idref.ns = al__ns;

    CONFD_SET_TAG_XMLBEGIN(&vals[i], al_alarm_notification,       al__ns);  i++;
    CONFD_SET_TAG_STR(&vals[i], al_resource,  "//object=mcp-1800//slot=msa");  i++;
    CONFD_SET_TAG_IDENTITYREF(&vals[i], al_alarm_type_id, idref);  i++;
    CONFD_SET_TAG_STR(&vals[i], al_alarm_type_qualifier,  "NE-1800");  i++;
    CONFD_SET_TAG_ENUM_VALUE(&vals[i], al_perceived_severity,  3);  i++;
    CONFD_SET_TAG_STR(&vals[i], al_alarm_text,  "Hello my first alarm in Muse!");  i++;
    CONFD_SET_TAG_XMLEND(&vals[i],   al_alarm_notification, al__ns);  i++;
    send_notification(vals, i);

However, when sending the notification, in the devel.log I see the following error:
26-Jan-2020::20:45:56.495 localhost confd[11470]: devel-c Failed to send notification for stream notif: /alarm-notification/alarm-type-id: {44,{1913099140,1821525234}}: “al:alarm-type-id” is not a valid value.

I read through the RFCs/ConfD User Guide/WWW and many more resources but could not understand how do I need to fill alarm-type-id correctly in the notification (XML).

Any help will be appreciated.


You’re very close.:slight_smile: The RFCs (specifically say:

   Valid values for an identityref are any identities derived from all
   the identityref's base identities.  On a particular server, the valid
   values are further restricted to the set of identities defined in the
   modules implemented by the server.

Note the “derived from” - i.e. the value must be an identity derived from the identity alarm-type-id defined in ietf-alarms - not that identity itself. If you were writing actual code, this would be pretty obvious - the value is supposed to identify a specific type of alarm, and alarm-type-id doesn’t do that.

So, you need to add, probably in a YANG module of your own, something like:

  identity bad-stuff-alarm {
    base al:alarm-type-id;

And then use that identity in your notification, and it should work. RFC 8632, which defines ietf-alarms.yang, also includes a module example-xyz-alarms.yang (in Appendix A) which shows more sophisticated use of identity definitions.

Thanks! Very useful and solved my initial challenge.