module ietf-yang-patch {
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-patch";
prefix "ypatch";
import ietf-inet-types { prefix inet; }
import ietf-restconf { prefix rc; }
organization
"IETF NETCONF (Network Configuration) Working Group";
contact
"WG Web:
WG List:
WG Chair: Bert Wijnen
WG Chair: Mehmet Ersue
Editor: Andy Bierman
Editor: Martin Bjorklund
Editor: Kent Watsen
Editor: Rex Fernando
";
description
"This module contains conceptual YANG specifications
for the YANG Patch and YANG Patch Status data structures.
Note that the YANG definitions within this module do not
represent configuration data of any kind.
The YANG grouping statements provide a normative syntax
for XML and JSON message encoding purposes.
Copyright (c) 2013 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.: replace XXXX with actual RFC number and remove this
// note.
// RFC Ed.: remove this note
// Note: extracted from draft-bierman-netconf-yang-patch-00.txt
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
revision 2013-12-21 {
description
"Initial revision.";
reference
"RFC XXXX: YANG Patch";
}
typedef target-resource-offset {
type string {
length "1 .. max";
}
description
"Contains a relative Data Resource Identifier formatted string
to identify a specific data sub-resource instance.
The document root for all data resources is a
target data resource that is specified in the
object definition using this data type.";
}
grouping yang-patch {
description
"A grouping that contains a YANG container
representing the syntax and semantics of a
YANG Patch edit request message.";
container yang-patch {
description
"Represents a conceptual sequence of datastore edits,
called a patch. Each patch is given a client-assigned
patch identifier. Each edit MUST be applied
in ascending order, and all edits MUST be applied.
If any errors occur, then the target datastore MUST NOT
be changed by the patch operation.
A patch MUST be validated by the server to be a
well-formed message before any of the patch edits
are validated or attempted.
YANG datastore validation (defined in RFC 6020, section
8.3.3) is performed after all edits have been
individually validated.
It is possible for a datastore constraint violation to occur
due to any node in the datastore, including nodes not
included in the edit list. Any validation errors MUST
be reported in the reply message.";
reference
"RFC 6020, section 8.3.";
leaf patch-id {
type string;
description
"An arbitrary string provided by the client to identify
the entire patch. This value SHOULD be present in any
audit logging records generated by the server for the
patch. Error messages returned by the server pertaining
to this patch will be identified by this patch-id value.";
}
leaf comment {
type string {
length "0 .. 1024";
}
description
"An arbitrary string provided by the client to describe
the entire patch. This value SHOULD be present in any
audit logging records generated by the server for the
patch.";
}
list edit {
key edit-id;
ordered-by user;
description
"Represents one edit within the YANG Patch
request message.";
leaf edit-id {
type string;
description
"Arbitrary string index for the edit.
Error messages returned by the server pertaining
to a specific edit will be identified by this
value.";
}
leaf operation {
type enumeration {
enum create {
description
"The target data node is created using the
supplied value, only if it does not already
exist.";
}
enum delete {
description
"Delete the target node, only if the data resource
currently exists, otherwise return an error.";
}
enum insert {
description
"Insert the supplied value into a user-ordered
list or leaf-list entry. The target node must
represent a new data resource.";
}
enum merge {
description
"The supplied value is merged with the target data
node.";
}
enum move {
description
"Move the target node. Reorder a user-ordered
list or leaf-list. The target node must represent
an existing data resource.";
}
enum replace {
description
"The supplied value is used to replace the target
data node.";
}
enum remove {
description
"Delete the target node if it currently exists.";
}
}
mandatory true;
description
"The datastore operation requested for the associated
edit entry";
}
leaf target {
type target-resource-offset;
mandatory true;
description
"Identifies the target data resource for the edit
operation.";
}
leaf point {
when "(../operation = 'insert' or " +
"../operation = 'move') and " +
"(../where = 'before' or ../where = 'after')" {
description
"Point leaf only applies for insert or move
operations, before or after an existing entry.";
}
type target-resource-offset;
description
"The absolute URL path for the data node that is being
used as the insertion point or move point for the
target of this edit entry.";
}
leaf where {
when "../operation = 'insert' or ../operation = 'move'" {
description
"Where leaf only applies for insert or move
operations.";
}
type enumeration {
enum before {
description
"Insert or move a data node before the data resource
identified by the 'point' parameter.";
}
enum after {
description
"Insert or move a data node after the data resource
identified by the 'point' parameter.";
}
enum first {
description
"Insert or move a data node so it becomes ordered
as the first entry.";
}
enum last {
description
"Insert or move a data node so it becomes ordered
as the last entry.";
}
}
default last;
description
"Identifies where a data resource will be inserted or
moved. YANG only allows these operations for
list and leaf-list data nodes that are ordered-by
user.";
}
anyxml value {
when "(../operation = 'create' or " +
"../operation = 'merge' " +
"or ../operation = 'replace' or " +
"../operation = 'insert')" {
description
"Value node only used for create, merge,
replace, and insert operations";
}
description
"Value used for this edit operation.";
}
}
}
} // grouping yang-patch
grouping yang-patch-status {
description
"A grouping that contains a YANG container
representing the syntax and semantics of
YANG Patch status response message.";
container yang-patch-status {
description
"A container representing the response message
sent by the server after a YANG Patch edit
request message has been processed.";
leaf patch-id {
type string;
description
"The patch-id value used in the request";
}
choice global-status {
description
"Report global errors or complete success.
If there is no case selected then errors
are reported in the edit-status container.";
case global-errors {
uses rc:errors;
description
"This container will be present if global
errors unrelated to a specific edit occurred.";
}
leaf ok {
type empty;
description
"This leaf will be present if the request succeeded
and there are no errors reported in the edit-status
container.";
}
}
container edit-status {
description
"This container will be present if there are
edit-specific status responses to report.";
list edit {
key edit-id;
description
"Represents a list of status responses,
corresponding to edits in the YANG Patch
request message. If an edit entry was
skipped or not reached by the server,
then this list will not contain a corresponding
entry for that edit.";
leaf edit-id {
type string;
description
"Response status is for the edit list entry
with this edit-id value.";
}
choice edit-status-choice {
description
"A choice between different types of status
responses for each edit entry.";
leaf ok {
type empty;
description
"This edit entry was invoked without any
errors detected by the server associated
with this edit.";
}
leaf location {
type inet:uri;
description
"Contains the Location header value that would be
returned if this edit causes a new resource to be
created. If the edit identified by the same edit-id
value was successfully invoked and a new resource
was created, then this field will be returned
instead of 'ok'.";
}
case errors {
uses rc:errors;
description
"The server detected errors associated with the
edit identified by the same edit-id value.";
}
}
}
}
}
} // grouping yang-patch-status
}