module ietf-restconf {
namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
prefix "rc";
import ietf-yang-types { prefix yang; }
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
";
description
"This module contains conceptual YANG specifications
for the message and error content that is used in
RESTCONF protocol messages. A conceptual container
representing the RESTCONF API nodes is also defined
for the media type application/yang.api.
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) 2014 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-ietf-netconf-restconf-02.txt
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
revision 2014-10-07 {
description
"Initial revision.";
reference
"RFC XXXX: RESTCONF Protocol.";
}
typedef data-resource-identifier {
type string {
length "1 .. max";
}
description
"Contains a Data Resource Identifier formatted string
to identify a specific data resource instance.
The document root for all data resources is a
datastore resource container. Each top-level YANG
data nodes supported by the server will be represented
as a child node of the document root.
The canonical representation of a data resource identifier
includes the full server specification that is returned
in the Location header when a new data resource is created
with the POST method.
The abbreviated representation does not contain any server
location identification. Instead the identifier will start
with the '/' character to represent the datastore document
root for the data resource instance.
The server MUST accept either representation and SHOULD
return the canonical representation in any response message.";
reference
"RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
}
grouping errors {
description
"A grouping that contains a YANG container
representing the syntax and semantics of a
YANG Patch errors report within a response message.";
container errors {
description
"Represents an error report returned by the server if
a request results in an error.";
list error {
description
"An entry containing information about one
specific error that occurred while processing
a RESTCONF request.";
reference "RFC 6241, Section 4.3";
leaf error-type {
type enumeration {
enum transport {
description "The transport layer";
}
enum rpc {
description "The rpc or notification layer";
}
enum protocol {
description "The protocol operation layer";
}
enum application {
description "The server application layer";
}
}
mandatory true;
description
"The protocol layer where the error occurred.";
}
leaf error-tag {
type string;
mandatory true;
description
"The enumerated error tag.";
}
leaf error-app-tag {
type string;
description
"The application-specific error tag.";
}
choice error-node {
description
"The server will return the location of the error node
in a format that is appropriate for the protocol.
If no specific node within the request message body
caused the error then this choice will not be present.";
leaf error-path {
type instance-identifier;
description
"The YANG instance identifier associated
with the error node. This leaf will only be
present if the error node is not a data resource,
e.g., the error node is an input parameter
for an operation resource.";
}
leaf error-urlpath {
type data-resource-identifier;
description
"The target data resource identifier associated
with the error node. This leaf will only be
present if the error node is associated with
a data resource (either within the server or
in the request message).";
}
}
leaf error-message {
type string;
description
"A message describing the error.";
}
anyxml error-info {
description
"Arbitrary XML that represents a container
of additional information for the error report.";
}
}
}
} // grouping errors
grouping restconf {
container restconf {
description
"Conceptual container representing the
application/yang.api resource type.";
container data {
description
"Container representing the application/yang.datastore
resource type. Represents the conceptual root of all
operational data and configuration data supported by
the server. The child nodes of this container can be
any data resource (application/yang.data), which are
defined as top-level data nodes from the YANG modules
advertised by the server in the ietf-restconf-monitoring
module.";
}
container operations {
description
"Container for all operation resources
(application/yang.operation),
Each resource is represented as an empty leaf with the
name of the RPC operation from the YANG rpc statement.
E.g.;
POST /restconf/operations/show-log-errors
leaf show-log-errors {
type empty;
}
";
}
} // container restconf
} // grouping restconf
grouping notification {
description
"Contains the notification message wrapper definition.";
container notification {
description
"RESTCONF notification message wrapper.";
leaf event-time {
type yang:date-and-time;
mandatory true;
description
"The time the event was generated by the
event source.";
reference
"RFC 5277, section 4, element.";
}
/* The YANG-specific notification container is encoded
* after the 'event-time' element. The format
* corresponds to the notificationContent element
* in RFC 5277, section 4. For example:
*
* module example-one {
* ...
* notification event1 { ... }
*
* }
*
* Encoded as element 'event1' in the namespace
* for module 'example-one'.
*/
}
} // grouping notification
}