module ietf-event-notifications {
namespace
"urn:ietf:params:xml:ns:yang:ietf-event-notifications";
// TODO: examples in the draft consider the namespace below
// which follows the namespace format in 5277
// "urn:ietf:params:xml:ns:netconf:notification:1.1";
prefix notif-bis;
import ietf-inet-types {
prefix inet;
}
import ietf-5277-netmod {
prefix netmod-notif;
}
import ietf-5277-netconf {
prefix notif;
}
import ietf-interfaces {
prefix if;
}
organization "IETF";
contact
"WG Web:
WG List:
WG Chair: Mahesh Jethanandani
WG Chair: Mehmet Ersue
Editor: Alberto Gonzalez Prieto
Editor: Alexander Clemm
Editor: Eric Voit
Editor: Einar Nilsen-Nygaard
Editor: Ambika Prasad Tripathy
";
description
"This module contains conceptual YANG specifications
for NETCONF Event Notifications.";
revision 2016-03-21 {
description
"Initial version. Model for NETCONF Notifications (bis)";
reference
"RFC XXXX: NETCONF Event Notifications";
}
/*
* FEATURES
*/
feature json {
description
"This feature indicates that JSON encoding of notifications
is supported.";
}
feature configured-subscriptions {
description
"This feature indicates that management plane configuration
of subscription is supported.";
}
/*
* IDENTITIES
*/
/* Identities for subscription results */
identity subscription-result {
description
"Base identity for RPC responses to requests surrounding
management (e.g. creation, modification) of
subscriptions.";
}
identity ok {
base subscription-result;
description
"OK - RPC was successful and was performed as requested.";
}
identity error {
base subscription-result;
description
"RPC was not successful.
Base identity for error return codes.";
}
identity error-no-such-subscription {
base error;
description
"A subscription with the requested subscription ID
does not exist.";
}
identity error-no-such-option {
base error;
description
"A requested parameter setting is not supported.";
}
identity error-insufficient-resources {
base error;
description
"The server has insufficient resources to support the
subscription as requested.";
}
/* Identities for subscription stream status */
identity subscription-stream-status {
description
"Base identity for the status of subscriptions and
datastreams.";
}
identity active {
base subscription-stream-status;
description
"Status is active and healthy.";
}
identity inactive {
base subscription-stream-status;
description
"Status is inactive, for example outside the
interval between start time and stop time.";
}
identity in-error {
base subscription-stream-status;
description
"The status is in error or degraded, meaning that
stream and/or subscription is currently unable to provide
the negotiated notifications.";
}
/* Identities for subscription errors */
identity subscription-errors {
description
"Base identity for subscription error status.
This identity is not to be confused with error return
codes for RPCs";
}
identity internal-error {
base subscription-errors;
description
"Subscription failures caused by server internal error.";
}
identity no-resources {
base subscription-errors;
description
"Lack of resources, e.g. CPU, memory, bandwidth";
}
identity subscription-deleted {
base subscription-errors;
description
"The subscription was terminated because the subscription
was deleted.";
}
/* Identities for encodings */
identity encodings {
description
"Base identity to represent data encodings";
}
identity encode-xml {
base encodings;
description
"Encode data using XML";
}
identity encode-json {
base encodings;
description
"Encode data using JSON";
}
/* Identities for transports */
identity transport {
description
"An identity that represents a transport protocol for event
notifications";
}
identity netconf {
base transport;
description
"Netconf notifications as a transport.";
}
/*
* TYPEDEFs
*/
typedef subscription-id {
type uint32;
description
"A type for subscription identifiers.";
}
typedef filter-id {
type uint32;
description
"A type to identify filters which can be associated with a
subscription.";
}
typedef subscription-result {
type identityref {
base subscription-result;
}
description
"The result of a subscription operation";
}
typedef subscription-term-reason {
type identityref {
base subscription-errors;
}
description
"Reason for a server to terminate a subscription.";
}
typedef subscription-susp-reason {
type identityref {
base subscription-errors;
}
description
"Reason for a server to suspend a subscription.";
}
typedef encoding {
type identityref {
base encodings;
}
description
"Specifies a data encoding, e.g. for a data subscription.";
}
typedef transport-protocol {
type identityref {
base transport;
}
description
"Specifies transport protocol used to send notifications to a
receiver.";
}
typedef push-source {
type enumeration {
enum "interface-originated" {
description
"Notifications will be sent from a specific interface on a
NETCONF server";
}
enum "address-originated" {
description
"Notifications will be sent from a specific address on a
NETCONF server";
}
}
description
"Specifies from where notifications will be sourced when
being sent by the NETCONF server.";
}
typedef stream-ref {
type leafref {
path "/netmod-notif:netconf/netmod-notif:streams/" +
"netmod-notif:stream/netmod-notif:name";
}
description
"This type is used to reference a stream.";
}
typedef filter-ref {
type leafref {
path "/notif-bis:filters/notif-bis:filter/notif-bis:filter-id";
}
description
"This type is used to reference a filter.";
}
/*
* GROUPINGS
*/
grouping subscription-info {
description
"This grouping describes basic information concerning a
subscription.";
uses notif:subscription-info-5277 {
augment "filter-type" {
description
"Post-5277 subscriptions allow references to existing
filters";
case by-reference {
description
"Incorporate a filter that has been configured
separately.";
leaf filter-ref {
type filter-ref;
description
"References filter which is associated with the
subscription.";
}
}
}
}
leaf encoding {
type encoding;
default "encode-xml";
description
"The type of encoding for the subscribed data.
Default is XML";
}
}
grouping push-source-info {
description
"Defines the sender source from which notifications
for a configured subscription are sent.";
choice push-source {
description
"Identifies the egress interface on the Publisher from
which notifications will or are being sent.";
case interface-originated {
description
"When the push source is out of an interface on the
Publisher established via static configuration.";
leaf source-interface {
type if:interface-ref;
description
"References the interface for notifications.";
}
}
case address-originated {
description
"When the push source is out of an IP address on the
Publisher established via static configuration.";
leaf source-vrf {
type uint32 {
range "16..1048574";
}
description
"Label of the vrf.";
}
leaf source-address {
type inet:ip-address-no-zone;
mandatory true;
description
"The source address for the notifications.";
}
}
}
}
grouping receiver-info {
description
"Defines where and how to deliver notifications for a
configured subscription. This includes
specifying the receiver, as well as defining
any network and transport aspects when sending of
notifications occurs outside of Netconf.";
container receivers {
description
"Set of receivers in a subscription.";
list receiver {
key "address";
min-elements 1;
description
"A single host or multipoint address intended as a target
for the notifications for a subscription.";
leaf address {
type inet:host;
mandatory true;
description
"Specifies the address for the traffic to reach a
remote host. One of the following must be
specified: an ipv4 address, an ipv6 address,
or a host name.";
}
leaf port {
type inet:port-number;
mandatory true;
description
"This leaf specifies the port number to use for messages
destined for a receiver.";
}
leaf protocol {
type transport-protocol;
default "netconf";
description
"This leaf specifies the transport protocol used
to deliver messages destined for the receiver.";
}
}
}
}
grouping subscription-response {
description
"Defines the output to the rpc's establish-subscription
and modify-subscription.";
leaf subscription-result {
type subscription-result;
mandatory true;
description
"Indicates whether subscription is operational,
or if a problem was encountered.";
}
choice result {
description
"Depending on the subscription result, different
data is returned.";
case success {
description
"This case is used when the subscription request
was successful and a subscription was created/modified
as a result";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"Identifier used for this subscription.";
}
}
case no-success {
description
"This case applies when a subscription request
was not successful and no subscription was
created (or modified) as a result. In this case,
information MAY be returned that indicates
suggested parameter settings that would have a
high likelihood of succeeding in a subsequent
establish-subscription or modify-subscription
request.";
uses subscription-info;
}
}
}
/*
* RPCs
*/
rpc establish-subscription {
description
"This RPC allows a subscriber to create
(and possibly negotiate) a subscription on its own behalf.
If successful, the subscription
remains in effect for the duration of the subscriber's
association with the publisher, or until the subscription
is terminated by virtue of a delete-subscription request.
In case an error (as indicated by subscription-result)
is returned, the subscription is
not created. In that case, the RPC output
MAY include suggested parameter settings
that would have a high likelihood of succeeding in a
subsequent create-subscription request.";
input {
uses subscription-info;
}
output {
uses subscription-response;
}
}
rpc modify-subscription {
description
"This RPC allows a subscriber to modify a subscription
that was previously created using create-subscription.
If successful, the subscription
remains in effect for the duration of the subscriber's
association with the publisher, or until the subscription
is terminated by virtue of a delete-subscription request.
In case an error is returned (as indicated by
subscription-result), the subscription is
not modified and the original subscription parameters
remain in effect. In that case, the rpc error response
MAY include suggested parameter settings
that would have a high likelihood of succeeding in a
subsequent modify-subscription request.";
input {
leaf subscription-id {
type subscription-id;
description
"Identifier to use for this subscription.";
}
uses subscription-info;
}
output {
leaf subscription-result {
type subscription-result;
mandatory true;
description
"Indicates whether subscription was modified
or if a problem was encountered.
In case the subscription-result has a value
other than OK, the original subscription was not
changed.";
}
uses subscription-info;
}
}
rpc delete-subscription {
description
"This RPC allows a subscriber to delete a subscription that
was previously created using create-subscription.";
input {
leaf subscription-id {
type subscription-id;
description
"Identifier of the subscription that is to be deleted.
Only subscriptions that were created using
create-subscription can be deleted via this RPC.";
}
}
}
/*
* NOTIFICATIONS
*/
notification subscription-started {
netmod-notif:control-plane-notif;
description
"This notification indicates that a subscription has
started and notifications are beginning to be sent.
This notification shall only be sent to receivers
of a subscription; it does not constitute a general-purpose
notification.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
uses subscription-info;
}
notification subscription-suspended {
netmod-notif:control-plane-notif;
description
"This notification indicates that a suspension of the
subscription by the server has occurred. No further
notifications will be sent until subscription
resumes.
This notification shall only be sent to receivers
of a subscription; it does not constitute a general-purpose
notification.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
leaf reason {
type subscription-susp-reason;
description
"Provides a reason for why the subscription was
suspended.";
}
}
notification subscription-resumed {
netmod-notif:control-plane-notif;
description
"This notification indicates that a subscription that had
previously been suspended has resumed. Notifications
will once again be sent.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
}
notification subscription-modified {
netmod-notif:control-plane-notif;
description
"This notification indicates that a subscription has
been modified. Notifications sent from this point
on will conform to the modified terms of the
subscription.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
uses subscription-info;
}
notification subscription-terminated {
netmod-notif:control-plane-notif;
description
"This notification indicates that a subscription has been
terminated.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
leaf reason {
type subscription-term-reason;
description
"Provides a reason for why the subscription was
terminated.";
}
}
notification added-to-subscription {
netmod-notif:control-plane-notif;
description
"This notification is sent to a receiver when it has been
added to an existing subscription.
Note that if the receiver is added when the subscription
is created, it will receive a subscription-started
notification and no added-to-subscription.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
uses subscription-info;
}
notification removed-from-subscription {
netmod-notif:control-plane-notif;
description
"This notification is sent to a receiver when it has been
removed from an existing subscription.
Note that if the subscription is terminated, the receiver
will receive a subscription-terminated notification
and no removed-from-subscription.";
leaf subscription-id {
type subscription-id;
mandatory true;
description
"This references the affected subscription.";
}
}
augment /netmod-notif:replayComplete {
description
"Augmenting the definition in RFC-5277 to include the
subscription identifier defined in 5277-bis";
leaf subscription-id {
type subscription-id;
description
"This references the affected subscription.
Not present for created subscriptions for backwards
compatibility.";
}
}
augment /netmod-notif:notificationComplete {
description
"Augmenting the definition in RFC-5277 to include the
subscription identifier defined in 5277-bis";
leaf subscription-id {
type subscription-id;
description
"This references the affected subscription.
Not present for created subscriptions for backwards
compatibility.";
}
}
/*
* DATA NODES
*/
container filters {
description
"This container contains a list of configurable filters
that can be applied to subscriptions. This facilitates
the reuse of complex filters once defined.";
list filter {
key "filter-id";
description
"A list of configurable filters that can be applied to
subscriptions.";
leaf filter-id {
type filter-id;
description
"An identifier to differentiate between filters.";
}
uses notif:base-filter;
}
}
container subscription-config {
if-feature "configured-subscriptions";
description
"Contains the list of subscriptions that are configured,
as opposed to established via RPC or other means.";
list subscription {
key "subscription-id";
description
"Content of a subscription.";
leaf subscription-id {
type subscription-id;
description
"Identifier to use for this subscription.";
}
uses subscription-info;
uses receiver-info {
if-feature "configured-subscriptions";
}
uses push-source-info {
if-feature "configured-subscriptions";
}
}
}
container subscriptions {
config false;
description
"Contains the list of currently active subscriptions,
i.e. subscriptions that are currently in effect,
used for subscription management and monitoring purposes.
This includes subscriptions that have been setup via RPC
primitives, e.g. create-subscription, delete-subscription,
and modify-subscription, as well as subscriptions that
have been established via configuration.";
list subscriptions {
key "subscription-id";
config false;
description
"Content of a subscription.
Subscriptions can be created using a control channel
or RPC, or be established through configuration.";
leaf subscription-id {
type subscription-id;
description
"Identifier of this subscription.";
}
choice subscription-type {
description
"This choice contains a set of flags to indicate
the type of subscription.";
case via-configuration {
leaf configured-subscription {
if-feature "configured-subscriptions";
type empty;
description
"The presence of this leaf indicates that the
subscription originated from configuration, not
through a control channel or RPC.";
}
}
case created-via-RPC {
leaf created-subscription {
type empty;
description
"The presence of this leaf indicates that the
subscription originated via RPC using RFC5277
mechanisms and semantics.";
}
}
}
leaf subscription-status {
type identityref {
base subscription-stream-status;
}
description
"The status of the subscription.";
}
uses subscription-info;
uses receiver-info {
if-feature "configured-subscriptions";
}
uses push-source-info {
if-feature "configured-subscriptions";
}
}
}
augment /netmod-notif:netconf/netmod-notif:streams {
description
"Augmenting the definition in RFC-5277 to so that streams
can opt out the default stream.";
leaf exclude-from-NETCONF-stream {
type empty;
description
"Indicates that the stream should not be part of the
default stream.";
}
}
}