EditWYSIWYGAttachPrintable
r5 - 2008-11-04 - 18:38:04 - MartinBjoerklundYou are here: TWiki >  Main Web > YangExamples > YangExamplesNetconfStateHtml
module netconf-state {

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

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

  organization
    "IETF";

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

  revision "2008-11-03" {
    description "Initial revision.";
  }

  typedef SessionId {
    type uint32 {
      range "1..max";
    }
    reference "rfc4741";
  }

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

  typedef TransportType {
    type enumeration {
      enum "SSH";
      enum "SSL";
      enum "Console";
      enum "HTTP";
      enum "HTTPS";
    }
  }

  typedef ProtocolType {
    type enumeration {
      enum "CLI";
      enum "NETCONF";
      enum "WebUI";
    }
  }

  typedef SchemaFormat {
    type enumeration {
      enum "XSD" {
        reference "W3C REC REC-xmlschema-1-20041028";
      }
      enum "YANG" {
        reference "draft-ietf-netmod-yang";
      }
      enum "RNG" {
        reference "ISO/IEC 19757-2";
      }
    }
  }

  container netconf {
    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;
        min-elements 1;
      }
    }

    container configurations {
      description
        "List of NETCONF configuration datastores (e.g. running,
         startup, candidate) supported on this device and related
         information.";
      list configuration {
        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
                "Present if at least one partial lock is set.";

              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 format version";
        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
            "A location 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 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.";
        }
        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 messagesSent {
          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'";
      }
      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.";
      }
      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.";
      }
    }
  }

}
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r6 < r5 < r4 < r3 < r2 | More topic actions...
 
YANG
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback