[ONOS-7331] YANG Runtime: Add UT to validate te-scheduler based anydata.
Change-Id: Id92d44eb3a4eecc084a62157e3ee60ae07ddcd74
diff --git a/runtime/src/test/resources/schemaProviderTestYangFiles/actn-ietf-schedule@2017-03-06.yang b/runtime/src/test/resources/schemaProviderTestYangFiles/actn-ietf-schedule@2017-03-06.yang
new file mode 100644
index 0000000..3fdd3dd
--- /dev/null
+++ b/runtime/src/test/resources/schemaProviderTestYangFiles/actn-ietf-schedule@2017-03-06.yang
@@ -0,0 +1,224 @@
+ module actn-ietf-schedule {
+ yang-version 1.1;
+ namespace "urn:ietf:params:xml:ns:yang:actn-ietf-schedule";
+
+ prefix "sch";
+ import yrt-ietf-yang-types {
+ prefix "yang";
+ }
+
+ organization "TBD";
+ contact "TBD";
+ description
+ "The model allows time scheduling parameters to be specified.";
+
+ revision "2017-03-06" {
+ description "Initial revision";
+ reference "TBD";
+ }
+
+ /*
+ * Typedefs
+ */
+ typedef operation {
+ type enumeration {
+ enum configure {
+ description
+ "Create the configuration data.";
+ }
+ enum deconfigure {
+ description
+ "Remove the configuration data.";
+ }
+ enum set {
+ description
+ "Set the specified configuration data.";
+ }
+ enum reset {
+ description
+ "Revert the specified configuration data back to the
+ original value.";
+ }
+ }
+ description "Operation type.";
+ }
+ /*
+ * Groupings
+ */
+
+ grouping schedule-config-attributes {
+ description
+ "A group of attributes for a schedule.";
+
+ leaf inclusive-exclusive {
+ type enumeration {
+ enum inclusive {
+ description
+ "The schedule element is inclusive, i.e., the schedule
+ specifies the time at which the element is enabled.";
+ }
+ enum exclusive {
+ description
+ "The schedule element is exclusive. i.e., the schedule
+ specifies the time at which the element is disabled.";
+ }
+ }
+ default "inclusive";
+ description
+ "Whether the list item is inclusive or exclusive.";
+ }
+ leaf start {
+ type yang:date-and-time;
+ description "Start time.";
+ }
+ leaf schedule-duration {
+ type string {
+ pattern
+ 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?';
+ }
+ description "Schedule duration in ISO 8601 format.";
+ }
+ leaf repeat-interval {
+ type string {
+ pattern
+ 'R\d*/P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?'
+ + '(\d+S)?';
+ }
+ description "Repeat interval in ISO 8601 format.";
+ }
+ } // schedule-config-attributes
+
+ grouping schedule-config-notification {
+ description
+ "A group of attributes for a schedule notification.";
+
+/****TODO: FIXME: cannot handle notification as child under a container??
+ notification execution {
+ description
+ "Notification event for an execution performed on a target
+ object.";
+ leaf operation {
+ type operation;
+ mandatory true;
+ description "Operation type.";
+ }
+ leaf datetime {
+ type yang:date-and-time;
+ description
+ "The date and time when the execution was performed.";
+ }
+ anydata results {
+ description
+ "This chunk of data contains the results of the execution
+ performed on the target object. The results are the same
+ or equivalent to the contents of a <rpc-reply> message,
+ Because of the nature of such a target execution, a
+ <rpc-reply> message is not used to return the execution
+ results. Instead, this notification is used to serve
+ the same purpose.";
+ }
+ }
+***TODO: FIXME***/
+ } // schedule-config-notification
+
+ grouping schedule-state-attributes {
+ description
+ "State attributes for a schedule.";
+ container future-executions {
+ description
+ "The state information of the nexte scheduled event.";
+ list execution {
+ key "start";
+ description
+ "List of scheduled future executions.";
+ leaf start {
+ type yang:date-and-time;
+ description "Start time.";
+ }
+ leaf duration {
+ type string {
+ pattern
+ 'P(\d+Y)?(\d+M)?(\d+W)?(\d+D)?T(\d+H)?(\d+M)?(\d+S)?';
+ }
+ description "Schedule duration in ISO 8601 format.";
+ }
+ leaf operation {
+ type operation;
+ description "Operation type.";
+ }
+ } // event
+ } // future-events
+ } // schedule-state-attributes
+
+ grouping schedules {
+ description
+ "A list of schedules defining when a particular
+ configuration takes effect.";
+ container schedules {
+ description
+ "Container of a schedule list defining when a particular
+ configuration takes effect.";
+ list schedule {
+ key "schedule-id";
+ description "A list of schedule elements.";
+ leaf schedule-id {
+ type uint32;
+ description "Identifies the schedule element.";
+ }
+ uses schedule-config-attributes;
+ }
+ }
+ } // schedules
+
+ /*
+ * Configuration data and operational state nodes
+ */
+ container configuration-schedules {
+ description
+ "Serves as top-level container for a list of configuration
+ schedules.";
+ list target {
+ key "object";
+ description
+ "A list of targets that configuration schedules are
+ applied.";
+ leaf object {
+ type yang:xpath1.0;
+ description
+ "Xpath defining the data items of interest.";
+ }
+ leaf operation {
+ type operation;
+ default "configure";
+ description
+ "Operation type.";
+ }
+
+ anydata data-value {
+ description
+ "The data value applied to the leaf data node
+ specified by data-objects.
+ The format of the data value depends on the value of the
+ leaf operation defined above:
+ configure: data-value is the sub-tree added to the
+ target object;
+ deconfigure: data-value is the child to be deleted from
+ the target object;
+ set: the target object MULST be a leaf, and
+ data-value is the new value to be set to
+ the target object;
+ reset: data-value is ignored.";
+ }
+
+ uses schedules;
+ container state {
+ config false;
+ description
+ "Operational state data.";
+ uses schedule-state-attributes;
+ } // state
+
+ uses schedule-config-notification;
+ } // target
+ } // configuration-schedules
+ }