Subject: [Netconf] proposal for updated ietf-netconf-state.yang

From: Andy Bierman <[email-masked]>
Date: Thu, 26 Mar 2009 23:27:03 -0700

Hi,

Here is an update of the monitoring module with per-session statistics.

I also changed some enums to identityrefs and marked some
definitions that need to be moved to netconf.yang and imported.

I did not make all the changes from the WG meeting,
just a few of them.

Here is a basic diff (yangdiff still not caught up to yang-04):

// Generated by yangdiff 0.1.1
// old: ietf-netconf-state (2009-03-03) ietf-netconf-state.2009-03-03.yang
// new: ietf-netconf-state (2009-03-26) ietf-netconf-state.2009-03-26.yang

D revision '2009-03-03'
A revision '2009-03-26'
M typedef TransportType
    A description 'Base for all NETCONF...'
    M type from 'enumeration' to 'identityref'
M typedef ProtocolType
    M type from 'enumeration' to 'identityref'
M typedef SchemaFormat
    M type from 'enumeration' to 'identityref'
A grouping CommonStatistics
M container ietf-netconf-state
    M container sessions
       M list session
          A container sessionStatistics
    M container statistics
       M child node order

Andy

 module ietf-netconf-state {

   namespace "urn:ietf:params:xml:ns:netconf:state";
   prefix "ns";

   import ietf-yang-types { prefix yang; }
   import ietf-inet-types { prefix inet; }

   organization
     "IETF NETCONF (Network Configuration) Working Group";

   contact
     "WG Web:   <http://tools.ietf.org/wg/netconf/>
      WG List:  <mailto:[email-masked]>

      WG Chair: Mehmet Ersue
                <mailto:[email-masked]>

      WG Chair: Bert Wijnen
                <mailto:[email-masked]>

      Editor:   Mark Scott
                <mailto:[email-masked]>";

   description
     "NETCONF Monitoring Module.
      All elements in this module are read-only.

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

   This version of this YANG module is part of RFC XXXX; see the
   RFC itself for full legal notices.";
   // RFC Ed.: replace XXXX with actual RFC number and remove this note

   revision 2009-03-26 {
     description
       "Initial revision, published as RFC XXXX.";
       // RFC Ed.: replace XXXX with actual RFC number
       // and remove this note
   }

   // *** BEGIN *** WILL BE IMPORTED FROM netconf.yang

   typedef SessionId {
     type uint32 {
       range "1..max";
     }
     reference "RFC 4741: NETCONF Configuration Protocol";
   }

   grouping NETCONFDatastoreType {
     description
       "Enumeration of possible NETCONF datastore types.";
     reference "RFC 4741: NETCONF Configuration Protocol";
     choice datastore {
       mandatory true;
       leaf running {
         type empty;
       }
       leaf candidate {
         type empty;
       }
       leaf startup {
         type empty;
       }
     }
   }

   typedef TransportType {
     description "Base for all NETCONF transport types";
     type identityref { 
       base TransportIdentityType; 
     }
   }

   identity TransportIdentityType {
     description "Base for all NETCONF transport types";
   }

   identity SSH {
     base TransportIdentityType;
     reference "RFC 4742";
   }

   identity Console {
     base TransportIdentityType;
   }

   identity HTTP {
     base TransportIdentityType;
     reference "RFC 4743";
   }

   identity HTTPS {
     base TransportIdentityType;
     reference "RFC 4743";
   }

   identity BEEP {
     base TransportIdentityType;
     reference "RFC 4744";
   }

   identity SOAP {
     base TransportIdentityType;
     reference "RFC 4743";
   }

   identity TLS {
     base TransportIdentityType;
     reference "draft-ietf-netconf-tls";
   }

   // *** END: WILL BE IMPORTED FROM netconf.yang

   typedef ProtocolType {
     type identityref {
       base ProtocolIdentityType;
     }
   }

   identity ProtocolIdentityType {
     description "Base for all agent session protocol types";
   }

   identity CLI {
     base ProtocolIdentityType;
   }

   identity NETCONF {
     base ProtocolIdentityType;
     reference "RFC 4741";
   }

   identity WebUI {
     base ProtocolIdentityType;
   }

   typedef SchemaFormat {
     type identityref {
       base SchemaIdentifierFormat;
     }
   }

   identity SchemaIdentifierFormat {
     description "Base for all agent schema formats";
   }

   identity XSD {
     base SchemaIdentifierFormat;
     reference "W3C REC REC-xmlschema-1-20041028";
   }

   identity YANG {
     base SchemaIdentifierFormat;
     reference "draft-ietf-netmod-yang";
   }

   identity RNG {
     base SchemaIdentifierFormat;
     reference "ISO/IEC 19757-2";
   }

   grouping CommonStatistics {

       leaf inXMLParseErrors {
         type yang:zero-based-counter32;
         description
           "The total number of messages that were unparsable and thus
            ignored.  This covers both unparsable 'hello' and 'rpc'
            messages.";
       }
       leaf inBadHellos {
         type yang:zero-based-counter32;
         description
           "The total number of sessions silently dropped because an
            invalid 'hello' message was received.  This includes hello
            messages with a 'session-id' attribute, bad namespace, and
            bad capability declarations.";
       }
       leaf inRpcs {
         type yang:zero-based-counter32;
         description
           "The total number of rpc requests received.";
       }
       leaf inBadRpcs {
         type yang:zero-based-counter32;
         description
           "The total number of rpcs which were parsed correctly, but
            couldn't be serviced because they contained
            non-conformant XML,  e.g. missing a mandatory parameter.";
       }
       leaf inNotSupportedRpcs {
         type yang:zero-based-counter32;
         description
           "The total number of rpcs which were parsed correctly, but
            couldn't be serviced because they were not supported by
            the agent.";
       }
       leaf outRpcReplies {
         type yang:zero-based-counter32;
         description
           "The total number of 'rpc-reply' messages sent.";
       }
       leaf outRpcErrors {
         type yang:zero-based-counter32;
         description
           "The total number of 'rpc-reply' messages with 'rpc-error'
             sent.";
       }
   }

   container ietf-netconf-state {
     config false;

     container capabilities {
       description
         "The list of currently provided NETCONF capabilities.  This
          may be different than those exchanged during session setup
          (i.e. hello).";
       leaf-list capability {
         type inet:uri;
       }
     }

     container datastores {
       description
         "List of NETCONF configuration datastores (e.g. running,
          startup, candidate) supported on this device and related
          information.";
       list datastore {
         container name {
           uses NETCONFDatastoreType;
         }
         container locks {
           description
             "An indication of whether a resource is locked or
              unlocked.  If locked, additional information about
              the locking such as user an time stamp is provided.";

           grouping LockInfo {
             leaf lockedBySession {
               type SessionId;
               description
                 "The session ID of the session that has locked
                  this resource.";
             }
             leaf lockedTime {
               type yang:date-and-time;
               description
                 "The date and time of when the resource was
                  locked.";
             }
           }

           choice lockType {
             container globalLock {
               description
                 "Present if the global lock is set.";
               uses LockInfo;
             }
             list partialLocks {
               key lockId;
               description
                 "For a partial lock this is the lock id returned
                   in the <partial-lock> response.";
               leaf lockId {
                 type uint32;
               }

               uses LockInfo;
               leaf-list select {
                 type string;
                 min-elements 1;
                 description
                   "The xpath expression which was used to request
                    the lock.";
               }
               leaf-list lockedNodes {
                 type instance-identifier;
                 description
                   "The list of instance-identifiers (i.e. the
                    locked nodes).";
               }
             }
           }
         }
       }
     }

     container schemas {
       list schema {
         key "identifier version format";
         leaf identifier {
           type string;
           description
             "Identifier to uniquely reference the schema";
         }
         leaf version {
           type string;
           description
             "Version of the schema supported.  Multiple versions can be
              supported simultaneously.";
         }
         leaf format {
           type SchemaFormat;
           description
             "Schema language for the file/module.";
         }
         leaf namespace {
           type inet:uri;
           description
             "The XML namespace defined by the data model.";
         }
         leaf location {
           type union {
             type enumeration {
               enum "NETCONF";
             }
             type inet:uri;
           }
           description
           "One or more Locations from which the schema can be
           retrieved. Can be either on the network device
           retrievable explicitly via the get-schema netconf
           operation (denoted by the value 'NETCONF') or some
           network location (i.e. URL).";
         }
       }
     }

     container sessions {
       description
         "List of NETCONF sessions currently active on this device.";

       list session {
         key sessionId;
         leaf sessionId {
           type SessionId;
         }
         leaf transport {
           type TransportType;
         }
         leaf protocol {
           type ProtocolType;
         }
         leaf username  {
           type string;
         }
         leaf sourceHost {
           type inet:host;
         }
         leaf loginTime {
           type yang:date-and-time;
           description
             "Time at which the session was established.";
         }
         container sessionStatistics {
           uses CommonStatistics;
         }
       }
     }

     container subscriptions {
       description
         "Contains information on the active subscriptions on the
          NETCONF server.  Subscriptions which have ended are not
          reported.";
       list subscription {
         key sessionId;
         description
           "Information about Netconf Notification Subscriptions.";
         leaf sessionId {
           type SessionId;
           description
             "The session id associated with this subscription.";
         }
         leaf stream {
           type string;
           description
             "The stream associated with this subscription.";
         }
         anyxml filter {
           description
             "The filters associated with this subscription.";
           reference "RFC 4741: NETCONF Configuration Protocol";

         }
         leaf startTime {
           type yang:date-and-time;
           description
             "The startTime parameter from the create-subscription
              invokation, if it was present.";
         }
         leaf stopTime {
           type yang:date-and-time;
           description
             "The stopTime parameter from the create-subscription
              invokation, if it was present.";
         }
         leaf outNotifications {
           type yang:zero-based-counter32;
           description
             "A count of event notifications sent along
              this connection since the subscription was
              created.";
         }
       }
     }

     container statistics {
       leaf netconfStartTime {
         type yang:date-and-time;
         description
           "Date and time at which the NETCONF server process was
            started.  Allows for calculation of time interval for
            reported metrics.";
       }
       leaf inSessions {
         type yang:zero-based-counter32;
         description
           "The total number of NETCONF sessions started towards the
            NETCONF peer.

             inSessions - inBadHellos = 'number of correctly started
                                         netconf sessions'";
       }

       uses CommonStatistics;

       leaf outNotifications {
         type yang:zero-based-counter32;
         description
           "The total number of 'notifications' messages sent.";
       }
     }

   }

   rpc get-schema {
     input {
       leaf identifier {
         type string;
         mandatory true;
       }
       leaf version {
         type string;
         mandatory true;
       }
       leaf format {
         type SchemaFormat;
         mandatory true;
       }
     }
     output {
       anyxml data {
         description "Contains the schema content.";
       }
     }
   }

 }