module ietf-schedule {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-schedule";
prefix schedule;
import ietf-yang-types {
prefix yang;
reference
"RFC 9911: Common YANG Data Types";
}
import ietf-system {
prefix sys;
reference
"RFC 7317: A YANG Data Model for System Management";
}
organization
"IETF NETMOD Working Group";
contact
"WG Web:
WG List:
Editor: Qiufang Ma
Author: Qin Wu
Editor: Mohamed Boucadair
Author: Daniel King
";
description
"This YANG module defines a set of common types and groupings
that are applicable for scheduling purposes, such as events,
policies, services, or resources based on date and time.
The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
'MAY', and 'OPTIONAL' in this document are to be interpreted as
described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
they appear in all capitals, as shown here.
Copyright (c) 2026 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 Revised
BSD License set forth in Section 4.c of the IETF Trust's
Legal Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC 9922; see
the RFC itself for full legal notices.
All revisions of IETF and IANA-maintained modules can be found
in the 'YANG Parameters' registry group
(https://www.iana.org/assignments/yang-parameters).";
revision 2026-03-10 {
description
"Initial revision.";
reference
"RFC 9922: A Common YANG Data Model for Scheduling";
}
feature basic-recurrence {
description
"Indicates that the server supports configuring a basic
scheduled recurrence.";
}
feature icalendar-recurrence {
description
"Indicates that the server supports configuring a comprehensive
scheduled iCalendar recurrence.";
reference
"RFC 5545: Internet Calendaring and Scheduling Core Object
Specification (iCalendar),
Sections 3.3.10 and 3.8.5";
}
typedef weekday {
type enumeration {
enum sunday {
value 0;
description
"Sunday of the week.";
}
enum monday {
value 1;
description
"Monday of the week.";
}
enum tuesday {
value 2;
description
"Tuesday of the week.";
}
enum wednesday {
value 3;
description
"Wednesday of the week.";
}
enum thursday {
value 4;
description
"Thursday of the week.";
}
enum friday {
value 5;
description
"Friday of the week.";
}
enum saturday {
value 6;
description
"Saturday of the week.";
}
}
description
"Seven days of the week.";
}
typedef duration {
type string {
pattern '((\+)?|\-)P((([0-9]+)D)?(T(0[0-9]|1[0-9]|2[0-3])'
+ ':[0-5][0-9]:[0-5][0-9]))|P([0-9]+)W';
}
description
"Duration of the time. The format can represent nominal
durations (weeks designated by 'W' and days designated by 'D')
and accurate durations (hours:minutes:seconds follows the
designator 'T').
Note that this value type doesn't support the 'Y' and 'M'
designators to specify durations in terms of years and months.
Negative durations are typically used to schedule an alarm to
trigger before an associated time.";
reference
"RFC 5545: Internet Calendaring and Scheduling Core Object
Specification (iCalendar), Sections 3.3.6 and
3.8.6.3";
}
identity schedule-type {
description
"Base identity for schedule type.";
}
identity one-shot {
base schedule-type;
description
"Indicates a one-shot schedule. That is a schedule that
will trigger an action with the duration being specified as
0 or end time being specified as the same as the start time,
and then the schedule will disable itself.";
}
identity period {
base schedule-type;
description
"Indicates a period-based schedule consisting of either a
start and end or a start and positive duration of time. If
neither an end nor a duration is indicated, the period is
considered to last forever.";
}
identity recurrence {
base schedule-type;
description
"Indicates a recurrence-based schedule.";
}
identity frequency-type {
description
"Base identity for frequency type.";
}
identity secondly {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a second or more.";
}
identity minutely {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a minute or more.";
}
identity hourly {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
an hour or more.";
}
identity daily {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a day or more.";
}
identity weekly {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a week or more.";
}
identity monthly {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a month or more.";
}
identity yearly {
base frequency-type;
description
"Indicates a repeating rule based on an interval of
a year or more.";
}
identity schedule-state {
description
"Base identity for schedule state.";
}
identity enabled {
base schedule-state;
description
"Indicates a schedule with an enabled state.";
}
identity finished {
base schedule-state;
description
"Indicates a schedule with a finished state.
The finished state indicates that the schedule has ended.";
}
identity disabled {
base schedule-state;
description
"Indicates a schedule with a disabled state.";
}
identity out-of-date {
base schedule-state;
description
"Indicates a schedule that is received out-of-date.";
}
identity conflicted {
base schedule-state;
description
"Indicates a schedule with a conflicted state with other
schedules.";
}
identity discard-action-type {
description
"Base identity for the action for the responder to take
when a requested schedule cannot be accepted for any
reason and is discarded.";
}
identity warning {
base discard-action-type;
description
"Indicates that a warning message is generated
when a schedule is discarded.";
}
identity error {
base discard-action-type;
description
"Indicates that an error message is generated
when a schedule is discarded.";
}
identity silently-discard {
base discard-action-type;
description
"Indicates that a schedule that is not valid is silently
discarded.";
}
grouping generic-schedule-params {
description
"Includes a set of generic parameters that are followed by
the entity that supports schedules.
Such parameters are used as guards to prevent, e.g., stale
configuration.";
leaf description {
type string;
description
"Provides a description of the schedule.";
}
leaf time-zone-identifier {
type sys:timezone-name;
description
"Indicates the identifier for the time zone. This parameter
MUST be specified if any of the date and time values are
in the format of local time. It MUST NOT be applied to
date and time values that are specified in the format of
UTC or time zone offset to UTC.";
}
leaf validity {
type yang:date-and-time;
description
"Specifies the date and time after which a schedule will not
be considered as valid. This parameter takes precedence
over similar attributes that are provided at the schedule
instance itself.";
}
leaf max-allowed-start {
type yang:date-and-time;
description
"Specifies the maximum scheduled start date and time.
A requested schedule whose first instance occurs after
this value cannot be accepted by the entity. Specifically,
a requested schedule will be rejected if the first
occurrence of that schedule exceeds 'max-allowed-start'.";
}
leaf min-allowed-start {
type yang:date-and-time;
description
"Specifies the minimum scheduled start date and time.
A requested schedule whose first instance occurs before
this value cannot be accepted by the entity. Specifically,
a requested schedule will be rejected if the first
occurrence of that schedule is scheduled before
'min-allowed-start'.";
}
leaf max-allowed-end {
type yang:date-and-time;
description
"A requested schedule will be rejected if the end time of
the last occurrence exceeds 'max-allowed-end'.";
}
leaf discard-action {
type identityref {
base discard-action-type;
}
description
"Specifies the behavior when a schedule is discarded for
any reason, e.g., failing to satisfy the guards in this
grouping or being received out-of-date.";
}
}
grouping period-of-time {
description
"This grouping is defined for the period of time property.";
reference
"RFC 5545: Internet Calendaring and Scheduling Core Object
Specification (iCalendar), Section 3.3.9";
leaf period-description {
type string;
description
"Provides a description of the period.";
}
leaf period-start {
type yang:date-and-time;
description
"Period start time.";
}
leaf time-zone-identifier {
type sys:timezone-name;
description
"Indicates the identifier for the time zone. This parameter
MUST be specified if either the 'period-start' or
'period-end' value is reported in local time format.
It MUST NOT be applied to date and time values that are
specified in the format of UTC or time zone offset
to UTC.";
}
choice period-type {
description
"Indicates the type of the time period. Two types are
supported. If no choice is indicated, the period is
considered to last forever.";
case explicit {
description
"A period of time is identified by its start and its end.
'period-start' indicates the period start.";
leaf period-end {
type yang:date-and-time;
description
"A period of time is defined by a start and end time.
The start MUST be no later than the end. The period
is considered as a one-shot schedule if the end time
is the same as the start time.";
}
}
case duration {
description
"A period of time is defined by a start and a non-negative
duration of time.";
leaf duration {
type duration {
pattern 'P((([0-9]+)D)?(T(0[0-9]|1[0-9]|2[0-3])'
+ ':[0-5][0-9]:[0-5][0-9]))|P([0-9]+)W';
}
description
"A non-negative duration of time. This value is
equivalent to the format of 'duration' type except that
the value cannot be negative. The period is considered
to be a one-shot schedule if the value is 0.";
}
}
}
}
grouping recurrence-basic {
description
"A simple definition of recurrence.";
leaf recurrence-description {
type string;
description
"Provides a description of the recurrence.";
}
leaf frequency {
type identityref {
base frequency-type;
}
description
"Specifies the frequency type of the recurrence rule.";
}
leaf interval {
type uint32 {
range "1..max";
}
must '../frequency' {
error-message "Frequency must be provided.";
}
description
"A positive integer representing the interval at which the
recurrence rule repeats. For example, within a 'daily'
recurrence rule, a value of '8' means every eight days.";
}
}
grouping recurrence-utc {
description
"A simple definition of recurrence with time specified in
UTC format.";
container recurrence-first {
description
"Specifies the first instance of the recurrence. If
unspecified, the recurrence is considered to start from
the date and time when the recurrence pattern is first
satisfied.";
leaf start-time-utc {
type yang:date-and-time;
description
"Defines the date and time of the first instance
in the recurrence set. A UTC format MUST be used.";
}
leaf duration {
type uint32;
units "seconds";
description
"When specified, it indicates how long the first occurrence
lasts. Unless specified otherwise, it also applies to all
the other instances in the recurrence set.";
}
}
choice recurrence-end {
description
"Modes to control the end of a recurrence rule. If no
choice is indicated, the recurrence rule is considered
to repeat forever.";
case until {
description
"This case defines a way that limits the end of
a recurrence rule in an inclusive manner.";
leaf utc-until {
type yang:date-and-time;
description
"This parameter specifies a date and time value to
inclusively terminate the recurrence in UTC format.
That is, if the value specified by this parameter is
synchronized with the specified recurrence rule, it
becomes the last instance of the recurrence rule.";
}
}
case count {
description
"This case defines the number of occurrences at which
to terminate the recurrence rule.";
leaf count {
type uint32 {
range "1..max";
}
description
"The positive number of occurrences at which to
terminate the recurrence rule.";
}
}
}
uses recurrence-basic;
}
grouping recurrence-with-time-zone {
description
"A simple definition of recurrence to specify a recurrence
rule with a time zone.";
container recurrence-first {
description
"Specifies the first instance of the recurrence. If
unspecified, the recurrence is considered to start from
the date and time when the recurrence pattern is first
satisfied.";
leaf start-time {
type yang:date-and-time;
description
"Defines the date and time of the first instance
in the recurrence set.";
}
leaf duration {
type duration;
description
"When specified, it indicates how long the first
occurrence lasts. Unless specified otherwise, it also
applies to all the other instances in the recurrence
set.";
}
}
leaf time-zone-identifier {
type sys:timezone-name;
description
"Indicates the identifier for the time zone in a time
zone database. This parameter MUST be specified if either
the 'start-time' or 'until' value is reported in local
time format. It MUST NOT be applied to date and time
values that are specified in the format of UTC or time
zone offset to UTC.";
}
choice recurrence-end {
description
"Modes to terminate the recurrence rule. If no choice is
indicated, the recurrence rule is considered to repeat
forever.";
case until {
description
"The end of the recurrence rule is indicated by a specific
date-and-time value in an inclusive manner.";
leaf until {
type yang:date-and-time;
description
"Specifies a date and time value to inclusively terminate
the recurrence. That is, if the value specified by
this parameter is synchronized with the specified
recurrence, it becomes the last instance of the
recurrence.";
}
}
case count {
description
"The end of the recurrence is indicated by the number
of occurrences.";
leaf count {
type uint32 {
range "1..max";
}
description
"The positive number of occurrences at which to
terminate the recurrence.";
}
}
}
uses recurrence-basic;
}
grouping recurrence-utc-with-periods {
description
"This grouping defines an aggregate set of repeating
occurrences with UTC time format. The recurrence instances
are specified by the occurrences defined by both the
recurrence rule and 'period-timeticks' list. Duplicate
instances are ignored.";
uses recurrence-utc;
list period-timeticks {
key "period-start";
description
"A list of periods with timeticks formats.";
leaf period-start {
type yang:timeticks;
must "(not(derived-from-or-self(../../frequency,"
+ "'schedule:secondly')) or (current() < 100)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:minutely')) or (current() < 6000)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:hourly')) or (current() < 360000)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:daily')) or (current() < 8640000)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:weekly')) or (current() < 60480000)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:monthly')) or (current() < 267840000)) and "
+ "(not(derived-from-or-self(../../frequency,"
+ "'schedule:yearly')) or (current() < 3162240000))" {
error-message
"The 'period-start' must not exceed the frequency
interval.";
}
description
"Start time of the schedule within one recurrence.
Given that the value is in timeticks format
(i.e., 1/100 of a second), the values in the must
statement translate to 100 = 1 s (secondly),
6000 = 60 s = 1 min (minutely), and so on for all
instances in the must statement invariant.";
}
leaf period-end {
type yang:timeticks;
description
"End time of the schedule within one recurrence.
The period start MUST be no later than the period
end.";
}
}
}
grouping recurrence-time-zone-with-periods {
description
"This grouping defines an aggregate set of repeating
occurrences with local time format and time zone specified.
The recurrence instances are specified by the occurrences
defined by both the recurrence rule and 'period' list.
Duplicate instances are ignored.";
uses recurrence-with-time-zone;
list period {
key "period-start";
description
"A list of periods with date-and-time formats.";
uses period-of-time;
}
}
grouping icalendar-recurrence {
description
"This grouping specifies properties of a recurrence rule.";
reference
"RFC 5545: Internet Calendaring and Scheduling Core Object
Specification (iCalendar), Section 3.8.5";
uses recurrence-time-zone-with-periods;
leaf-list bysecond {
type uint32 {
range "0..60";
}
description
"Specifies a list of seconds within a minute.";
}
leaf-list byminute {
type uint32 {
range "0..59";
}
description
"Specifies a list of minutes within an hour.";
}
leaf-list byhour {
type uint32 {
range "0..23";
}
description
"Specifies a list of hours of the day.";
}
list byday {
key "weekday";
description
"Specifies a list of days of the week.";
leaf-list direction {
when "derived-from-or-self(../../frequency, "
+ "'schedule:monthly') or "
+ "(derived-from-or-self(../../frequency,"
+ "'schedule:yearly') and not(../../byyearweek))";
type int32 {
range "-53..-1|1..53";
}
description
"When specified, it indicates the nth occurrence of a
specific day within the monthly or yearly recurrence
rule. For example, within a monthly rule, +1 monday
represents the first Monday within the month, whereas
-1 monday represents the last Monday of the month.";
}
leaf weekday {
type schedule:weekday;
description
"Corresponds to seven days of the week.";
}
}
leaf-list bymonthday {
type int32 {
range "-31..-1|1..31";
}
description
"Specifies a list of days of the month.";
}
leaf-list byyearday {
type int32 {
range "-366..-1|1..366";
}
description
"Specifies a list of days of the year.";
}
leaf-list byyearweek {
when "derived-from-or-self(../frequency, 'schedule:yearly')";
type int32 {
range "-53..-1|1..53";
}
description
"Specifies a list of weeks of the year.";
}
leaf-list byyearmonth {
type uint32 {
range "1..12";
}
description
"Specifies a list of months of the year.";
}
leaf-list bysetpos {
type int32 {
range "-366..-1|1..366";
}
description
"Specifies a list of values that corresponds to the nth
occurrence within the set of recurrence instances
specified by the rule. It must only be used in conjunction
with another 'byxxx' (bysecond, byminute, etc.) rule
part.";
}
leaf workweek-start {
type schedule:weekday;
description
"Specifies the day on which the workweek starts.";
}
leaf-list exception-dates {
type yang:date-and-time;
description
"Defines a list of exceptions for recurrence.";
}
}
grouping schedule-status {
description
"This grouping defines common properties of scheduling
status.";
leaf state {
type identityref {
base schedule-state;
}
description
"Indicates the current state of the schedule.";
}
leaf version {
type uint16;
description
"Indicates the version number of the schedule.";
}
leaf schedule-type {
type identityref {
base schedule-type;
}
description
"Indicates the schedule type.";
}
leaf local-time {
type yang:date-and-time;
config false;
description
"Reports the local time as used by the entity that
hosts the schedule.";
}
leaf last-update {
type yang:date-and-time;
config false;
description
"Reports the timestamp of when the schedule is last
updated.";
}
leaf counter {
when "derived-from-or-self(../schedule-type, "
+ "'schedule:recurrence')";
type yang:counter32;
config false;
description
"The number of occurrences while invoking the scheduled
action successfully. The count wraps around when it reaches
the maximum value.";
}
leaf last-occurrence {
when "derived-from-or-self(../schedule-type, "
+ "'schedule:recurrence')";
type yang:date-and-time;
config false;
description
"Indicates the timestamp of last occurrence.";
}
leaf upcoming-occurrence {
when "derived-from-or-self(../schedule-type, "
+ "'schedule:recurrence')"
+ "and derived-from-or-self(../state, 'schedule:enabled')";
type yang:date-and-time;
config false;
description
"Indicates the timestamp of next occurrence.";
}
leaf last-failed-occurrence {
when "derived-from-or-self(../schedule-type, "
+ "'schedule:recurrence')";
type yang:date-and-time;
config false;
description
"Indicates the timestamp of last failed action triggered by
the schedule.";
}
leaf failure-counter {
when "derived-from-or-self(../schedule-type, "
+ "'schedule:recurrence')";
type yang:counter32;
config false;
description
"Counts the number of failures while invoking the scheduled
action.";
}
}
grouping schedule-status-with-time-zone {
description
"This grouping defines common properties of scheduling
status, including timezone.";
leaf time-zone-identifier {
type sys:timezone-name;
config false;
description
"Indicates the identifier for the time zone in a time
zone database.";
}
uses schedule-status;
}
grouping schedule-status-with-name {
description
"This grouping defines common properties of scheduling
status, including a schedule name.";
leaf schedule-name {
type string;
description
"The schedule identifier that uniquely identifies a
schedule within a device, controller, network, etc.
The unicity scope depends on the implementation.";
}
uses schedule-status;
}
}