<?xml version="1.0" encoding="UTF-8"?>
<module name="ietf-netconf-notifications"
        xmlns="urn:ietf:params:xml:ns:yang:yin:1"
        xmlns:ncn="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications"
        xmlns:inet="urn:ietf:params:xml:ns:yang:ietf-inet-types"
        xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <namespace uri="urn:ietf:params:xml:ns:yang:ietf-netconf-notifications"/>
  <prefix value="ncn"/>
  <import module="ietf-inet-types">
    <prefix value="inet"/>
  </import>
  <import module="ietf-netconf">
    <prefix value="nc"/>
  </import>
  <organization>
    <text>IETF NETCONF (Network Configuration Protocol) Working Group</text>
  </organization>
  <contact>
    <text>WG Web:   &lt;http://tools.ietf.org/wg/netconf/&gt;
WG List:  &lt;mailto:netconf@ietf.org&gt;

WG Chair: Bert Wijnen
          &lt;mailto:bertietf@bwijnen.net&gt;

WG Chair: Mehmet Ersue
          &lt;mailto:mehmet.ersue@nsn.com&gt;

Editor:   Andy Bierman
          &lt;mailto:andy@netconfcentral.org&gt;</text>
  </contact>
  <description>
    <text>This module defines a YANG data model for use with the
NETCONF protocol that allows the NETCONF client to
receive common NETCONF base event notifications.

Copyright (c) 2012 IETF Trust and the persons identified as
the document authors.  All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, is permitted pursuant to, and subject
to the license terms contained in, the Simplified BSD License



