module ietf-netconf-opstate {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-opstate";
prefix ncos;
import ietf-netconf { // RFC 6241
prefix nc;
}
import ietf-yang-patch { // RFC YYYY
prefix yp;
}
organization
"IETF NETMOD (NETCONF Data Modeling Language) Working Group";
contact
"WG Web:
WG List:
WG Chair: Tom Nadeau
WG Chair: Kent Watsen
WG Chair: Juergen Schoenwaelder
";
description
"This YANG module does the following:
- enables get-config and copy-config to access applied datastore
- enables edit-config, copy-config, and commit to be executed
either synchronously or asynchronously
- defines 'get-diff' operation to diff datastores
- defines 'get-state' operation to return just state data
- defines 'sync-complete' notification for async requests";
revision 2016-02-02 {
description
"Initial revision";
reference
"RFC XXXXX: Terminology and Requirements for Enhanced Handling
of Operational State";
}
// features
feature sync {
description
"Indicates the server supports the 'sync' value for the
parameter in the operations ,
, and .";
}
feature async {
description
"Indicates the server supports the 'async' value for the
parameter in the operations ,
, and .";
}
// The following two augmentations enable 'applied' to be passed as a
// argument in the and operations.
augment /nc:get-config/nc:input/nc:source/nc:config-source {
description
"Allows 'applied' to be passed in ";
leaf applied {
type empty;
description
"Indicates that the applied configuration should be returned";
}
}
augment /nc:copy-config/nc:input/nc:source/nc:config-source {
description
"Allows 'applied' to be passed in ";
leaf applied {
type empty;
description
"Indicates that the applied configuration should be returned";
}
}
// The following two groupings define input and output parameters that
// are subsequently augmented into the edit-config, copy-config, and
// commit operations.
grouping sync-behavior-input {
description
"This grouping is augmented into the edit-config, copy-config,
and commit operations";
leaf sync-behavior {
type enumeration {
enum "sync" {
if-feature sync;
description
"Request the server to not return a response until both the
intended and applied configurations have been updated.";
}
enum "async" {
if-feature async;
description
"Request the server to not wait for the configuration to be
applied before returning a response. The response will
contain the 'sync-id' leaf. Later, after both the intended
and applied configurations have been updated, the server
will send the 'sync-complete' notification using the same
sync-id value.";
}
}
description
"This value specifies whether the server should process the
request synchronously or asynchronously.";
}
}
grouping sync-behavior-output {
description
"This grouping is augmented into the edit-config, copy-config,
and commit operations. The additional output is only returned
when 'sync-behavior' is specified, and thus does not alter
legacy behavior.";
choice request-type {
description
"This choice makes it explicit which content is possibly
returned for the two 'sync-behavior' values.";
case sync {
leaf apply-warning {
type empty;
description
"Indicates that a warning was generated when applying the
intended configuration to internal server components
(e.g., due to missing hardware) and hence the applied
configuration differs from the intended configuration.";
}
}
case async {
leaf sync-id {
type string;
description
"A server-specified value to identify the asynchronous
request. This value is returned whenever 'async' is
passed in the request. The server must ensure that it
is a unique value over some reasonable amount of time.";
}
}
}
}
// The following six augmentations are used to insert the
// sync-behavior-input and sync-behavior-output nodes into
// the edit-config, copy-config, and commit operations.
augment /nc:edit-config/nc:input {
description
"Allows 'sync-behavior' to be passed in .
When specified, the 'error-option' value is interpreted
as spanning both the updating of the intended and
applied configurations. Notably, when rollback-on-error
is set, both the intended and applied configurations
are restored to their initial states on error.";
uses sync-behavior-input {
when "nc:target/nc:running" {
description "only available when target is 'running'";
}
}
}
augment /nc:edit-config/nc:output {
description
"Allows 'apply-warning' and 'sync-id' to be returned
for operations.";
uses sync-behavior-output;
}
augment /nc:copy-config/nc:input {
description
"Allows 'sync-behavior' to be passed in ";
uses sync-behavior-input {
when "nc:target/nc:running" {
description "only available when target is 'running'";
}
}
}
augment /nc:copy-config/nc:output {
description
"Allows 'apply-warning' and 'sync-id' to be returned
for operations.";
uses sync-behavior-output;
}
augment /nc:commit/nc:input {
description
"Allows 'sync-behavior' to be passed in the
operation. The operation's atomic behavior
is extended to include both the updating of the
intended and applied configurations.";
uses sync-behavior-input;
}
augment /nc:commit/nc:output {
description
"Allows 'apply-warning' and 'sync-id' to be returned
for operations.";
uses sync-behavior-output;
}
// The following grouping is used by the get-diff RPC
grouping get-diff-source {
description
"This grouping is used by the 'get-diff' RPC's two
input parameters.";
choice config-source {
mandatory true;
description
"The configuration datastore to use as a source.";
leaf candidate {
if-feature nc:candidate;
type empty;
description
"The candidate configuration is the config source.";
}
leaf running {
type empty;
description
"The running configuration is the config source.";
}
leaf startup {
if-feature nc:startup;
type empty;
description
"The startup configuration is the config source.";
}
leaf applied {
type empty;
description
"The applied configuration is the config source.";
}
}
}
// The following RPC returns the diff between two datastores
rpc get-diff {
description
"Get the difference between two datastores in the form
of a YANG Patch (see RFC YYYY) that transforms 'source1'
into 'source2'. Specifying the same datastore for both
sources always returns an empty diff.";
input {
leaf format {
type enumeration {
enum edit-config { description ""; }
enum yang-patch { description ""; }
}
description "Selects output format";
}
container source1 {
description "the first of two datastores to compare";
uses get-diff-source;
}
container source2 {
description "the second of two datastores to compare";
uses get-diff-source;
}
}
output {
choice format {
case edit-config {
anyxml data {description "";}
}
case yang-patch {
uses yp:yang-patch;
}
description "";
}
}
}
// The following RPC returns just operational state nodes from
// the server.
rpc get-state {
description
"Retrieve operational state from the server. Operational state
is composed of both applied configuration and derived state.
Applied configuration is the subset of config true nodes that
is operational. Derived state is composed of just the config
false nodes.";
reference "RFC 6241, Section 7.7";
input {
choice type {
description
"An optional parameter to select if only applied configuration
or derived state nodes should be returned. If not specified,
then all node types are returned.";
leaf applied {
type empty;
description
"Only return matching applied configuration nodes";
}
leaf derived {
type empty;
description
"Only return matching derived state nodes";
}
}
anyxml filter {
mandatory true;
description
"This parameter specifies the portion of the applied
configuration and derived state data to retrieve.
";
nc:get-filter-element-attributes;
}
}
output {
anyxml data {
description
"Copy of the running datastore subset and/or state
data that matched the filter criteria (if any).
An empty data container indicates that the request
did not produce any results.";
}
}
}
// This following notification is used to alert clients when
// an asynchronous operation request has completed.
notification sync-complete {
description
"Sent by the server when an asynchronous operation
request has completed.";
leaf sync-id {
type string;
mandatory true;
description
"The server-specified unique identifier returned
to the client that requested the asynchronous
operation.";
}
choice response {
mandatory true;
leaf ok {
type empty;
description
"Indicates that the request processed successfully.";
}
leaf apply-warning {
type empty;
description
"Indicates that a warning was generated when applying the
intended configuration to internal server components
(e.g., due to missing hardware) and hence the applied
configuration differs from the intended configuration.";
}
container rpc-error {
leaf error-type {
type enumeration {
enum transport { description "transport"; }
enum rpc { description "rpc"; }
enum protocol { description "protocol"; }
enum application { description "application"; }
}
mandatory true;
description "error-type";
}
leaf error-tag {
type nc:error-tag-type;
mandatory true;
description "error-tag";
}
leaf error-severity {
type nc:error-severity-type;
mandatory true;
description "error-severity";
}
leaf error-app-tag {
type string;
description "error-app-tag";
}
leaf error-path {
type string;
description "error-path";
}
leaf error-message {
type string;
description "error-message";
}
container error-info {
leaf session-id {
type uint32;
description "session-id";
}
leaf bad-attribute {
type string;
description "bad-attribute";
}
leaf bad-element {
type string;
description "bad-element";
}
leaf ok-element {
type string;
description "ok-element";
}
leaf err-element {
type string;
description "err-element";
}
leaf noop-element {
type string;
description "noop-element";
}
leaf bad-namespace {
type string;
description "bad-namespace";
}
description "error-info";
}
description "rpc-error";
}
description "response";
}
}
}