module ietf-yang-data-ext {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-data-ext";
prefix "yd";
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web:
WG List:
Author: Andy Bierman
Author: Martin Bjorklund
Author: Kent Watsen
";
description
"This module contains conceptual YANG specifications
for defining abstract 'yang-data' data structures.
Copyright (c) 2017 - 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).";
revision 2018-03-05 {
description
"Initial revision.";
reference
// RFC Ed.: replace XXXX with RFC number and remove this note
"RFC XXXX: YANG Data Extensions.";
}
extension yang-data {
argument name {
yin-element true;
}
description
"This extension is used to specify a YANG data template which
represents conceptual data defined in YANG. It is
intended to describe hierarchical data independent of
protocol context or specific message encoding format.
Data definition statements within a yang-data extension
specify the generic syntax for the specific YANG data
template, whose name is the argument of the yang-data
extension statement.
Note that this extension does not define a media-type.
A specification using this extension MUST specify the
message encoding rules, including the content media type.
The mandatory 'name' parameter value identifies the YANG
data template that is being defined. It contains the
template name. This parameter is only used for readability
purposes. There are no mechanisms to reuse yang-data by
its template name value.
This extension is ignored unless it appears as a top-level
statement. It MUST contain data definition statements
that result in a set of data definition statements.
If the yang data template is intended to be used as
a top-level structure, then the yang data template needs to
result in a single container, so an instance of the YANG data
template can thus be translated into an XML instance document,
whose top-level element corresponds to the top-level container.
The module name and namespace value for the YANG module using
the extension statement is assigned to each of the data
definition statements resulting from the yang data template.
The name of each data definition statement resulting from
a yang data template is assigned to a top-level identifier name
in the data node identifier namespace, according to RFC 7950,
section 6.2.1.
The sub-statements of this extension MUST follow the
'data-def-stmt' rule in the YANG ABNF.
The XPath document root is the extension statement itself,
such that the child nodes of the document root are
represented by the data-def-stmt sub-statements within
this extension. This conceptual document is the context
for the following YANG statements:
- must-stmt
- when-stmt
- path-stmt
- min-elements-stmt
- max-elements-stmt
- mandatory-stmt
- unique-stmt
- ordered-by
- instance-identifier data type
The following data-def-stmt sub-statements are constrained
when used within a yang-data-resource extension statement.
- The list-stmt is not required to have a key-stmt defined.
- The if-feature-stmt is ignored if present.
- The config-stmt is ignored if present.
- The available identity values for any 'identityref'
leaf or leaf-list nodes is limited to the module
containing this extension statement, and the modules
imported into that module.
";
}
extension augment-yang-data {
argument path {
yin-element true;
}
description
"This extension is used to specify an augmentation to
conceptual data defined with the 'yang-data' statement.
It is intended to describe hierarchical data independent
of protocol context or specific message encoding format.
This statement has almost the same structure as the
'augment-stmt'. Data definition statements within this
statement specify the semantics and generic syntax for the
additional data to be added to the specific YANG data template,
identified by the 'path' argument.
The mandatory 'path' parameter value identifies the YANG
conceptual data node that is being augmented, represented
as an absolute-schema-nodeid string.
This extension is ignored unless it appears as a top-level
statement. The sub-statements of this extension MUST follow
the 'data-def-stmt' rule in the YANG ABNF.
The module name and namespace value for the YANG module using
the extension statement is assigned to instance document data
conforming to the data definition statements within
this extension.
The XPath document root is the augmented extension statement
itself, such that the child nodes of the document root are
represented by the data-def-stmt sub-statements within
the augmented yang-data statement.
The context node of the augment-yang-data statement is derived
in the same way as the 'augment' statement, as defined in
section 6.4.1 of [RFC7950]. This conceptual node is
considered the context node for the following YANG statements:
- must-stmt
- when-stmt
- path-stmt
- min-elements-stmt
- max-elements-stmt
- mandatory-stmt
- unique-stmt
- ordered-by
- instance-identifier data type
The following data-def-stmt sub-statements are constrained
when used within a augment-yang-data extension statement.
- The list-stmt is not required to have a key-stmt defined.
- The if-feature-stmt is ignored if present.
- The config-stmt is ignored if present.
- The available identity values for any 'identityref'
leaf or leaf-list nodes is limited to the module
containing this extension statement, and the modules
imported into that module.
Example:
foo.yang {
import yang-data-ext { prefix yd; }
yd:yang-data foo-data {
container foo-con { }
}
}
bar.yang {
import yang-data-ext { prefix yd; }
import foo { prefix foo; }
yd:augment-yang-data /foo:foo-con {
leaf add-leaf1 { type int32; }
leaf add-leaf2 { type string; }
}
}
";
}
}