module ietf-yang-package-types {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-package-types";
prefix "pkg-types";
import ietf-yang-types {
prefix yang;
reference "RFC 6991: Common YANG Data Types.";
}
import ietf-inet-types {
prefix inet;
reference "RFC 6991: Common YANG Data Types.";
}
import ietf-yang-library {
prefix yanglib;
reference "RFC 7895bis: YANG Library";
}
import ietf-module-tags {
prefix tags;
reference
"XXX, (draft-ietf-netmod-module-tags-03): YANG Module Tags";
}
organization
"IETF NETMOD (Network Modeling) Working Group";
contact
"WG Web:
WG List:
Author: Rob Wilton
";
description
"This module provides type and grouping definitions for YANG
packages.
Copyright (c) 2018 IETF Trust and the persons identified as
authors of the code. 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 XXXX; see
the RFC itself for full legal notices.";
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
// RFC Ed.: replace XXXX with actual RFC number and remove this
// note.
revision 2018-11-26 {
description
"Initial revision";
reference
"RFC XXXX: YANG Schema Versioning.";
}
/*
* Typedefs
*/
typedef yang-sem-ver {
type string {
pattern '\d+[.]\d+[.]\d+[mM]?';
}
description
"Represents a YANG semantic version number.";
reference
"TODO - Should be defined by YANG versioning types module";
}
/*
* Groupings
*/
grouping yang-pkg-identification-leafs {
description
"Parameters for identifying a specific version of a YANG
package";
leaf name {
type yang:yang-identifier;
mandatory true;
description
"The YANG package name.";
}
leaf version {
type yang-sem-ver;
mandatory true;
description
"YANG package version. Follows YANG semantic versions rules
defined in XXX";
}
}
grouping yang-pkg-common-leafs {
description
"Defines definitions common to all YANG package definitions.";
leaf revision-date {
type yanglib:revision-identifier;
description
"An optional revision identifier of when this package version
was created. This does not need to be unique across all
versions of a package.";
}
leaf-list location {
type inet:uri;
description
"Contains a URL that represents where an instance data file
for this YANG package can be found.
This leaf will only be present if there is a URL
available for retrieval of the schema for this entry.
If multiple locations are provided, then the first location
in the leaf-list MUST be the definitive location that
uniquely identifies this package";
}
leaf description {
type string;
description "Provides a description of the package";
}
leaf reference {
type string;
description "Allows for a reference for the package";
}
leaf-list tag {
type tags:tag;
description
"Tags associated with a YANG package. Module tags defined in
XXX, ietf-netmod-module-tags can be used here but with the
modification that the tag applies to the entire package
rather than a specific module. See the IANA 'YANG Module Tag
Prefix' registry for reserved prefixes and the IANA 'YANG
Module IETF Tag' registry for IETF standard tags.";
}
leaf-list mandatory-feature {
type string;
// TODO - Is there a better type for this?
description
"List all features from modules included in the package that
MUST be supported by any server implementing the package.
All other features defined in included packages are OPTIONAL
to implement.
Features are identified using :";
}
list imported-packages {
key "name version";
description
"An entry in this list represents a package that is imported
as part of the package definition.
If packages implement different revisions or versions of the
same module, then an explicit entry in the module list MUST
be provided to select the specific module version
'implemented' by this package definition.
For import-only modules, the replaces-revision leaf-list can
be used to select the specific module versions imported by
this package.";
reference
"XXX";
uses yang-pkg-identification-leafs;
}
}
grouping yang-pkg-file-definition {
description
"The set of parameters that describe a particular YANG package.";
uses yang-pkg-identification-leafs;
uses yang-pkg-common-leafs {
augment "imported-packages" {
description "Add the package location path";
leaf-list location {
type inet:uri;
description
"Contains a URL that represents where an instance data
file for this YANG package can be found.
This leaf will only be present if there is a URL
available for retrieval of the schema for this entry.
If multiple locations are provided, then the first
location in the leaf-list MUST be the definitive location
that uniquely identifies this package";
}
}
}
list module {
key "name";
description
"An entry in this list represents a module that must be
implemented by a server implementing this package, as per
RFC 7950 section 5.6.5, with a particular set of supported
features and deviations.
A entry in this list overrides any module version
'implemented' by an imported package";
reference
"RFC 7950: The YANG 1.1 Data Modeling Language.";
uses yanglib:module-identification-leafs;
leaf version {
type yang-sem-ver;
description
"The YANG module or submodule version. If no version
statement is present in the YANG module or submodule, this
leaf is not instantiated.";
}
leaf namespace {
type inet:uri;
mandatory true;
description
"The XML namespace identifier for this module.";
}
uses yanglib:location-leaf-list;
list submodule {
key "name";
description
"Each entry represents one submodule within the
parent module.";
leaf name {
type yang:yang-identifier;
description
"The YANG submodule name.";
}
leaf revision {
type yanglib:revision-identifier;
mandatory true;
description
"The YANG submodule revision date. If the parent module
include statement for this submodule includes a revision
date then it MUST match this leaf's value.";
}
uses yanglib:location-leaf-list;
}
}
list import-only-module {
key "name revision";
description
"An entry in this list 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 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.";
leaf name {
type yang:yang-identifier;
description
"The YANG module name.";
}
leaf revision {
type union {
type yanglib:revision-identifier;
type string {
length 0;
}
}
description
"The YANG module revision date. A zero-length string is
used if no revision statement is present in the YANG
module.";
}
leaf version {
type yang-sem-ver;
description
"The YANG module or submodule version. If no version
statement is present in the YANG module or submodule, this
leaf is not instantiated.";
}
leaf namespace {
type inet:uri;
mandatory true;
description
"The XML namespace identifier for this module.";
}
uses yanglib:location-leaf-list;
list submodule {
key "name";
description
"Each entry represents one submodule within the
parent module.";
leaf name {
type yang:yang-identifier;
description
"The YANG submodule name.";
}
leaf revision {
type yanglib:revision-identifier;
mandatory true;
description
"The YANG submodule revision date. If the parent module
include statement for this submodule includes a revision
date then it MUST match this leaf's value.";
}
uses yanglib:location-leaf-list;
}
leaf-list replaces-revision {
type yanglib:revision-identifier;
description
"Gives the revision of an import-only-module defined in
an imported package that is replaced by this
import-only-module revision.";
}
}
}
grouping yang-pkg-library-definition {
description
"The set of parameters that describe a particular YANG package.";
uses yang-pkg-identification-leafs;
uses yang-pkg-common-leafs;
leaf-list module-set {
type leafref {
path "/yanglib:yang-library/yanglib:module-set/yanglib:name";
}
description
"Describes any modules in addition to, and replacing, and
modules defined in the imported packages.
If a non import-only module appears in multiple module sets,
then the module revision and the associated features and
deviations must be identical.";
}
}
}