netconfcentral logo

yang-catalog@2017-09-26



  module yang-catalog {

    yang-version 1;

    namespace
      "urn:ietf:params:xml:ns:yang:yang-catalog";

    prefix yc;

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

    organization "yangcatalog.org";

    contact
      "Benoit Claise <bclaise@cisco.com>

     Joe Clarke <jclarke@cisco.com>";

    description
      "This module contains metadata pertinent to each YANG module, as
     well as a list of vendor implementations for each module.  The
     structure is laid out in such a way as to make it possible to
     locate metadata and vendor implementation on a per-module basis
     as well as obtain a list of available modules for a given
     vendor's platform and specific software release.";

    revision "2017-09-26" {
      description
        "* Add leafs for tracking dependencies and dependents
       * Simply the generated-from enumerated values
       * Refine the type for compilation-result to be an inet:uri
       * Add leafs for semantic versioning";
      reference
        "YANG Catalog <https://yangcatalog.org>";

    }

    revision "2017-08-18" {
      description
        "* Reorder organization to be with the other module keys
       * Add a belongs-to leaf to track a submodule's parent";
      reference
        "YANG Catalog <https://yangcatalog.org>";

    }

    revision "2017-07-28" {
      description
        "* Revert config false nodes as we need to be able to set these via <edit-config>

       * Make conformance-type optional as not all vendors implement yang-library

       * Re-add the path typedef";
      reference
        "YANG Catalog <https://yangcatalog.org>";

    }

    revision "2017-07-26" {
      description
        "A number of improvements based on YANG Doctor review:

       * Remove references to 'server' in leafs describing YANG data
       * Fold the augmentation module leafs directly under /catalog/modules/module
       * Use identities for protocols instead of an emumeration
       * Make some extractable fields 'config false'
       * Fix various types
       * Normalize enums to be lowercase
       * Add a leaf for module-classification
       * Change yang-version to be an enum
       * Add module conformance, deviation and feature leafs under the implementation branches";
      reference
        "YANG Catalog <https://yangcatalog.org>";

    }

    revision "2017-07-14" {
      description
        "Modularize some of the leafs and create typedefs so they
       can be shared between the API input modules.";
      reference
        "YANG Catalog <https://yangcatalog.org>";

    }

    revision "2017-07-03" {
      description "Initial revision.";
      reference
        "
        YANG Catalog <https://yangcatalog.org>";

    }


    identity protocol {
      base 
      description
        "Abstract base identity for a YANG-based protocol.";
    }

    identity netconf {
      base protocol;
      description
        "Protocol identity for NETCONF as described in RFC 6241.";
    }

    identity restconf {
      base protocol;
      description
        "Protocol identity for RESTCONF as described in RFC 8040.";
    }

    typedef email-address {
      type string {
        pattern
          "[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+([.][a-zA-Z0-9-]+)*";
      }
      description
        "This type represents a string with an email address.";
    }

    typedef path {
      type string {
        pattern
          "([A-Za-z]:|[\\w-]+(\\.[\\w-]+)*)?(([/\\\\][\\w@.-]+)+)";
      }
      description
        "This type represents a string with path to the file.";
    }

    typedef semver {
      type string {
        pattern "[0-9]+\\.[0-9]+\\.[0-9]+";
      }
      description
        "A semantic version in the format of x.y.z, where:

       x = the major version number
       y = the minor version number
       z = the patch version number

       Changes to the major version number denote backwards-incompatible
       changes between two revisions of the same module.

       Changes to the minor version number indicate there have been new
       backwards-compatible features introduced in the later version of
       a module.

       Changes to the patch version indicate bug fixes between two
       versions of a module.";
      reference
        "Semantic Versioning 2.0.0 <http://semver.org/>";

    }

    container catalog {
      description
        "Root container of yang-catalog holding two main branches -
       modules and vendors. The modules sub-tree contains all the modules in
       the catalog and all of their metadata with their implementations.
       The vendor sub-tree holds modules for specific vendors, platforms,
       software-versions, and software-flavors. It contains reference to a
       name and revision of the module in order to reference the module's full
       set of metadata.";
      container modules {
        description
          "Container holding the list of modules";
        list module {
          key "name revision organization";
          description
            "Each entry represents one revision of one module
           for one organization.";
          uses yang-lib-common-leafs;

          leaf organization {
            type string;
            description
              "This statement defines the party responsible for this
             module.  The argument is a string that is used to specify a textual
             description of the organization(s) under whose auspices this module
             was developed.";
          }

          uses organization-specific-metadata;

          leaf namespace {
            type inet:uri;
            mandatory true;
            description
              "The XML namespace identifier for this module.";
          }

          uses yang-lib-schema-leaf;

          uses catalog-module-metadata;

          list submodule {
            key "name revision";
            description
              "Each entry represents one submodule within the
             parent module.";
            uses yang-lib-common-leafs;

            uses yang-lib-schema-leaf;
          }  // list submodule

          list dependencies {
            key "name";
            description
              "Each entry represents one dependency.";
            uses yang-lib-common-leafs;

            uses yang-lib-schema-leaf;
          }  // list dependencies

          list dependents {
            key "name";
            description
              "Each entry represents one dependent.";
            uses yang-lib-common-leafs;

            uses yang-lib-schema-leaf;
          }  // list dependents

          leaf semantic-version {
            type semver;
            description
              "The formal semantic version of a module as provided by the module
             itself.  If the module does not provide a semantic version, this leaf
             will not be specified.";
          }

          leaf derived-semantic-version {
            type semver;
            description
              "The semantic version of a module as compared to other revisions of
             the same module.  This value is computed algorithmically by ordering
             all revisions of a given module and comparing them to look for backwards
             incompatible changes.";
          }

          container implementations {
            description
              "Container holding lists of per-module implementation details.";
            list implementation {
              key "vendor platform software-version software-flavor";
              description
                "List of module implementations.";
              leaf vendor {
                type string;
                description
                  "Organization that implements this module.";
              }

              leaf platform {
                type string;
                description
                  "Platform on which this module is implemented.";
              }

              leaf software-version {
                type string;
                description
                  "Name of the version of software.  With respect to most network device appliances,
                 this will be the operating system version.  But for other YANG module
                 implementation, this would be a version of appliance software.  Ultimately,
                 this should correspond to a version string that will be recognizable by
                 the consumers of the platform.";
              }

              leaf software-flavor {
                type string;
                description
                  "A variation of a specific version where
                 YANG model support may be different.  Depending on the vendor, this could
                 be a license, additional software component, or a feature set.";
              }

              uses shared-implementation-leafs;

              uses yang-lib-imlementation-leafs;
            }  // list implementation
          }  // container implementations
        }  // list module
      }  // container modules

      container vendors {
        description
          "Container holding lists of organizations that publish YANG modules.";
        list vendor {
          key "name";
          description
            "List of organizations publishing YANG modules.";
          leaf name {
            type string;
            description
              "Name of the maintaining organization -- the name should be
             supplied in the official format used by the organization.
             Standards Body examples:
               IETF, IEEE, MEF, ONF, etc.
             Commercial entity examples:
               AT&T, Facebook, <Vendor>
             Name of industry forum examples:
             OpenConfig, OpenDaylight, ON.Lab";
          }

          container platforms {
            description
              "Container holding list of platforms.";
            list platform {
              key "name";
              description
                "List of platforms under specific vendor";
              leaf name {
                type string;
                description
                  "Name of the platform";
              }

              container software-versions {
                description
                  "Container holding list of versions of software versions.";
                list software-version {
                  key "name";
                  description
                    "List of version of software versions under specific vendor, platform.";
                  leaf name {
                    type string;
                    description
                      "Name of the version of software.  With respect to most network device appliances,
                     this will be the operating system version.  But for other YANG module
                     implementation, this would be a version of appliance software.  Ultimately,
                     this should correspond to a version string that will be recognizable by
                     the consumers of the platform.";
                  }

                  container software-flavors {
                    description
                      "Container holding list of software flavors.";
                    list software-flavor {
                      key "name";
                      description
                        "List of software flavors under specific vendor, platform, software-version.";
                      leaf name {
                        type string;
                        description
                          "A variation of a specific version where
                         YANG model support may be different.  Depending on the vendor, this could
                         be a license, additional software component, or a feature set.";
                      }

                      container protocols {
                        description
                          "List of the protocols";
                        list protocol {
                          key "name";
                          description
                            "YANG-based protocol that is used on the device.  New identities
                           are expected to be added to address other YANG-based protocols.";
                          leaf name {
                            type identityref {
                              base yc:protocol;
                            }
                            description
                              "Identity of the YANG-based protocol that is supported.";
                          }

                          leaf-list protocol-version {
                            type string;
                            description
                              "Version of the specific protocol.";
                          }

                          leaf-list capabilities {
                            type string;
                            description
                              "Listed name of capabilities that are
                             supported by the specific device.";
                          }
                        }  // list protocol
                      }  // container protocols

                      container modules {
                        description
                          "Container holding list of modules.";
                        list module {
                          key "name revision organization";
                          description
                            "List of references to YANG modules under specific vendor, platform, software-version,
                           software-flavor.  Using these references, the complete set of metadata can be
                           retrieved for each module.";
                          leaf name {
                            type leafref {
                              path "/catalog/modules/module/name";
                            }
                            description
                              "Reference to a name of the module that is contained in specific vendor, platform,
                             software-version, software-flavor.";
                          }

                          leaf revision {
                            type leafref {
                              path "/catalog/modules/module/revision";
                            }
                            description
                              "Reference to a revision of the module that is contained in specific vendor,
                             platform, software-version, software-flavor.";
                          }

                          leaf organization {
                            type leafref {
                              path "/catalog/modules/module/organization";
                            }
                            description
                              "Reference to the authoring organization of the module for the implemented
                              module.";
                          }

                          uses shared-implementation-leafs;

                          uses yang-lib-imlementation-leafs;
                        }  // list module
                      }  // container modules
                    }  // list software-flavor
                  }  // container software-flavors
                }  // list software-version
              }  // container software-versions
            }  // list platform
          }  // container platforms
        }  // list vendor
      }  // container vendors
    }  // container catalog

    grouping catalog-module-metadata {
      description
        "Grouping of YANG module metadata that extends the common list defined in the YANG
       Module Library (RFC 7895).";
      uses shared-module-leafs;

      leaf compilation-status {
        type enumeration {
          enum "passed" {
            value 0;
            description
              "All compilers were able to compile this YANG module without
             any errors or warnings.";
          }
          enum "passed-with-warnings" {
            value 1;
            description
              "All compilers were able to compile this YANG module without
             any errors, but at least one of them caught a warning.";
          }
          enum "failed" {
            value 2;
            description
              "At least one of compilers found an error while
             compiling this YANG module.";
          }
          enum "pending" {
            value 3;
            description
              "The module was just added to the catalog and compilation testing is still
             in progress.";
          }
          enum "unknown" {
            value 4;
            description
              "There is not sufficient information about compilation status.  This Could
             mean compilation crashed causing it not to complete fully.";
          }
        }
        description
          "Status of the module, whether it was possible to compile this YANG module or
         there are still some errors/warnings.";
      }

      leaf compilation-result {
        type inet:uri;
        description
          "Link to the result of the compilation explaining specifically what error or
         warning occurred.  This is not existing if compilation status is PASSED.";
      }

      leaf prefix {
        type string;
        description
          "Statement of yang that is used to define the prefix associated with
         the module and its namespace. The prefix statement's argument is
         the prefix string that is used as a prefix to access a module. The
         prefix string MAY be used to refer to definitions contained in the
         module, e.g., if:ifName.";
      }

      leaf yang-version {
        type enumeration {
          enum "1.0" {
            value 0;
            description
              "YANG version 1.0 as defined in RFC 6020.";
          }
          enum "1.1" {
            value 1;
            description
              "YANG version 1.1 as defined in RFC 7950.";
          }
        }
        description
          "The optional yang-version statement specifies which version of the
         YANG language was used in developing the module.";
      }

      leaf description {
        type string;
        description
          "This statement takes as an argument a string that
         contains a human-readable textual description of this definition.
         The text is provided in a language (or languages) chosen by the
         module developer; for the sake of interoperability, it is RECOMMENDED
         to choose a language that is widely understood among the community of
         network administrators who will use the module.";
      }

      leaf contact {
        type string;
        description
          "This statement provides contact information for the module.
         The argument is a string that is used to specify contact information
         for the person or persons to whom technical queries concerning this
         module should be sent, such as their name, postal address, telephone
         number, and electronic mail address.";
      }

      leaf module-type {
        type enumeration {
          enum "module" {
            value 0;
            description
              "If YANG file contains module.";
          }
          enum "submodule" {
            value 1;
            description
              "If YANG file contains sub-module.";
          }
        }
        description
          "Whether a file contains a YANG module or sub-module.";
      }

      leaf belongs-to {
        when "../module-type = 'submodule'" {
          description
            "Include the module's parent when it is a submodule.";
        }
        type yang:yang-identifier;
        description
          "Name of the module that includes this submodule.";
      }

      leaf tree-type {
        type enumeration {
          enum "split" {
            value 0;
            description
              "This module uses a split config/operational state layout.";
          }
          enum "nmda-compatible" {
            value 1;
            description
              "This module is compatible with the Network Management Datastores
             Architecture (NMDA) and combines config and operational state nodes.";
          }
          enum "transitional-extra" {
            value 2;
            description
              "This module is derived as a '-state' module to allow for transitioning
             to a full NMDA-compliant tree structure.";
          }
          enum "openconfig" {
            value 3;
            description
              "This module uses the Openconfig data element layout.";
          }
          enum "unclassified" {
            value 4;
            description
              "This module does not belong to any category or can't be determined.";
          }
          enum "not-applicable" {
            value 5;
            description
              "This module is not applicable. For example, because the YANG module only contains typedefs, groupings, or is a submodule";
          }
        }
        description
          "The type of data element tree used by the module as it relates to the
         Network Management Datastores Architecture.";
        reference
          "draft-dsdt-nmda-guidelines Guidelines for YANG Module Authors (NMDA)";

      }
    }  // grouping catalog-module-metadata

    grouping organization-specific-metadata {
      description
        "Any organization that has some specific metadata of the yang module and want them add to the
       yang-catalog, should augment this grouping. This grouping is for any metadata that can`t be used for
       every yang module.";
      container ietf {
        when "../organization = 'ietf'" {
          description
            "Include this container specific metadata of the IETF.";
        }
        description
          "Include this container for the IETF-specific organization metadata.";
        leaf ietf-wg {
          type string;
          description
            "Working group that authored the document containing this module.";
        }
      }  // container ietf
    }  // grouping organization-specific-metadata

    grouping yang-lib-common-leafs {
      description
        "The YANG module or submodule revision date.
       A zero-length string is used if no revision statement
       is present in the YANG module or submodule.";
      reference
        "RFC7895 YANG Module Library : common-leafs grouping";

      leaf name {
        type yang:yang-identifier;
        description
          "The YANG module or submodule name.";
      }

      leaf revision {
        type union {
          type yanglib:revision-identifier;
          type string {
            length "0";
          }
        }
        description
          "The YANG module or submodule revision date.
         A zero-length string is used if no revision statement
         is present in the YANG module or submodule.";
      }
    }  // grouping yang-lib-common-leafs

    grouping yang-lib-schema-leaf {
      description
        "These are a subset of leafs from the yang-library (RFC 7895) that provide some
       extractable fields for catalog modules.  The module-list grouping cannot be
       used from yang-library as modules themselves cannot have conformance without
       a server.";
      reference
        "RFC7895 YANG Module Library : schema-leaf grouping";

      leaf schema {
        type inet:uri;
        description
          "Contains a URL that represents the YANG schema
         resource for this module or submodule.
         This leaf will only be present if there is a URL
         available for retrieval of the schema for this entry.";
      }
    }  // grouping yang-lib-schema-leaf

    grouping yang-lib-imlementation-leafs {
      description
        "This is a set of leafs extracted from the yang-library that are
       specific to server implementations.";
      reference
        "RFC7895 YANG Module Library : module-list grouping";

      leaf-list feature {
        type yang:yang-identifier;
        description
          "List of YANG feature names from this module that are
         supported by the server, regardless of whether they are
         defined in the module or any included submodule.";
      }

      list deviation {
        key "name revision";
        description
          "List of YANG deviation module names and revisions
         used by this server to modify the conformance of
         the module associated with this entry.  Note that
         the same module can be used for deviations for
         multiple modules, so the same entry MAY appear
         within multiple 'module' entries.
         The deviation module MUST be present in the 'module'
         list, with the same name and revision values.
         The 'conformance-type' value will be 'implement' for
         the deviation module.";
        uses yang-lib-common-leafs;
      }  // list deviation

      leaf conformance-type {
        type enumeration {
          enum "implement" {
            value 0;
            description
              "Indicates that the server implements one or more
             protocol-accessible objects defined in the YANG module
             identified in this entry.  This includes deviation
             statements defined in the module.
             For YANG version 1.1 modules, there is at most one
             module entry with conformance type 'implement' for a
             particular module name, since YANG 1.1 requires that,
             at most, one revision of a module is implemented.
             For YANG version 1 modules, there SHOULD NOT be more
             than one module entry for a particular module name.";
          }
          enum "import" {
            value 1;
            description
              "Indicates that the server imports reusable definitions
             from the specified revision of the module but does
             not implement any protocol-accessible objects from
             this revision.
             Multiple module entries for the same module name MAY
             exist.  This can occur if multiple modules import the
             same module but specify different revision dates in
             the import statements.";
          }
        }
        description
          "Indicates the type of conformance the server is claiming
         for the YANG module identified by this entry.";
      }
    }  // grouping yang-lib-imlementation-leafs

    grouping shared-implementation-leafs {
      description
        "Grouping of non-key leafs to be used in the module and vendor sub-trees.";
      leaf os-version {
        type string;
        description
          "Version of the operating system using this module.  This is primarily useful if
         the software implementing the module is an application that requires a specific
         operating system.";
      }

      leaf feature-set {
        type string;
        description
          "An optional feature of the software that is required in order to implement this
         module.  Some form of this must be incorporated in software-version or
         software-flavor, but can be broken out here for additional clarity.";
      }

      leaf os-type {
        type string;
        description
          "Type of the operating system using this module.  This is primarily useful if
         the software implementing the module is an application that requires a
         specific operating system.";
      }
    }  // grouping shared-implementation-leafs

    grouping shared-module-leafs {
      description
        "These leafs are shared among the yang-catalog and its API.";
      leaf generated-from {
        type enumeration {
          enum "mib" {
            value 0;
            description
              "Module generated from Structure of Management Information (SMI)
             MIB per RFC6643.";
          }
          enum "not-applicable" {
            value 1;
            description
              "Module was not generated but it was authored manually.";
          }
          enum "native" {
            value 2;
            description
              "Module generated from platform internal,
             proprietary structure, or code.";
          }
        }
        default "not-applicable";
        description
          "This statement defines weather the module was generated or not.
         Default value is set to not-applicable, which means that module
         was created manualy and not generated.";
      }

      leaf maturity-level {
        type enumeration {
          enum "ratified" {
            value 0;
            description
              "Maturity of a module that is fully approved (e.g., a standard).";
          }
          enum "adopted" {
            value 1;
            description
              "Maturity of a module that is actively being developed by a organization towards ratification.";
          }
          enum "initial" {
            value 2;
            description
              "Maturity of a module that has been initially created, but has no official
             organization-level status.";
          }
          enum "not-applicable" {
            value 3;
            description
              "The maturity level is not used for vendor-supplied models, and thus all vendor
             modules will have a maturity of not-applicable";
          }
        }
        description
          "The current maturity of the module with respect to the body that created it.
         This allows one to understand where the module is in its overall life cycle.";
      }

      leaf document-name {
        type string;
        description
          "The name of the document from which the module was extracted or taken;
         or that provides additional context about the module.";
      }

      leaf author-email {
        type email-address;
        description
          "Contact email of the author who is responsible for this module.";
      }

      leaf reference {
        type inet:uri;
        description
          "A string that is used to specify a textual cross-reference to an external document, either
         another module that defines related management information, or a document that provides
         additional information relevant to this definition.";
      }

      leaf module-classification {
        type enumeration {
          enum "network-service" {
            value 0;
            description
              "Network Service YANG Module that describes the configuration, state
             data, operations, and notifications of abstract representations of
             services implemented on one or multiple network elements.";
          }
          enum "network-element" {
            value 1;
            description
              "Network Element YANG Module that describes the configuration, state
             data, operations, and notifications of specific device-centric
             technologies or features.";
          }
          enum "unknown" {
            value 2;
            description
              "In case that there is not sufficient information about how to classify the module.";
          }
          enum "not-applicable" {
            value 3;
            description
              "The YANG module abstraction type is neither a Network Service YANG Module
             nor a Network Element YANG Module.";
          }
        }
        mandatory true;
        description
          "The high-level classification of the given YANG module.";
        reference
          "RFC8199 YANG Module Classification";

      }
    }  // grouping shared-module-leafs

    grouping online-source-file {
      description
        "Networked version control system location of the module file.";
      leaf owner {
        type string;
        mandatory true;
        description
          "Username or ID of the owner of the version control system repository.";
      }

      leaf repository {
        type string;
        mandatory true;
        description
          "The name of the repository.";
      }

      leaf path {
        type path;
        mandatory true;
        description
          "Location within the repository of the module file.";
      }

      leaf branch {
        type string;
        description
          "Revision control system branch or tag to use to find the module.  If this is not
         specified, the head of the repository is used.";
      }
    }  // grouping online-source-file
  }  // module yang-catalog