[ONOS-7304] YANG Runtime: YANG Push test for anydata
Change-Id: Ie2757343ef2598629c1e81b2f9ec5a265851e778
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
index 432a122..ff61df3 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/antlrgencode/GeneratedYangListener.java
@@ -1772,4 +1772,18 @@
* @param currentContext current context in the parsed tree
*/
void exitAnydataStatement(AnydataStatementContext currentContext);
+ /**
+ * Enters a parse tree produced by GeneratedYangParser for grammar rule
+ * YangStatement.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void enterYangStatement(YangStatementContext currentContext);
+ /**
+ * Exits a parse tree produced by GeneratedYangParser for grammar rule
+ * YangStatement.
+ *
+ * @param currentContext current context in the parsed tree
+ */
+ void exitYangStatement(YangStatementContext currentContext);
}
diff --git a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
index 749843f..ba038cd 100644
--- a/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
+++ b/compiler/base/parser/src/main/java/org/onosproject/yang/compiler/parser/impl/TreeWalkListener.java
@@ -24,6 +24,7 @@
import org.onosproject.yang.compiler.datamodel.utils.YangConstructType;
import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangListener;
import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.AnydataStatementContext;
+import org.onosproject.yang.compiler.parser.antlrgencode.GeneratedYangParser.YangStatementContext;
import org.onosproject.yang.compiler.parser.impl.listeners.AnydataListener;
import org.onosproject.yang.compiler.parser.impl.listeners.AppDataStructureListener;
import org.onosproject.yang.compiler.parser.impl.listeners.AppExtendedNameListener;
@@ -1956,6 +1957,16 @@
}
@Override
+ public void enterYangStatement(YangStatementContext currentContext) {
+ // do nothing
+ }
+
+ @Override
+ public void exitYangStatement(YangStatementContext currentContext) {
+ // do nothing
+ }
+
+ @Override
public void enterAnydataStatement(AnydataStatementContext ctx) {
AnydataListener.processAnydataEntry(this, ctx);
}
diff --git a/compiler/base/parser/src/main/resources/GeneratedYang.g4 b/compiler/base/parser/src/main/resources/GeneratedYang.g4
index e30e150..2203389 100644
--- a/compiler/base/parser/src/main/resources/GeneratedYang.g4
+++ b/compiler/base/parser/src/main/resources/GeneratedYang.g4
@@ -1225,8 +1225,8 @@
* *(data-def-stmt stmtsep)
* "}")
*/
- notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND | stmtSep
- LEFT_CURLY_BRACE ((ifFeatureStatement | statusStatement
+ notificationStatement : NOTIFICATION_KEYWORD identifier (STMTEND |
+ LEFT_CURLY_BRACE stmtSep ((ifFeatureStatement | statusStatement
| descriptionStatement | referenceStatement | typedefStatement
| defaultDenyAllStatement | groupingStatement | dataDefStatement)
stmtSep)* RIGHT_CURLY_BRACE);
@@ -1386,7 +1386,8 @@
* (";" / "{" *unknown-statement2 "}")
*/
unknownStatement : unknown string? (STMTEND
- | LEFT_CURLY_BRACE unknownStatement2* RIGHT_CURLY_BRACE);
+ | LEFT_CURLY_BRACE (yangStatement |unknownStatement2)*
+ RIGHT_CURLY_BRACE) stmtSep;
/**
* unknown-statement2 = [prefix ":"] identifier [sep string] optsep
@@ -1396,6 +1397,106 @@
| LEFT_CURLY_BRACE unknownStatement2* RIGHT_CURLY_BRACE);
/**
+ * yang-stmt as per RFC 7950
+ * yang-stmt = action-stmt / -- not handled
+ * anydata-stmt /
+ * anyxml-stmt /
+ * argument-stmt /
+ * augment-stmt /
+ * base-stmt /
+ * belongs-to-stmt /
+ * bit-stmt /
+ * case-stmt /
+ * choice-stmt /
+ * config-stmt /
+ * contact-stmt /
+ * container-stmt /
+ * default-stmt /
+ * description-stmt /
+ * deviate-add-stmt /
+ * deviate-delete-stmt /
+ * deviate-not-supported-stmt /
+ * deviate-replace-stmt /
+ * deviation-stmt /
+ * enum-stmt /
+ * error-app-tag-stmt /
+ * error-message-stmt /
+ * extension-stmt /
+ * feature-stmt /
+ * fraction-digits-stmt /
+ * grouping-stmt /
+ * identity-stmt /
+ * if-feature-stmt /
+ * import-stmt /
+ * include-stmt /
+ * input-stmt /
+ * key-stmt /
+ * leaf-list-stmt /
+ * leaf-stmt /
+ * length-stmt /
+ * list-stmt /
+ * mandatory-stmt /
+ * max-elements-stmt /
+ * min-elements-stmt /
+ * modifier-stmt / -- not handled
+ * module-stmt /
+ * must-stmt /
+ * namespace-stmt /
+ * notification-stmt /
+ * ordered-by-stmt /
+ * organization-stmt /
+ * output-stmt /
+ * path-stmt /
+ * pattern-stmt /
+ * position-stmt /
+ * prefix-stmt /
+ * presence-stmt /
+ * range-stmt /
+ * reference-stmt /
+ * refine-stmt /
+ * require-instance-stmt /
+ * revision-date-stmt /
+ * revision-stmt /
+ * rpc-stmt /
+ * status-stmt /
+ * submodule-stmt /
+ * typedef-stmt /
+ * type-stmt /
+ * unique-stmt /
+ * units-stmt /
+ * uses-augment-stmt / -- not handled
+ * uses-stmt /
+ * value-stmt /
+ * when-stmt /
+ * yang-version-stmt /
+ * yin-element-stmt
+ * ;; Ranges
+ */
+ yangStatement : anydataStatement
+ | anyxmlStatement | argumentStatement | augmentStatement
+ | baseStatement | belongstoStatement | bitStatement
+ | caseStatement | choiceStatement | configStatement
+ | contactStatement | containerStatement | defaultStatement
+ | descriptionStatement | deviationStatement | enumStatement
+ | errorAppTagStatement | errorMessageStatement | extensionStatement
+ | featureStatement | fractionDigitStatement | groupingStatement
+ | identityStatement | ifFeatureStatement | importStatement
+ | includeStatement | inputStatement | keyStatement
+ | leafListStatement | leafStatement | lengthStatement
+ | listStatement | mandatoryStatement | maxElementsStatement
+ | minElementsStatement | moduleStatement | mustStatement
+ | namespaceStatement | notificationStatement | orderedByStatement
+ | organizationStatement | outputStatement | pathStatement
+ | patternStatement | positionStatement | prefixStatement
+ | presenceStatement | rangeStatement | referenceStatement
+ | refineStatement | requireInstanceStatement | revisionDateStatement
+ | revisionStatement | rpcStatement | statusStatement
+ | subModuleStatement | typedefStatement | typeStatement
+ | uniqueStatement | unitsStatement | usesStatement
+ | valueStatement | whenStatement | yangVersionStatement
+ | yinElementStatement ;
+
+ /**
* stmtend = ";" / "{" *unknown-statement "}"
*/
stmtEnd : STMTEND | LEFT_CURLY_BRACE unknownStatement* RIGHT_CURLY_BRACE;
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAnydataTranslator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAnydataTranslator.java
index 598ac92..89c3a45 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAnydataTranslator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/javamodel/YangJavaAnydataTranslator.java
@@ -27,6 +27,7 @@
import static org.onosproject.yang.compiler.translator.tojava.GeneratedJavaFileType.GENERATE_INTERFACE_WITH_BUILDER;
import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateCodeAndUpdateInParent;
+import static org.onosproject.yang.compiler.translator.tojava.YangJavaModelUtils.generateJava;
/**
* Represents container information extended to support java code generation.
@@ -128,8 +129,7 @@
@Override
public void generateCodeExit() throws TranslatorException {
try {
- getTempJavaCodeFragmentFiles().generateJavaFile(
- GENERATE_INTERFACE_WITH_BUILDER, this);
+ generateJava(GENERATE_INTERFACE_WITH_BUILDER, this);
} catch (IOException e) {
throw new TranslatorException("Failed to generate code for " +
"anydata node " +
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/AnydataHandler.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/AnydataHandler.java
index 6541e3e..3f77147 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/AnydataHandler.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/AnydataHandler.java
@@ -18,9 +18,9 @@
import org.onosproject.yang.compiler.datamodel.AugmentedSchemaInfo;
import org.onosproject.yang.compiler.datamodel.SchemaDataNode;
-import org.onosproject.yang.compiler.datamodel.YangModule;
import org.onosproject.yang.compiler.datamodel.YangSchemaNode;
import org.onosproject.yang.compiler.datamodel.YangSchemaNodeContextInfo;
+import org.onosproject.yang.compiler.datamodel.YangVersionHolder;
import java.util.Iterator;
@@ -30,6 +30,7 @@
import static org.onosproject.yang.compiler.datamodel.utils.DataModelUtils.errorMsg;
import static org.onosproject.yang.runtime.RuntimeHelper.PERIOD;
import static org.onosproject.yang.runtime.impl.UtilsConstants.REV_REGEX;
+import static org.onosproject.yang.runtime.impl.YobConstants.DEFAULT;
public final class AnydataHandler {
@@ -100,17 +101,22 @@
info = it.next();
schema = info.getSchemaNode();
if (schema instanceof SchemaDataNode) {
- if (schema.getJavaAttributeName().equalsIgnoreCase(paths[i])) {
+ String name = paths[i];
+ if (i == paths.length - 1) {
+ name = name.replaceFirst(DEFAULT, "");
+ }
+ if (schema.getJavaAttributeName().equalsIgnoreCase(name)) {
isSuccess = true;
break;
}
}
}
if (!isSuccess) {
- // In case of augment the top level node will not be found in
- // above iteration.
- if (i == index && i < paths.length - 1) {
- AugmentedSchemaInfo in = ((YangModule) s).getAugmentedSchemaInfo(cn);
+ // In case of augment the node will not be found in above
+ // iteration.
+ if (i < paths.length - 1) {
+ AugmentedSchemaInfo in = ((YangVersionHolder) s)
+ .getAugmentedSchemaInfo(cn);
i = in.getPosition();
schema = in.getSchemaNode();
} else {
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-event-notifications.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-event-notifications.yang
new file mode 100644
index 0000000..a6a20b3
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-event-notifications.yang
@@ -0,0 +1,932 @@
+module yrt-ietf-event-notifications {
+ namespace
+ "urn:ietf:params:xml:ns:yang:yrt-ietf-event-notifications";
+
+ prefix notif-bis;
+
+ import yrt-ietf-yang-types {
+ prefix yang;
+ }
+ import yrt-ietf-inet-types {
+ prefix inet;
+ }
+ import yrt-ietf-interfaces {
+ prefix if;
+ }
+
+ organization "IETF";
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ WG Chair: Mahesh Jethanandani
+ <mailto:mjethanandani@gmail.com>
+ WG Chair: Mehmet Ersue
+ <mailto:mehmet.ersue@nokia.com>
+ Editor: Alexander Clemm
+ <mailto:alex@sympotech.com>
+ Editor: Alberto Gonzalez Prieto
+ <mailto:albertgo@cisco.com>
+ Editor: Eric Voit
+ <mailto:evoit@cisco.com>
+ Editor: Einar Nilsen-Nygaard
+ <mailto:einarnn@cisco.com>
+ Editor: Ambika Prasad Tripathy
+ <mailto:ambtripa@cisco.com>
+ Editor: Sharon Chisholm
+ <mailto:schishol@ciena.com>
+ Editor: Hector Trevino
+ <mailto:htrevino@cisco.com";
+
+ description
+ "This module contains conceptual YANG specifications
+ for NETCONF Event Notifications.";
+
+ revision 2016-10-27 {
+ description
+ "Tweaks to remove two notifications,
+ RPC for create subscription refined with stream default,
+ new grouping to eliminate some dymanically modifiable
+ parameters in modifiy subscription RPC";
+ reference
+ "draft-ietf-netconf-rfc5277bis-01";
+ }
+
+ /*
+ * FEATURES
+ */
+
+ feature json {
+ description
+ "This feature indicates that JSON encoding of notifications
+ is supported.";
+ }
+
+ feature configured-subscriptions {
+ description
+ "This feature indicates that management plane configuration
+ of subscription is supported.";
+ }
+
+ /*
+ * EXTENSIONS
+ */
+
+ extension control-plane-notif {
+ description
+ "This statement applies only to notifications.
+ It indicates that the notification is a control-plane
+ notification (aka OAM notification). Therefore it does
+ not participate in a regular event stream and does not
+ need to be specifically subscribed to.";
+ }
+
+ /*
+ * IDENTITIES
+ */
+
+ /* Identities for streams */
+ identity stream {
+ description
+ "Base identity to represent a generic stream of event
+ notifications.";
+ }
+
+ identity NETCONF1 {
+ base stream;
+ description
+ "Default NETCONF event stream, containing events based on
+ notifications defined as YANG modules that are supported
+ by the system.";
+ }
+
+ /* Identities for subscription results */
+ identity subscription-result {
+ description
+ "Base identity for RPC responses to requests surrounding
+ management (e.g. creation, modification, deletion) of
+ subscriptions.";
+ }
+
+ identity ok {
+ base subscription-result;
+ description
+ "OK - RPC was successful and was performed as requested.";
+ }
+
+ identity error {
+ base subscription-result;
+ description
+ "RPC was not successful.
+ Base identity for error return codes.";
+ }
+
+ identity error-no-such-subscription {
+ base error;
+ description
+ "A subscription with the requested subscription ID
+ does not exist.";
+ }
+
+ identity error-no-such-option {
+ base error;
+ description
+ "A requested parameter setting is not supported.";
+ }
+
+ identity error-insufficient-resources {
+ base error;
+ description
+ "The publisher has insufficient resources to support the
+ subscription as requested.";
+ }
+
+ identity error-configured-subscription {
+ base error;
+ description
+ "Cannot apply RPC to a configured subscription, i.e.
+ to a subscription that was not established via RPC.";
+ }
+
+ identity error-other {
+ base error;
+ description
+ "An unspecified error has occurred (catch all).";
+ }
+
+ /* Identities for subscription stream status */
+ identity subscription-stream-status {
+ description
+ "Base identity for the status of subscriptions and
+ datastreams.";
+ }
+ identity active {
+ base subscription-stream-status;
+ description
+ "Status is active and healthy.";
+ }
+
+ identity inactive {
+ base subscription-stream-status;
+ description
+ "Status is inactive, for example outside the
+ interval between start time and stop time.";
+ }
+
+ identity suspended {
+ base subscription-stream-status;
+ description
+ "The status is suspended, meaning that the publisher
+ is currently unable to provide the negotiated updates
+ for the subscription.";
+ }
+
+ identity in-error {
+ base subscription-stream-status;
+ description
+ "The status is in error or degraded, meaning that
+ stream and/or subscription is currently unable to provide
+ the negotiated notifications.";
+ }
+
+ /* Identities for subscription errors */
+ identity subscription-errors {
+ description
+ "Base identity for subscription error status.
+ This identity is not to be confused with error return
+ codes for RPCs";
+ }
+
+ identity internal-error {
+ base subscription-errors;
+ description
+ "Subscription failures caused by server internal error.";
+ }
+
+ identity no-resources {
+ base subscription-errors;
+ description
+ "Lack of resources, e.g. CPU, memory, bandwidth";
+ }
+ identity subscription-deleted {
+ base subscription-errors;
+ description
+ "The subscription was terminated because the subscription
+ was deleted.";
+ }
+
+ identity other {
+ base subscription-errors;
+ description
+ "Fallback reason - any other reason";
+ }
+
+ /* Identities for encodings */
+ identity encodings {
+ description
+ "Base identity to represent data encodings";
+ }
+
+ identity encode-xml {
+ base encodings;
+ description
+ "Encode data using XML";
+ }
+
+ identity encode-json {
+ base encodings;
+ description
+ "Encode data using JSON";
+ }
+
+ /* Identities for transports */
+ identity transport {
+ description
+ "An identity that represents a transport protocol for
+ event notifications";
+ }
+
+ identity netconf {
+ base transport;
+ description
+ "Netconf notifications as a transport.";
+ }
+
+ /*
+ * TYPEDEFs
+ */
+ typedef subscription-id {
+ type uint32;
+ description
+ "A type for subscription identifiers.";
+ }
+
+ typedef filter-id {
+ type uint32;
+ description
+ "A type to identify filters which can be associated with a
+ subscription.";
+ }
+
+ typedef subscription-result {
+ type identityref {
+ base subscription-result;
+ }
+ description
+ "The result of a subscription operation";
+ }
+
+ typedef subscription-term-reason {
+ type identityref {
+ base subscription-errors;
+ }
+ description
+ "Reason for a publisher to terminate a subscription.";
+ }
+
+ typedef subscription-susp-reason {
+ type identityref {
+ base subscription-errors;
+ }
+ description
+ "Reason for a publisher to suspend a subscription.";
+ }
+
+ typedef encoding {
+ type identityref {
+ base encodings;
+ }
+ description
+ "Specifies a data encoding, e.g. for a data subscription.";
+ }
+
+ typedef subscription-status {
+ type identityref {
+ base subscription-stream-status;
+ }
+ description
+ "Specifies the status of a subscription or datastream.";
+ }
+
+ typedef transport-protocol {
+ type identityref {
+ base transport;
+ }
+ description
+ "Specifies transport protocol used to send notifications to a
+ receiver.";
+ }
+
+ typedef push-source {
+ type enumeration {
+ enum "interface-originated" {
+ description
+ "Notifications will be sent from a specific interface on
+ a publisher";
+ }
+ enum "address-originated" {
+ description
+ "Notifications will be sent from a specific address on a
+ publisher";
+ }
+ }
+ description
+ "Specifies from where notifications will be sourced when
+ being sent by the publisher.";
+ }
+
+ typedef stream {
+ type identityref {
+ base stream;
+ }
+ description
+ "Specifies a system-provided datastream.";
+ }
+
+ typedef filter-ref {
+ type leafref {
+ path "/notif-bis:filters/notif-bis:filter/notif-bis:filter-id";
+ }
+ description
+ "This type is used to reference a filter.";
+ }
+ /*
+ * GROUPINGS
+ */
+
+ grouping base-filter {
+ description
+ "This grouping defines the base for filters for
+ notification events.
+ It includes the filter defined in 5277 and
+ it enables extending filtering to other
+ types of filters";
+ choice filter-type {
+ description
+ "A filter needs to be a single filter of a given type.
+ Mixing and matching of multiple filters does not occur
+ at the level of this grouping.";
+ case rfc5277 {
+ anyxml filter {
+ description
+ "Filter per RFC 5277. Notification filter.
+ If a filter element is specified to look for data of a
+ particular value, and the data item is not present
+ within a particular event notification for its value to
+ be checked against, the notification will be filtered
+ out. For example, if one were to check for
+ 'severity=critical' in a configuration event
+ notification where this field was not supported, then
+ the notification would be filtered out. For subtree
+ filtering, a non-empty node set means that the filter
+ matches. For XPath filtering, the mechanisms defined
+ in [XPATH] should be used to convert the returned
+ value to boolean.";
+ }
+ }
+ }
+ }
+
+ grouping subscription-info-basic-non-modifiable {
+ description
+ "This grouping describes the information in a basic
+ subscription request.";
+ leaf stream {
+ type stream;
+ description
+ "Indicates which stream of events is of interest.
+ If not present, events in the default NETCONF stream
+ will be sent.";
+ }
+ leaf encoding {
+ type encoding;
+ default "encode-xml";
+ description
+ "The type of encoding for the subscribed data.
+ Default is XML";
+ }
+ }
+
+ grouping subscription-info-basic-modifiable {
+ description
+ "This grouping describes some objects which may be changed
+ in a subscription via an RPC.";
+ uses base-filter;
+ leaf startTime {
+ type yang:date-and-time;
+ description
+ "Used to trigger the replay feature
+ and indicate that the replay should start at the time
+ specified. If <startTime> is not present, this is not a
+ replay subscription. It is not valid to specify start
+ times that are later than the current time. If the
+ <startTime> specified is earlier than the log can support,
+ the replay will begin with the earliest available
+ notification. This parameter is of type dateTime and
+ compliant to [RFC3339]. Implementations must
+ support time zones.";
+ }
+ leaf stopTime {
+ type yang:date-and-time;
+ must "current() > ../startTime" {
+ description
+ "stopTime must be used with and be later than <startTime>";
+ }
+ description
+ "Used with the optional replay feature to indicate the
+ newest notifications of interest. If <stopTime> is
+ not present, the notifications will continue until the
+ subscription is terminated. Must be used with and be
+ later than <startTime>. Values of <stopTime> in the
+ future are valid. This parameter is of type dateTime and
+ compliant to [RFC3339]. Implementations must support time
+ zones.";
+ }
+ }
+
+ grouping subscription-info-all-modifiable {
+ description
+ "This grouping describes all rpc modifiable objects in a
+ subscription.";
+ uses subscription-info-basic-modifiable {
+ augment "filter-type" {
+ description
+ "Post-5277 subscriptions allow references to existing
+ filters";
+ case by-reference {
+ description
+ "Incorporate a filter that has been configured
+ separately.";
+ leaf filter-ref {
+ type filter-ref;
+ description
+ "References filter which is associated with the
+ subscription.";
+ }
+ }
+ }
+ }
+ }
+
+ grouping subscription-info {
+ description
+ "This grouping describes information concerning a
+ subscription.";
+ uses subscription-info-basic-non-modifiable;
+ uses subscription-info-all-modifiable;
+ }
+
+ grouping push-source-info {
+ description
+ "Defines the sender source from which notifications
+ for a configured subscription are sent.";
+ choice push-source {
+ description
+ "Identifies the egress interface on the Publisher from
+ which notifications will or are being sent.";
+ case interface-originated {
+ description
+ "When the push source is out of an interface on the
+ Publisher established via static configuration.";
+ leaf source-interface {
+ type if:interface-ref;
+ description
+ "References the interface for notifications.";
+ }
+ }
+ case address-originated {
+ description
+ "When the push source is out of an IP address on the
+ Publisher established via static configuration.";
+ leaf source-vrf {
+ type uint32 {
+ range "16..1048574";
+ }
+ description
+ "Label of the vrf.";
+ }
+ leaf source-address {
+ type inet:ip-address-no-zone;
+ mandatory true;
+ description
+ "The source address for the notifications.";
+ }
+ }
+ }
+ }
+
+ grouping receiver-info {
+ description
+ "Defines where and how to deliver notifications for a
+ configured subscription. This includes
+ specifying the receiver, as well as defining
+ any network and transport aspects when sending of
+ notifications occurs outside of Netconf.";
+ container receivers {
+ notif-bis1:control-plane-notif;
+ description
+ "Set of receivers in a subscription.";
+ list receiver {
+ key "address";
+ min-elements 1;
+ description
+ "A single host or multipoint address intended as a target
+ for the notifications for a subscription.";
+ leaf address {
+ type inet:host;
+ mandatory true;
+ description
+ "Specifies the address for the traffic to reach a
+ remote host. One of the following must be
+ specified: an ipv4 address, an ipv6 address,
+ or a host name.";
+ }
+ leaf port {
+ type inet:port-number;
+ mandatory true;
+ description
+ "This leaf specifies the port number to use for
+ messages destined for a receiver.";
+ }
+ leaf protocol {
+ type transport-protocol;
+ default "netconf";
+ description
+ "This leaf specifies the transport protocol used
+ to deliver messages destined for the receiver.";
+ }
+ }
+ }
+ }
+
+ grouping subscription-response {
+ description
+ "Defines the output to the rpc's establish-subscription
+ and modify-subscription.";
+ leaf subscription-result {
+ type subscription-result;
+ mandatory true;
+ description
+ "Indicates whether subscription is operational,
+ or if a problem was encountered.";
+ }
+ choice result {
+ description
+ "Depending on the subscription result, different
+ data is returned.";
+ case success {
+ description
+ "This case is used when the subscription request
+ was successful and a subscription was created/modified
+ as a result";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "Identifier used for this subscription.";
+ }
+ }
+ case no-success {
+ description
+ "This case applies when a subscription request
+ was not successful and no subscription was
+ created (or modified) as a result. In this case,
+ information MAY be returned that indicates
+ suggested parameter settings that would have a
+ high likelihood of succeeding in a subsequent
+ establish-subscription or modify-subscription
+ request.";
+ uses subscription-info;
+ }
+ }
+ }
+
+ /*
+ * RPCs
+ */
+
+ rpc establish-subscription {
+ description
+ "This RPC allows a subscriber to create
+ (and possibly negotiate) a subscription on its own behalf.
+ If successful, the subscription
+ remains in effect for the duration of the subscriber's
+ association with the publisher, or until the subscription
+ is terminated by virtue of a delete-subscription request.
+ In case an error (as indicated by subscription-result)
+ is returned, the subscription is
+ not created. In that case, the RPC output
+ MAY include suggested parameter settings
+ that would have a high likelihood of succeeding in a
+ subsequent establish-subscription request.";
+ input {
+ uses subscription-info;
+ }
+ output {
+ uses subscription-response;
+ }
+ }
+
+ rpc create-subscription {
+ description
+ "This operation initiates an event notification subscription
+ that will send asynchronous event notifications to the
+ initiator of the command until the association terminates.
+ It is not possible to modify or delete a subscription
+ that was created using this operation. It is included for
+ reasons of backward compatibility with RFC 5277
+ implementations.";
+ input {
+ uses subscription-info-basic-non-modifiable{
+ refine "stream" {
+ default "NETCONF1";
+ }
+ }
+ uses subscription-info-basic-modifiable;
+ }
+ }
+
+ rpc modify-subscription {
+ description
+ "This RPC allows a subscriber to modify a subscription
+ that was previously created using establish-subscription.
+ If successful, the subscription
+ remains in effect for the duration of the subscriber's
+ association with the publisher, or until the subscription
+ is terminated by virtue of a delete-subscription request.
+ In case an error is returned (as indicated by
+ subscription-result), the subscription is
+ not modified and the original subscription parameters
+ remain in effect. In that case, the rpc error response
+ MAY include suggested parameter settings
+ that would have a high likelihood of succeeding in a
+ subsequent modify-subscription request.";
+ input {
+ leaf subscription-id {
+ type subscription-id;
+ description
+ "Identifier to use for this subscription.";
+ }
+ uses subscription-info-all-modifiable;
+ }
+ output {
+ uses subscription-response;
+ }
+ }
+
+ rpc delete-subscription {
+ description
+ "This RPC allows a subscriber to delete a subscription that
+ was previously created using establish-subscription.";
+ input {
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "Identifier of the subscription that is to be deleted.
+ Only subscriptions that were created using
+ establish-subscription can be deleted via this RPC.";
+ }
+ }
+ output {
+ leaf subscription-result {
+ type subscription-result;
+ mandatory true;
+ description
+ "Indicates whether subscription is operational,
+ or if a problem was encountered.";
+ }
+ }
+ }
+
+ /*
+ * NOTIFICATIONS
+ */
+
+ notification replay-complete {
+ notif-bis:control-plane-notif;
+ description
+ "This notification is sent to indicate that all of the
+ replay notifications have been sent. It must not be
+ sent for any other reason.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ }
+
+ notification notification-complete {
+ notif-bis:control-plane-notif;
+ description
+ "This notification is sent to indicate that a
+ subscription, which includes a stop time, has
+ finished passing events.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ }
+
+ notification subscription-started {
+ notif-bis:control-plane-notif;
+ description
+ "This notification indicates that a subscription has
+ started and notifications are beginning to be sent.
+ This notification shall only be sent to receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ uses subscription-info;
+ }
+
+ notification subscription-suspended {
+ notif-bis:control-plane-notif;
+ description
+ "This notification indicates that a suspension of the
+ subscription by the publisher has occurred. No further
+ notifications will be sent until subscription
+ resumes.
+ This notification shall only be sent to receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ leaf reason {
+ type subscription-susp-reason;
+ description
+ "Provides a reason for why the subscription was
+ suspended.";
+ }
+ }
+
+ notification subscription-resumed {
+ notif-bis:control-plane-notif;
+ description
+ "This notification indicates that a subscription that had
+ previously been suspended has resumed. Notifications
+ will once again be sent.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ }
+
+ notification subscription-modified {
+ notif-bis:control-plane-notif;
+ description
+ "This notification indicates that a subscription has
+ been modified. Notifications sent from this point
+ on will conform to the modified terms of the
+ subscription.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ uses subscription-info;
+ }
+
+ notification subscription-terminated {
+ notif-bis:control-plane-notif;
+ description
+ "This notification indicates that a subscription has been
+ terminated.";
+ leaf subscription-id {
+ type subscription-id;
+ mandatory true;
+ description
+ "This references the affected subscription.";
+ }
+ leaf reason {
+ type subscription-term-reason;
+ description
+ "Provides a reason for why the subscription was
+ terminated.";
+ }
+ }
+
+ /*
+ * DATA NODES
+ */
+
+ container streams {
+ config false;
+ description
+ "This container contains a leaf list of built-in
+ streams that are provided by the system.";
+ leaf-list stream {
+ type stream;
+ description
+ "Identifies the built-in streams that are supported by the
+ system. Built-in streams are associated with their own
+ identities, each of which carries a special semantics.
+ In case configurable custom streams are supported,
+ as indicated by the custom-stream identity, the
+ configuration of those custom streams is provided
+ separately.";
+ }
+ }
+ container filters {
+ description
+ "This container contains a list of configurable filters
+ that can be applied to subscriptions. This facilitates
+ the reuse of complex filters once defined.";
+ list filter {
+ key "filter-id";
+ description
+ "A list of configurable filters that can be applied to
+ subscriptions.";
+ leaf filter-id {
+ type filter-id;
+ description
+ "An identifier to differentiate between filters.";
+ }
+ uses base-filter;
+ }
+ }
+ container subscription-config {
+ if-feature "configured-subscriptions";
+ description
+ "Contains the list of subscriptions that are configured,
+ as opposed to established via RPC or other means.";
+ list subscription {
+ key "subscription-id";
+ description
+ "Content of a subscription.";
+ leaf subscription-id {
+ type subscription-id;
+ description
+ "Identifier to use for this subscription.";
+ }
+ uses subscription-info;
+ uses receiver-info {
+ if-feature "configured-subscriptions";
+ }
+ uses push-source-info {
+ if-feature "configured-subscriptions";
+ }
+ }
+ }
+ container subscriptions {
+ config false;
+ description
+ "Contains the list of currently active subscriptions,
+ i.e. subscriptions that are currently in effect,
+ used for subscription management and monitoring purposes.
+ This includes subscriptions that have been setup via RPC
+ primitives, e.g. create-subscription, establish-
+ subscription, and modify-subscription, as well as
+ subscriptions that have been established via
+ configuration.";
+ list subscription {
+ key "subscription-id";
+ config false;
+ description
+ "Content of a subscription.
+ Subscriptions can be created using a control channel
+ or RPC, or be established through configuration.";
+ leaf subscription-id {
+ type subscription-id;
+ description
+ "Identifier of this subscription.";
+ }
+
+ leaf configured-subscription {
+ if-feature "configured-subscriptions";
+ type empty;
+ description
+ "The presence of this leaf indicates that the
+ subscription originated from configuration, not
+ through a control channel or RPC.";
+ }
+
+ leaf subscription-status {
+ type subscription-status;
+ description
+ "The status of the subscription.";
+ }
+ uses subscription-info;
+ uses receiver-info {
+ if-feature "configured-subscriptions";
+ }
+ uses push-source-info {
+ if-feature "configured-subscriptions";
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-interfaces.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-interfaces.yang
new file mode 100644
index 0000000..082a304
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-interfaces.yang
@@ -0,0 +1,680 @@
+module yrt-ietf-interfaces {
+
+ namespace "urn:ietf:params:xml:ns:yang:yrt-ietf-interfaces";
+ prefix if;
+
+ import yrt-ietf-yang-types {
+ prefix yang;
+ revision-date "2013-07-15";
+ }
+
+ organization
+ "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
+
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netmod/>
+ WG List: <mailto:netmod@ietf.org>
+ WG Chair: Thomas Nadeau
+ <mailto:tnadeau@lucidvision.com>
+ WG Chair: Juergen Schoenwaelder
+ <mailto:j.schoenwaelder@jacobs-university.de>
+ Editor: Martin Bjorklund
+ <mailto:mbj@tail-f.com>";
+
+ description
+ "This module contains a collection of YANG definitions for
+ managing network interfaces.
+ 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 7223; see
+ the RFC itself for full legal notices.";
+
+ revision 2014-05-08 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 7223: A YANG Data Model for Interface Management";
+ }
+
+ /*
+ * Typedefs
+ */
+
+ typedef interface-ref {
+ type leafref {
+ path "/if:interfaces/if:interface/if:name";
+ }
+ description
+ "This type is used by data models that need to reference
+ configured interfaces.";
+ }
+
+ typedef interface-state-ref {
+ type leafref {
+ path "/if:interfaces-state/if:interface/if:name";
+ }
+ description
+ "This type is used by data models that need to reference
+ the operationally present interfaces.";
+ }
+
+ /*
+ * Identities
+ */
+
+ identity interface-type {
+ description
+ "Base identity from which specific interface types are
+ derived.";
+ }
+
+ /*
+ * Features
+ */
+
+ feature arbitrary-names {
+ description
+ "This feature indicates that the device allows user-controlled
+ interfaces to be named arbitrarily.";
+ }
+ feature pre-provisioning {
+ description
+ "This feature indicates that the device supports
+ pre-provisioning of interface configuration, i.e., it is
+ possible to configure an interface whose physical interface
+ hardware is not present on the device.";
+ }
+
+ feature if-mib {
+ description
+ "This feature indicates that the device implements
+ the IF-MIB.";
+ reference
+ "RFC 2863: The Interfaces Group MIB";
+ }
+
+ /*
+ * Configuration data nodes
+ */
+
+ container interfaces {
+ description
+ "Interface configuration parameters.";
+
+ list interface {
+ key "name";
+
+ description
+ "The list of configured interfaces on the device.
+ The operational state of an interface is available in the
+ /interfaces-state/interface list. If the configuration of a
+ system-controlled interface cannot be used by the system
+ (e.g., the interface hardware present does not match the
+ interface type), then the configuration is not applied to
+ the system-controlled interface shown in the
+ /interfaces-state/interface list. If the configuration
+ of a user-controlled interface cannot be used by the system,
+ the configured interface is not instantiated in the
+ /interfaces-state/interface list.";
+
+ leaf name {
+ type string;
+ description
+ "The name of the interface.
+ A device MAY restrict the allowed values for this leaf,
+ possibly depending on the type of the interface.
+ For system-controlled interfaces, this leaf is the
+ device-specific name of the interface. The 'config false'
+ list /interfaces-state/interface contains the currently
+ existing interfaces on the device.
+ If a client tries to create configuration for a
+ system-controlled interface that is not present in the
+ /interfaces-state/interface list, the server MAY reject
+ the request if the implementation does not support
+ pre-provisioning of interfaces or if the name refers to
+ an interface that can never exist in the system. A
+ NETCONF server MUST reply with an rpc-error with the
+ error-tag 'invalid-value' in this case.
+ If the device supports pre-provisioning of interface
+ configuration, the 'pre-provisioning' feature is
+ advertised.
+ If the device allows arbitrarily named user-controlled
+ interfaces, the 'arbitrary-names' feature is advertised.
+ When a configured user-controlled interface is created by
+ the system, it is instantiated with the same name in the
+ /interface-state/interface list.";
+ }
+
+ leaf description {
+ type string;
+ description
+ "A textual description of the interface.
+ A server implementation MAY map this leaf to the ifAlias
+ MIB object. Such an implementation needs to use some
+ mechanism to handle the differences in size and characters
+ allowed between this leaf and ifAlias. The definition of
+ such a mechanism is outside the scope of this document.
+ Since ifAlias is defined to be stored in non-volatile
+ storage, the MIB implementation MUST map ifAlias to the
+ value of 'description' in the persistently stored
+ datastore.
+ Specifically, if the device supports ':startup', when
+ ifAlias is read the device MUST return the value of
+ 'description' in the 'startup' datastore, and when it is
+ written, it MUST be written to the 'running' and 'startup'
+ datastores. Note that it is up to the implementation to
+ decide whether to modify this single leaf in 'startup' or
+ perform an implicit copy-config from 'running' to
+ 'startup'.
+ If the device does not support ':startup', ifAlias MUST
+ be mapped to the 'description' leaf in the 'running'
+ datastore.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifAlias";
+ }
+
+ leaf type {
+ type identityref {
+ base interface-type;
+ }
+ mandatory true;
+ description
+ "The type of the interface.
+ When an interface entry is created, a server MAY
+ initialize the type leaf with a valid value, e.g., if it
+ is possible to derive the type from the name of the
+ interface.
+ If a client tries to set the type of an interface to a
+ value that can never be used by the system, e.g., if the
+ type is not supported or if the type does not match the
+ name of the interface, the server MUST reject the request.
+ A NETCONF server MUST reply with an rpc-error with the
+ error-tag 'invalid-value' in this case.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifType";
+ }
+
+ leaf enabled {
+ type boolean;
+ default "true";
+ description
+ "This leaf contains the configured, desired state of the
+ interface.
+ Systems that implement the IF-MIB use the value of this
+ leaf in the 'running' datastore to set
+ IF-MIB.ifAdminStatus to 'up' or 'down' after an ifEntry
+ has been initialized, as described in RFC 2863.
+ Changes in this leaf in the 'running' datastore are
+ reflected in ifAdminStatus, but if ifAdminStatus is
+ changed over SNMP, this leaf is not affected.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
+ }
+
+ leaf link-up-down-trap-enable {
+ if-feature if-mib;
+ type enumeration {
+ enum enabled {
+ value 1;
+ }
+ enum disabled {
+ value 2;
+ }
+ }
+ description
+ "Controls whether linkUp/linkDown SNMP notifications
+ should be generated for this interface.
+ If this node is not configured, the value 'enabled' is
+ operationally used by the server for interfaces that do
+ not operate on top of any other interface (i.e., there are
+ no 'lower-layer-if' entries), and 'disabled' otherwise.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifLinkUpDownTrapEnable";
+ }
+ }
+ }
+
+ /*
+ * Operational state data nodes
+ */
+
+ container interfaces-state {
+ config false;
+ description
+ "Data nodes for the operational state of interfaces.";
+
+ list interface {
+ key "name";
+
+
+
+
+
+ description
+ "The list of interfaces on the device.
+ System-controlled interfaces created by the system are
+ always present in this list, whether they are configured or
+ not.";
+
+ leaf name {
+ type string;
+ description
+ "The name of the interface.
+ A server implementation MAY map this leaf to the ifName
+ MIB object. Such an implementation needs to use some
+ mechanism to handle the differences in size and characters
+ allowed between this leaf and ifName. The definition of
+ such a mechanism is outside the scope of this document.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifName";
+ }
+
+ leaf type {
+ type identityref {
+ base interface-type;
+ }
+ mandatory true;
+ description
+ "The type of the interface.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifType";
+ }
+
+ leaf admin-status {
+ if-feature if-mib;
+ type enumeration {
+ enum up {
+ value 1;
+ description
+ "Ready to pass packets.";
+ }
+ enum down {
+ value 2;
+ description
+ "Not ready to pass packets and not in some test mode.";
+ }
+
+
+
+ enum testing {
+ value 3;
+ description
+ "In some test mode.";
+ }
+ }
+ mandatory true;
+ description
+ "The desired state of the interface.
+ This leaf has the same read semantics as ifAdminStatus.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifAdminStatus";
+ }
+
+ leaf oper-status {
+ type enumeration {
+ enum up {
+ value 1;
+ description
+ "Ready to pass packets.";
+ }
+ enum down {
+ value 2;
+ description
+ "The interface does not pass any packets.";
+ }
+ enum testing {
+ value 3;
+ description
+ "In some test mode. No operational packets can
+ be passed.";
+ }
+ enum unknown {
+ value 4;
+ description
+ "Status cannot be determined for some reason.";
+ }
+ enum dormant {
+ value 5;
+ description
+ "Waiting for some external event.";
+ }
+ enum not-present {
+ value 6;
+ description
+ "Some component (typically hardware) is missing.";
+ }
+ enum lower-layer-down {
+ value 7;
+ description
+ "Down due to state of lower-layer interface(s).";
+ }
+ }
+ mandatory true;
+ description
+ "The current operational state of the interface.
+ This leaf has the same semantics as ifOperStatus.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifOperStatus";
+ }
+
+ leaf last-change {
+ type yang:date-and-time;
+ description
+ "The time the interface entered its current operational
+ state. If the current state was entered prior to the
+ last re-initialization of the local network management
+ subsystem, then this node is not present.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifLastChange";
+ }
+
+ leaf if-index {
+ if-feature if-mib;
+ type int32 {
+ range "1..2147483647";
+ }
+ mandatory true;
+ description
+ "The ifIndex value for the ifEntry represented by this
+ interface.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifIndex";
+ }
+
+ leaf phys-address {
+ type yang:phys-address;
+ description
+ "The interface's address at its protocol sub-layer. For
+ example, for an 802.x interface, this object normally
+ contains a Media Access Control (MAC) address. The
+ interface's media-specific modules must define the bit
+ and byte ordering and the format of the value of this
+ object. For interfaces that do not have such an address
+ (e.g., a serial line), this node is not present.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifPhysAddress";
+ }
+
+ leaf-list higher-layer-if {
+ type interface-state-ref;
+ description
+ "A list of references to interfaces layered on top of this
+ interface.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifStackTable";
+ }
+
+ leaf-list lower-layer-if {
+ type interface-state-ref;
+ description
+ "A list of references to interfaces layered underneath this
+ interface.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifStackTable";
+ }
+
+ leaf speed {
+ type yang:gauge64;
+ units "bits/second";
+ description
+ "An estimate of the interface's current bandwidth in bits
+ per second. For interfaces that do not vary in
+ bandwidth or for those where no accurate estimation can
+ be made, this node should contain the nominal bandwidth.
+ For interfaces that have no concept of bandwidth, this
+ node is not present.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifSpeed, ifHighSpeed";
+ }
+
+
+
+
+
+
+
+
+
+ container statistics {
+ description
+ "A collection of interface-related statistics objects.";
+
+ leaf discontinuity-time {
+ type yang:date-and-time;
+ mandatory true;
+ description
+ "The time on the most recent occasion at which any one or
+ more of this interface's counters suffered a
+ discontinuity. If no such discontinuities have occurred
+ since the last re-initialization of the local management
+ subsystem, then this node contains the time the local
+ management subsystem re-initialized itself.";
+ }
+
+ leaf in-octets {
+ type yang:counter64;
+ description
+ "The total number of octets received on the interface,
+ including framing characters.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifHCInOctets";
+ }
+
+ leaf in-unicast-pkts {
+ type yang:counter64;
+ description
+ "The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, that were not addressed to a
+ multicast or broadcast address at this sub-layer.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifHCInUcastPkts";
+ }
+
+
+
+
+ leaf in-broadcast-pkts {
+ type yang:counter64;
+ description
+ "The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, that were addressed to a broadcast
+ address at this sub-layer.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifHCInBroadcastPkts";
+ }
+
+ leaf in-multicast-pkts {
+ type yang:counter64;
+ description
+ "The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, that were addressed to a multicast
+ address at this sub-layer. For a MAC-layer protocol,
+ this includes both Group and Functional addresses.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifHCInMulticastPkts";
+ }
+
+ leaf in-discards {
+ type yang:counter32;
+ description
+ "The number of inbound packets that were chosen to be
+ discarded even though no errors had been detected to
+ prevent their being deliverable to a higher-layer
+ protocol. One possible reason for discarding such a
+ packet could be to free up buffer space.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+
+
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifInDiscards";
+ }
+
+ leaf in-errors {
+ type yang:counter32;
+ description
+ "For packet-oriented interfaces, the number of inbound
+ packets that contained errors preventing them from being
+ deliverable to a higher-layer protocol. For character-
+ oriented or fixed-length interfaces, the number of
+ inbound transmission units that contained errors
+ preventing them from being deliverable to a higher-layer
+ protocol.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifInErrors";
+ }
+
+ leaf in-unknown-protos {
+ type yang:counter32;
+ description
+ "For packet-oriented interfaces, the number of packets
+ received via the interface that were discarded because
+ of an unknown or unsupported protocol. For
+ character-oriented or fixed-length interfaces that
+ support protocol multiplexing, the number of
+ transmission units received via the interface that were
+ discarded because of an unknown or unsupported protocol.
+ For any interface that does not support protocol
+ multiplexing, this counter is not present.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifInUnknownProtos";
+ }
+
+
+
+
+
+ leaf out-octets {
+ type yang:counter64;
+ description
+ "The total number of octets transmitted out of the
+ interface, including framing characters.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifHCOutOctets";
+ }
+
+ leaf out-unicast-pkts {
+ type yang:counter64;
+ description
+ "The total number of packets that higher-level protocols
+ requested be transmitted, and that were not addressed
+ to a multicast or broadcast address at this sub-layer,
+ including those that were discarded or not sent.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifHCOutUcastPkts";
+ }
+
+ leaf out-broadcast-pkts {
+ type yang:counter64;
+ description
+ "The total number of packets that higher-level protocols
+ requested be transmitted, and that were addressed to a
+ broadcast address at this sub-layer, including those
+ that were discarded or not sent.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifHCOutBroadcastPkts";
+ }
+
+
+ leaf out-multicast-pkts {
+ type yang:counter64;
+ description
+ "The total number of packets that higher-level protocols
+ requested be transmitted, and that were addressed to a
+ multicast address at this sub-layer, including those
+ that were discarded or not sent. For a MAC-layer
+ protocol, this includes both Group and Functional
+ addresses.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB -
+ ifHCOutMulticastPkts";
+ }
+
+ leaf out-discards {
+ type yang:counter32;
+ description
+ "The number of outbound packets that were chosen to be
+ discarded even though no errors had been detected to
+ prevent their being transmitted. One possible reason
+ for discarding such a packet could be to free up buffer
+ space.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifOutDiscards";
+ }
+
+ leaf out-errors {
+ type yang:counter32;
+ description
+ "For packet-oriented interfaces, the number of outbound
+ packets that could not be transmitted because of errors.
+ For character-oriented or fixed-length interfaces, the
+ number of outbound transmission units that could not be
+ transmitted because of errors.
+ Discontinuities in the value of this counter can occur
+ at re-initialization of the management system, and at
+ other times as indicated by the value of
+ 'discontinuity-time'.";
+ reference
+ "RFC 2863: The Interfaces Group MIB - ifOutErrors";
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-restconf.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-restconf.yang
new file mode 100644
index 0000000..96df901
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-restconf.yang
@@ -0,0 +1,253 @@
+module yrt-ietf-restconf {
+ yang-version 1.1;
+ namespace "urn:ietf:params:xml:ns:yang:yrt-ietf-restconf";
+ prefix "rc";
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <https://datatracker.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ description
+ "This module contains conceptual YANG specifications
+ for basic RESTCONF media type definitions used in
+ RESTCONF protocol messages.
+ Note that the YANG definitions within this module do not
+ represent configuration data of any kind.
+ The 'restconf-media-type' YANG extension statement
+ provides a normative syntax for XML and JSON
+ message-encoding purposes.
+ Copyright (c) 2017 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 8040; see
+ the RFC itself for full legal notices.";
+
+ revision 2017-01-26 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 8040: RESTCONF Protocol.";
+ }
+
+ extension yang-data {
+ argument name {
+ yin-element true;
+ }
+ description
+ "This extension is used to specify a YANG data template that
+ 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 extension is ignored unless it appears as a top-level
+ statement. It MUST contain data definition statements
+ that result in exactly one container data node definition.
+ An instance of a 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 values for the YANG module using
+ the extension statement are assigned to instance document data
+ conforming to the data definition statements within
+ this extension.
+ The substatements 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 substatements 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 substatements are constrained
+ when used within a '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 are limited to the module
+ containing this extension statement and the modules
+ imported into that module.
+ ";
+ }
+
+ /* rc:yang-data yang-errors {
+ uses errors;
+ }
+
+ rc:yang-data yang-api {
+ uses restconf;
+ } */
+
+ grouping errors {
+ description
+ "A grouping that contains a YANG container
+ representing the syntax and semantics of a
+ YANG Patch error 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.";
+ }
+
+ leaf error-path {
+ type instance-identifier;
+ description
+ "The YANG instance identifier associated
+ with the error node.";
+ }
+
+ leaf error-message {
+ type string;
+ description
+ "A message describing the error.";
+ }
+
+ anydata error-info {
+ description
+ "This anydata value MUST represent a container with
+ zero or more data nodes representing additional
+ error information.";
+ }
+ }
+ }
+ }
+
+ grouping restconf {
+ description
+ "Conceptual grouping representing the RESTCONF
+ root resource.";
+
+ container restconf {
+ description
+ "Conceptual container representing the RESTCONF
+ root resource.";
+
+ container data {
+ description
+ "Container representing the datastore resource.
+ Represents the conceptual root of all state data
+ and configuration data supported by the server.
+ The child nodes of this container can be any data
+ resources that are defined as top-level data nodes
+ from the YANG modules advertised by the server in
+ the 'ietf-yang-library' module.";
+ }
+
+ container operations {
+ description
+ "Container for all operation resources.
+ Each resource is represented as an empty leaf with the
+ name of the RPC operation from the YANG 'rpc' statement.
+ For example, the 'system-restart' RPC operation defined
+ in the 'ietf-system' module would be represented as
+ an empty leaf in the 'ietf-system' namespace. This is
+ a conceptual leaf and will not actually be found in
+ the module:
+ module ietf-system {
+ leaf system-reset {
+ type empty;
+ }
+ }
+ To invoke the 'system-restart' RPC operation:
+ POST /restconf/operations/ietf-system:system-restart
+ To discover the RPC operations supported by the server:
+ GET /restconf/operations
+ In XML, the YANG module namespace identifies the module:
+ <system-restart
+ xmlns='urn:ietf:params:xml:ns:yang:ietf-system'/>
+ In JSON, the YANG module name identifies the module:
+ { 'ietf-system:system-restart' : [null] }
+ ";
+ }
+
+ leaf yang-library-version {
+ type string {
+ pattern '\d{4}-\d{2}-\d{2}';
+ }
+ config false;
+ mandatory true;
+ description
+ "Identifies the revision date of the 'ietf-yang-library'
+ module that is implemented by this RESTCONF server.
+ Indicates the year, month, and day in YYYY-MM-DD
+ numeric format.";
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-patch.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-patch.yang
new file mode 100644
index 0000000..210b95e
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-patch.yang
@@ -0,0 +1,376 @@
+module yrt-ietf-yang-patch {
+ yang-version 1.1;
+ namespace "urn:ietf:params:xml:ns:yang:yrt-ietf-yang-patch";
+ prefix "ypatch";
+
+ import yrt-ietf-restconf { prefix rc; }
+
+ organization
+ "IETF NETCONF (Network Configuration) Working Group";
+
+ contact
+ "WG Web: <https://datatracker.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ Author: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Author: Martin Bjorklund
+ <mailto:mbj@tail-f.com>
+ Author: Kent Watsen
+ <mailto:kwatsen@juniper.net>";
+
+ 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) 2017 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 8072; see
+ the RFC itself for full legal notices.";
+
+ revision 2017-02-22 {
+ description
+ "Initial revision.";
+ reference
+ "RFC 8072: YANG Patch Media Type.";
+ }
+
+ typedef target-resource-offset {
+ type string;
+ description
+ "Contains a data resource identifier string representing
+ a sub-resource within the target resource.
+ The document root for this expression is the
+ target resource that is specified in the
+ protocol operation (e.g., the URI for the PATCH request).
+ This string is encoded according to the same rules as those
+ for a data resource identifier in a RESTCONF request URI.";
+ reference
+ "RFC 8040, Section 3.5.3.";
+ }
+/*
+ rc:yang-data "yang-patch" {
+ uses yang-patch;
+ }
+
+ rc:yang-data "yang-patch-status" {
+ uses yang-patch-status;
+ }
+*/
+ 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 YANG Patch operation.
+ 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 7950, Section 8.3.";
+
+ leaf patch-id {
+ type string;
+ mandatory true;
+ description
+ "An arbitrary string provided by the client to identify
+ the entire patch. Error messages returned by the server
+ that pertain to this patch will be identified by this
+ 'patch-id' value. A client SHOULD attempt to generate
+ unique 'patch-id' values to distinguish between
+ transactions from multiple clients in any audit logs
+ maintained by the server.";
+ }
+
+ leaf comment {
+ type string;
+ 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.
+ The 'edit' list is applied in the following manner:
+ - The first edit is conceptually applied to a copy
+ of the existing target datastore, e.g., the
+ running configuration datastore.
+ - Each ascending edit is conceptually applied to
+ the result of the previous edit(s).
+ - After all edits have been successfully processed,
+ the result is validated according to YANG constraints.
+ - If successful, the server will attempt to apply
+ the result to the target datastore.";
+
+ leaf edit-id {
+ type string;
+ description
+ "Arbitrary string index for the edit.
+ Error messages returned by the server that pertain
+ 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. The
+ 'target' leaf identifies the data node to be
+ created, not the parent data node.";
+ }
+ 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. If the 'where'
+ parameter is set to 'before' or 'after', then
+ the 'point' parameter identifies the insertion
+ point for the target node.";
+ }
+ 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. If the 'where' parameter
+ is set to 'before' or 'after', then the 'point'
+ parameter identifies the insertion point to move
+ the target node.";
+ }
+ 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 node for the edit
+ operation. If the target has the value '/', then
+ the target data node is the target resource.
+ The target node MUST identify a data resource,
+ not the datastore resource.";
+ }
+
+ leaf point {
+ when "(../operation = 'insert' or ../operation = 'move')"
+ + "and (../where = 'before' or ../where = 'after')" {
+ description
+ "This 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
+ "This 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'.";
+ }
+
+ anydata value {
+ when "../operation = 'create' "
+ + "or ../operation = 'merge' "
+ + "or ../operation = 'replace' "
+ + "or ../operation = 'insert'" {
+ description
+ "The anydata 'value' is only used for 'create',
+ 'merge', 'replace', and 'insert' operations.";
+ }
+ description
+ "Value used for this edit operation. The anydata 'value'
+ contains the target resource associated with the
+ 'target' leaf.
+ For example, suppose the target node is a YANG container
+ named foo:
+ container foo {
+ leaf a { type string; }
+ leaf b { type int32; }
+ }
+ The 'value' node contains one instance of foo:
+ <value>
+ <foo xmlns='example-foo-namespace'>
+ <a>some value</a>
+ <b>42</b>
+ </foo>
+ </value>
+ ";
+ }
+ }
+ }
+
+ } // grouping yang-patch
+
+ grouping yang-patch-status {
+
+ description
+ "A grouping that contains a YANG container representing the
+ syntax and semantics of a 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;
+ mandatory true;
+ 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 that
+ are 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.
+ If all edits succeeded and the 'global-status'
+ returned is 'ok', then a server MAY omit this
+ container.";
+
+ 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.";
+ }
+ 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
+
+}
\ No newline at end of file
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-push.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-push.yang
new file mode 100644
index 0000000..9df4bde
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/yrt-ietf-yang-push.yang
@@ -0,0 +1,565 @@
+ module yrt-ietf-yang-push {
+ /*
+ * ---------------------------------------------------
+ * Not Supported
+ yang-version 1.1;
+ * ---------------------------------------------------
+ */
+ namespace "urn:ietf:params:xml:ns:yang:yrt-ietf-yang-push";
+ prefix yp;
+
+ import yrt-ietf-inet-types {
+ prefix inet;
+ }
+ import yrt-ietf-yang-types {
+ prefix yang;
+ }
+ import yrt-ietf-event-notifications {
+ prefix notif-bis;
+ }
+
+ organization "IETF";
+ contact
+ "WG Web: <http://tools.ietf.org/wg/netconf/>
+ WG List: <mailto:netconf@ietf.org>
+ WG Chair: Mahesh Jethanandani
+ <mailto:mjethanandani@gmail.com>
+ WG Chair: Mehmet Ersue
+ <mailto:mehmet.ersue@nokia.com>
+ Editor: Alexander Clemm
+ <mailto:alex@sympotech.com>
+ Editor: Eric Voit
+ <mailto:evoit@cisco.com>
+ Editor: Alberto Gonzalez Prieto
+ <mailto:albertgo@cisco.com>
+ Editor: Ambika Prasad Tripathy
+ <mailto:ambtripa@cisco.com>
+ Editor: Einar Nilsen-Nygaard
+ <mailto:einarnn@cisco.com>
+ Editor: Andy Bierman
+ <mailto:andy@yumaworks.com>
+ Editor: Balazs Lengyel
+ <mailto:balazs.lengyel@ericsson.com>";
+
+ description
+ "This module contains conceptual YANG specifications
+ for YANG push.";
+
+ revision 2016-10-28 {
+ description
+ "Updates to simplify modify-subscription, add anchor-time";
+ reference "YANG Datastore Push, draft-ietf-netconf-yang-push-04";
+ }
+
+ feature on-change {
+ description
+ "This feature indicates that on-change updates are
+ supported.";
+ }
+
+ /*
+ * IDENTITIES
+ */
+
+ /* Additional errors for subscription operations */
+ identity error-data-not-authorized {
+ base notif-bis:error;
+ description
+ "No read authorization for a requested data node.";
+ }
+
+ /* Additional types of streams */
+
+ identity yang-push {
+ base notif-bis:stream;
+ description
+ "A conceptual datastream consisting of all datastore
+ updates, including operational and configuration data.";
+ }
+
+ identity custom-stream {
+ base notif-bis:stream;
+ description
+ "A conceptual datastream for datastore
+ updates with custom updates as defined by a user.";
+ }
+
+ /* Additional transport option */
+ identity http2 {
+ base notif-bis:transport;
+ description
+ "HTTP2 notifications as a transport";
+ }
+
+ /*
+ * TYPE DEFINITIONS
+ */
+
+ typedef filter-id {
+ type uint32;
+ description
+ "A type to identify filters which can be associated with a
+ subscription.";
+ }
+
+ typedef change-type {
+ type enumeration {
+ enum "create" {
+ description
+ "A new data node was created";
+ }
+ enum "delete" {
+ description
+ "A data node was deleted";
+ }
+ enum "modify" {
+ description
+ "The value of a data node has changed";
+ }
+ }
+ description
+ "Specifies different types of changes that may occur
+ to a datastore.";
+ }
+
+
+ grouping update-filter {
+ description
+ "This groupings defines filters for push updates for a
+ datastore tree. The filters define which updates are of
+ interest in a push update subscription. Mixing and matching
+ of multiple filters does not occur at the level of this
+ grouping. When a push-update subscription is created, the
+ filter can be a regular subscription filter, or one of the
+ additional filters that are defined in this grouping.";
+ choice update-filter {
+ description
+ "Define filters regarding which data nodes to include
+ in push updates";
+ case subtree {
+ description
+ "Subtree filter.";
+ anyxml subtree-filter {
+ description
+ "Subtree-filter used to specify the data nodes targeted
+ for subscription within a subtree, or subtrees, of a
+ conceptual YANG datastore. Objects matching the filter
+ criteria will traverse the filter. The syntax follows
+ the subtree filter syntax specified in RFC 6241,
+ section 6.";
+ reference "RFC 6241 section 6";
+ }
+ }
+ case xpath {
+ description
+ "XPath filter";
+ leaf xpath-filter {
+ type yang:xpath1.0;
+ description
+ "Xpath defining the data items of interest.";
+ }
+ }
+ }
+ }
+
+ grouping update-policy {
+ description
+ "This grouping describes the conditions under which an
+ update will be sent as part of an update stream.";
+ choice update-trigger {
+ description
+ "Defines necessary conditions for sending an event to
+ the subscriber.";
+ case periodic {
+ description
+ "The agent is requested to notify periodically the
+ current values of the datastore or the subset
+ defined by the filter.";
+ leaf period {
+ type yang:timeticks;
+ mandatory true;
+ description
+ "Duration of time which should occur between periodic
+ push updates. Where the anchor of a start-time is
+ available, the push will include the objects and their
+ values which exist at an exact multiple of timeticks
+ aligning to this start-time anchor.";
+ }
+ leaf anchor-time {
+ type yang:date-and-time;
+ description
+ "Designates a timestamp from which the series of
+ periodic push updates are computed. The next update
+ will take place at the next period interval from the
+ anchor time. For example, for an anchor time at the
+ top of a minute and a period interval of a minute,
+ the next update will be sent at the top of the next
+ minute.";
+ }
+ }
+ case on-change {
+ if-feature "on-change";
+ description
+ "The agent is requested to notify changes in
+ values in the datastore or a subset of it defined
+ by a filter.";
+ leaf no-synch-on-start {
+ type empty;
+ description
+ "This leaf acts as a flag that determines behavior at the
+ start of the subscription. When present,
+ synchronization of state at the beginning of the
+ subscription is outside the scope of the subscription.
+ Only updates about changes that are observed from the
+ start time, i.e. only push-change-update notifications
+ are sent.
+ When absent (default behavior), in order to facilitate
+ a receiver's synchronization, a full update is sent
+ when the subscription starts using a push-update
+ notification, just like in the case of a periodic
+ subscription. After that, push-change-update
+ notifications only are sent unless the Publisher chooses
+ to resynch the subscription again.";
+ }
+ leaf dampening-period {
+ type yang:timeticks;
+ mandatory true;
+ description
+ "Minimum amount of time that needs to have
+ passed since the last time an update was
+ provided.";
+ }
+ leaf-list excluded-change {
+ type change-type;
+ description
+ "Use to restrict which changes trigger an update.
+ For example, if modify is excluded, only creation and
+ deletion of objects is reported.";
+ }
+ }
+ }
+ }
+
+ grouping subscription-qos {
+ description
+ "This grouping describes Quality of Service information
+ concerning a subscription. This information is passed to lower
+ layers for transport priortization and treatment";
+ leaf dscp {
+ if-feature "notif-bis:configured-subscriptions";
+ type inet:dscp;
+ default "0";
+ description
+ "The push update's IP packet transport priority.
+ This is made visible across network hops to receiver.
+ The transport priority is shared for all receivers of
+ a given subscription.";
+ }
+ leaf subscription-priority {
+ type uint8;
+ description
+ "Relative priority for a subscription. Allows an
+ underlying transport layer perform informed load
+ balance allocations between various subscriptions";
+ }
+ leaf subscription-dependency {
+ type string;
+ description
+ "Provides the Subscription ID of a parent subscription
+ without which this subscription should not exist. In
+ other words, there is no reason to stream these objects
+ if another subscription is missing.";
+ }
+ }
+
+ augment "/notif-bis:establish-subscription/notif-bis:input" {
+ description
+ "Define additional subscription parameters that apply
+ specifically to push updates";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:establish-subscription/notif-bis:input/"+
+ "notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:establish-subscription/notif-bis:output" {
+ description
+ "Allow to return additional subscription parameters that apply
+ specifically to push updates.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:establish-subscription/notif-bis:output/"+
+ "notif-bis:result/notif-bis:no-success/notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:modify-subscription/notif-bis:input" {
+ description
+ "Define additional subscription parameters that apply
+ specifically to push updates.";
+ uses update-policy;
+ }
+ augment "/notif-bis:modify-subscription/notif-bis:input/"+
+ "notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:modify-subscription/notif-bis:output" {
+ description
+ "Allow to retun additional subscription parameters that apply
+ specifically to push updates.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:modify-subscription/notif-bis:output/"+
+ "notif-bis:result/notif-bis:no-success/notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ notification push-update {
+ description
+ "This notification contains a push update, containing
+ data subscribed to via a subscription.
+ This notification is sent for periodic updates, for a
+ periodic subscription. It can also be used for
+ synchronization updates of an on-change subscription.
+ This notification shall only be sent to receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ leaf subscription-id {
+ type notif-bis:subscription-id;
+ mandatory true;
+ description
+ "This references the subscription because of which the
+ notification is sent.";
+ }
+ leaf time-of-update {
+ type yang:date-and-time;
+ description
+ "This leaf contains the time of the update.";
+ }
+ leaf updates-not-sent {
+ type empty;
+ description
+ "This is a flag which indicates that not all data nodes
+ subscribed to are included included with this
+ update. In other words, the publisher has failed to
+ fulfill its full subscription obligations.
+ This may lead to intermittent loss of synchronization
+ of data at the client. Synchronization at the client
+ can occur when the next push-update is received.";
+ }
+ /*
+ * --------------------------------------------------------------------
+ * datastore-contents not currently supported.
+ * Will replace datastore-contents-string in a future release.
+ anydata datastore-contents {
+ description
+ "This contains the updated data. It constitutes a snapshot
+ at the time-of-update of the set of data that has been
+ subscribed to. The format and syntax of the data
+ corresponds to the format and syntax of data that would be
+ returned in a corresponding get operation with the same
+ filter parameters applied.";
+ }
+ * --------------------------------------------------------------------
+ */
+ leaf datastore-contents-string {
+ type string;
+ description
+ "This contains the updated data. It constitutes a snapshot
+ at the time-of-update of the set of data that has been
+ subscribed to. The format and syntax of the data
+ corresponds to the format and syntax of data that would be
+ returned in a corresponding get operation with the same
+ filter parameters applied.";
+ }
+ /*
+ * --------------------------------------------------------------------
+ */
+
+ }
+ notification push-change-update {
+ if-feature "on-change";
+ description
+ "This notification contains an on-change push update.
+ This notification shall only be sent to the receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ leaf subscription-id {
+ type notif-bis:subscription-id;
+ mandatory true;
+ description
+ "This references the subscription because of which the
+ notification is sent.";
+ }
+ leaf time-of-update {
+ type yang:date-and-time;
+ description
+ "This leaf contains the time of the update, i.e. the
+ time at which the change was observed.";
+ }
+ leaf updates-not-sent {
+ type empty;
+ description
+ "This is a flag which indicates that not all changes which
+ have occured since the last update are included with this
+ update. In other words, the publisher has failed to
+ fulfill its full subscription obligations, for example in
+ cases where it was not able to keep up with a change burst.
+ To facilitate synchronization, a publisher MAY subsequently
+ send a push-update containing a full snapshot of subscribed
+ data. Such a push-update might also be triggered by a
+ subscriber requesting an on-demand synchronization.";
+ }
+ /*
+ * --------------------------------------------------------------------
+ * datastore-changes not currently supported.
+ * Will replace datastore-change-string in a future release.
+ anydata datastore-changes {
+ description
+ "This contains datastore contents that has changed
+ since the previous update, per the terms of the
+ subscription. Changes are encoded analogous to
+ the syntax of a corresponding yang-patch operation,
+ i.e. a yang-patch operation applied to the YANG datastore
+ implied by the previous update to result in the current
+ state (and assuming yang-patch could also be applied to
+ operational data).";
+ }
+ *
+ * --------------------------------------------------------------------
+ */
+ leaf datastore-changes-string {
+ type string;
+ description
+ "This contains datastore contents that has changed
+ since the previous update, per the terms of the
+ subscription. Changes are encoded analogous to
+ the syntax of a corresponding yang-patch operation,
+ i.e. a yang-patch operation applied to the YANG datastore
+ implied by the previous update to result in the current
+ state (and assuming yang-patch could also be applied to
+ operational data).";
+ }
+ /*
+ * --------------------------------------------------------------------
+ */
+
+ }
+ augment "/notif-bis:subscription-started" {
+ description
+ "This augmentation adds push subscription parameters
+ to the notification that a subscription has
+ started and data updates are beginning to be sent.
+ This notification shall only be sent to receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:subscription-started/notif-bis:filter-type" {
+ description
+ "This augmentation allows to include additional update filters
+ options to be included as part of the notification that a
+ subscription has started.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:subscription-modified" {
+ description
+ "This augmentation adds push subscription parameters
+ to the notification that a subscription has
+ been modified.
+ This notification shall only be sent to receivers
+ of a subscription; it does not constitute a general-purpose
+ notification.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:subscription-modified/notif-bis:filter-type" {
+ description
+ "This augmentation allows to include additional update
+ filters options to be included as part of the notification
+ that a subscription has been modified.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:filters/notif-bis:filter/"+
+ "notif-bis:filter-type" {
+ description
+ "This container adds additional update filter options
+ to the list of configurable filters
+ that can be applied to subscriptions. This facilitates
+ the reuse of complex filters once defined.";
+ case update-filter {
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:subscription-config/notif-bis:subscription" {
+ description
+ "Contains the list of subscriptions that are configured,
+ as opposed to established via RPC or other means.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:subscription-config/notif-bis:subscription/"+
+ "notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ uses update-filter;
+ }
+ }
+ augment "/notif-bis:subscriptions/notif-bis:subscription" {
+ description
+ "Contains the list of currently active subscriptions,
+ i.e. subscriptions that are currently in effect,
+ used for subscription management and monitoring purposes.
+ This includes subscriptions that have been setup via RPC
+ primitives, e.g. establish-subscription, delete-subscription,
+ and modify-subscription, as well as subscriptions that
+ have been established via configuration.";
+ uses update-policy;
+ uses subscription-qos;
+ }
+ augment "/notif-bis:subscriptions/notif-bis:subscription/"+
+ "notif-bis:filter-type" {
+ description
+ "Add push filters to selection of filter types.";
+ case update-filter {
+ description
+ "Additional filter options for push subscription.";
+ uses update-filter;
+ }
+ }
+ }