set forth in Section 4.c of the IETF Trust's Legal Provisions
Relating to IETF Documents
(http://trustee.ietf.org/license-info).

This version of this YANG module is part of RFC 6470; see
the RFC itself for full legal notices.</text>
  </description>
  <revision date="2012-02-06">
    <description>
      <text>Initial version.</text>
    </description>
    <reference>
      <text>RFC 6470: NETCONF Base Notifications</text>
    </reference>
  </revision>
  <grouping name="common-session-parms">
    <description>
      <text>Common session parameters to identify a
management session.</text>
    </description>
    <leaf name="username">
      <type name="string"/>
      <mandatory value="true"/>
      <description>
        <text>Name of the user for the session.</text>
      </description>
    </leaf>
    <leaf name="session-id">
      <type name="nc:session-id-or-zero-type"/>
      <mandatory value="true"/>
      <description>
        <text>Identifier of the session.
A NETCONF session MUST be identified by a non-zero value.
A non-NETCONF session MAY be identified by the value zero.</text>
      </description>
    </leaf>
    <leaf name="source-host">
      <type name="inet:ip-address"/>
      <description>
        <text>Address of the remote host for the session.</text>
      </description>
    </leaf>
  </grouping>
  <grouping name="changed-by-parms">
    <description>
      <text>Common parameters to identify the source
of a change event, such as a configuration
or capability change.</text>
    </description>
    <container name="changed-by">
      <description>
        <text>Indicates the source of the change.
If caused by internal action, then the
empty leaf 'server' will be present.
If caused by a management session, then
the name, remote host address, and session ID
of the session that made the change will be reported.</text>
      </description>
      <choice name="server-or-user">
        <mandatory value="true"/>
        <leaf name="server">
          <type name="empty"/>
          <description>
            <text>If present, the change was caused
by the server.</text>
          </description>
        </leaf>
        <case name="by-user">
          <uses name="common-session-parms"/>
        </case>
      </choice>
    </container>
  </grouping>
  <notification name="netconf-config-change">
    <description>
      <text>Generated when the NETCONF server detects that the
&lt;running&gt; or &lt;startup&gt; configuration datastore
has been changed by a management session.
The notification summarizes the edits that
have been detected.

The server MAY choose to also generate this
notification while loading a datastore during the
boot process for the device.</text>
    </description>
    <uses name="changed-by-parms"/>
    <leaf name="datastore">
      <type name="enumeration">
        <enum name="running">
          <description>
            <text>The &lt;running&gt; datastore has changed.</text>
          </description>
        </enum>
        <enum name="startup">
          <description>
            <text>The &lt;startup&gt; datastore has changed</text>
          </description>
        </enum>
      </type>
      <default value="running"/>
      <description>
        <text>Indicates which configuration datastore has changed.</text>
      </description>
    </leaf>
    <list name="edit">
      <description>
        <text>An edit record SHOULD be present for each distinct
edit operation that the server has detected on
the target datastore.  This list MAY be omitted
if the detailed edit operations are not known.
The server MAY report entries in this list for
changes not made by a NETCONF session (e.g., CLI).</text>
      </description>
      <leaf name="target">
        <type name="instance-identifier"/>
        <description>
          <text>Topmost node associated with the configuration change.
A server SHOULD set this object to the node within
the datastore that is being altered.  A server MAY
set this object to one of the ancestors of the actual
node that was changed, or omit this object, if the
exact node is not known.</text>
        </description>
      </leaf>
      <leaf name="operation">
        <type name="nc:edit-operation-type"/>
        <description>
          <text>Type of edit operation performed.
A server MUST set this object to the NETCONF edit
operation performed on the target datastore.</text>
        </description>
      </leaf>
    </list>
  </notification>
  <notification name="netconf-capability-change">
    <description>
      <text>Generated when the NETCONF server detects that
the server capabilities have changed.
Indicates which capabilities have been added, deleted,
and/or modified.  The manner in which a server
capability is changed is outside the scope of this
document.</text>
    </description>
    <uses name="changed-by-parms"/>
    <leaf-list name="added-capability">
      <type name="inet:uri"/>
      <description>
        <text>List of capabilities that have just been added.</text>
      </description>
    </leaf-list>
    <leaf-list name="deleted-capability">
      <type name="inet:uri"/>
      <description>
        <text>List of capabilities that have just been deleted.</text>
      </description>
    </leaf-list>
    <leaf-list name="modified-capability">
      <type name="inet:uri"/>
      <description>
        <text>List of capabilities that have just been modified.
A capability is considered to be modified if the
base URI for the capability has not changed, but
one or more of the parameters encoded at the end of
the capability URI have changed.
The new modified value of the complete URI is returned.</text>
      </description>
    </leaf-list>
  </notification>
  <notification name="netconf-session-start">
    <description>
      <text>Generated when a NETCONF server detects that a
NETCONF session has started.  A server MAY generate
this event for non-NETCONF management sessions.
Indicates the identity of the user that started
the session.</text>
    </description>
    <uses name="common-session-parms"/>
  </notification>
  <notification name="netconf-session-end">
    <description>
      <text>Generated when a NETCONF server detects that a
NETCONF session has terminated.
A server MAY optionally generate this event for
non-NETCONF management sessions.  Indicates the
identity of the user that owned the session,
and why the session was terminated.</text>
    </description>
    <uses name="common-session-parms"/>
    <leaf name="killed-by">
      <when condition="../termination-reason = 'killed'"/>
      <type name="nc:session-id-type"/>
      <description>
        <text>The ID of the session that directly caused this session
to be abnormally terminated.  If this session was abnormally
terminated by a non-NETCONF session unknown to the server,
then this leaf will not be present.</text>
      </description>
    </leaf>
    <leaf name="termination-reason">
      <type name="enumeration">
        <enum name="closed">
          <description>
            <text>The session was terminated by the client in normal
fashion, e.g., by the NETCONF &lt;close-session&gt;
protocol operation.</text>
          </description>
        </enum>
        <enum name="killed">
          <description>
            <text>The session was terminated in abnormal
fashion, e.g., by the NETCONF &lt;kill-session&gt;
protocol operation.</text>
          </description>
        </enum>
        <enum name="dropped">
          <description>
            <text>The session was terminated because the transport layer
connection was unexpectedly closed.</text>
          </description>
        </enum>
        <enum name="timeout">
          <description>
            <text>The session was terminated because of inactivity,
e.g., waiting for the &lt;hello&gt; message or &lt;rpc&gt;
messages.</text>
          </description>
        </enum>
        <enum name="bad-hello">
          <description>
            <text>The client's &lt;hello&gt; message was invalid.</text>
          </description>
        </enum>
        <enum name="other">
          <description>
            <text>The session was terminated for some other reason.</text>
          </description>
        </enum>
      </type>
      <mandatory value="true"/>
      <description>
        <text>Reason the session was terminated.</text>
      </description>
    </leaf>
  </notification>
  <notification name="netconf-confirmed-commit">
    <description>
      <text>Generated when a NETCONF server detects that a
confirmed-commit event has occurred.  Indicates the event
and the current state of the confirmed-commit procedure
in progress.</text>
    </description>
    <reference>
      <text>RFC 6241, Section 8.4</text>
    </reference>
    <uses name="common-session-parms">
      <when condition="confirm-event != 'timeout'"/>
    </uses>
    <leaf name="confirm-event">
      <type name="enumeration">
        <enum name="start">
          <description>
            <text>The confirmed-commit procedure has started.</text>
          </description>
        </enum>
        <enum name="cancel">
          <description>
            <text>The confirmed-commit procedure has been canceled,
e.g., due to the session being terminated, or an
explicit &lt;cancel-commit&gt; operation.</text>
          </description>
        </enum>
        <enum name="timeout">
          <description>
            <text>The confirmed-commit procedure has been canceled
due to the confirm-timeout interval expiring.
The common session parameters will not be present
in this sub-mode.</text>
          </description>
        </enum>
        <enum name="extend">
          <description>
            <text>The confirmed-commit timeout has been extended,
e.g., by a new &lt;confirmed-commit&gt; operation.</text>
          </description>
        </enum>
        <enum name="complete">
          <description>
            <text>The confirmed-commit procedure has been completed.</text>
          </description>
        </enum>
      </type>
      <mandatory value="true"/>
      <description>
        <text>Indicates the event that caused the notification.</text>
      </description>
    </leaf>
    <leaf name="timeout">
      <when condition="../confirm-event = 'start' or ../confirm-event = 'extend'"/>
      <type name="uint32"/>
      <units name="seconds"/>
      <description>
        <text>The configured timeout value if the event type
is 'start' or 'extend'.  This value represents
the approximate number of seconds from the event
time when the 'timeout' event might occur.</text>
      </description>
    </leaf>
  </notification>
</module>
