跳到主要内容

Appendix A. 调度格式表示示例 (Examples of Scheduling Format Representation)

中文导读: 本节对应 RFC 9922 的 Appendix A. 调度格式表示示例 (Examples of Scheduling Format Representation) 部分, 对应文档标题为 RFC 9922 - 用于调度的通用 YANG 数据模型. 下方若包含英文 RFC 原文, 注册表名称, 字段名, 算法名, 对象标识符, 媒体类型, 邮箱地址, URL, 代码, ABNF, ASN.1, YANG, JSON, XML, 测试向量或参考文献条目, 均按规范原样保留, 因为这些内容需要与 RFC 文本, IANA 注册表, 实现代码或验证工具逐字一致. 中文段落用于说明本节的作用, 阅读重点和实现含义, 不改变任何协议语义或注册值.

本页中的示例, 测试向量和样例报文用于帮助实现者验证编码, 解析, 互操作或错误处理行为. 示例值, 二进制串, Base64, 十六进制, JSON/XML 成员, HTTP/邮件头字段, 域名和地址均属于可复制测试材料, 因此不翻译. 中文说明只解释示例目的, 字段关系和使用注意事项.

补充示例说明: 示例页的重点不是自然语言比例, 而是提供可重复的输入, 输出, 配置或报文片段. 这些样例常包含固定的域名, 地址, 密钥材料, 编码文本, 时间戳, JSON/XML 字段或协议头部, 任意翻译都会破坏可测试性. 中文说明用于指出示例展示的协议路径, 字段对应关系和验证目标. 实现者可把这些样例作为解析器, 编码器, 配置加载器或一致性测试的基准, 但不应把示例中的地址, 密钥或策略值直接用于生产部署.

本附录提供若干示例, 用于说明第 6 节定义的 period 和 recurrence 格式的使用方式. 示例包括可验证的 YANG 模块片段以及对应的调度表示, 涵盖一次性调度, UTC 递归, 带时区递归, 带周期集合的递归, iCalendar 风格递归以及 schedule status 示例.

下方示例材料中的 YANG, JSON 和 XML 数据保持不变, 以避免改变可验证的示例数据.

Appendix A.  Examples of Scheduling Format Representation

This section provides some examples to illustrate the use of the
period and recurrence formats defined in Section 6. The following
modules are used for illustration purposes and make examples
verifiable:

module example-sch-usage-1 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-1";
prefix "ex-schu-1";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using 'generic-schedule-params' and
'schedule-status' groupings.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container generic-schedule-params {
description
"A collection of generic scheduling parameters.";
uses schedule:generic-schedule-params;
}
container schedule-status {
description
"A collection of scheduling status.";
uses schedule:schedule-status;
}
}

module example-sch-usage-2 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-2";
prefix "ex-schu2";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the 'period-of-time' grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container period-of-time {
description
"A container for a time period.";
uses schedule:period-of-time;
}
}

module example-sch-usage-3 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-3";
prefix "ex-schu-3";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the 'recurrence-basic' grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container recurrence-basic {
description
"A container for a simple recurrence rule.";
uses schedule:recurrence-basic {
refine interval {
default 1;
}
}
}
}

module example-sch-usage-4 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-4";
prefix "ex-schu-4";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the 'recurrence-utc' grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container recurrence-utc {
description
"A container for a simple recurrence rule in UTC format.";
uses schedule:recurrence-utc;
}
}

module example-sch-usage-5 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-5";
prefix "ex-schu-5";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the 'recurrence-with-time-zone'
grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container recurrence-with-time-zone {
description
"A container for a simple recurrence rule with a time zone.";
uses schedule:recurrence-with-time-zone;
}
}

module example-sch-usage-6 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-6";
prefix "ex-schu-6";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the 'recurrence-utc-with-periods'
grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container recurrence-utc-with-periods {
description
"A container for an aggregate set of repeating occurrences in
UTC format.";
uses schedule:recurrence-utc-with-periods;
}
}

module example-sch-usage-7 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-7";
prefix "ex-schu-8";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using the
'recurrence-time-zone-with-periods' grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container recurrence-time-zone-with-periods {
description
"A container for an aggregate set of repeating occurrences
with a time zone.";
uses schedule:recurrence-time-zone-with-periods;
}
}

module example-sch-usage-8 {
yang-version 1.1;
namespace "http://example.com/example-sch-usage-8";
prefix "ex-schu-8";

import ietf-schedule {
prefix "schedule";
}

organization
"Example, Inc.";

contact
"Support at example.com";

description
"Example of a module using 'icalendar-recurrence' grouping.";

revision "2026-02-20" {
description "Initial version.";
reference
"RFC 9922: A YANG Data Model for Scheduling";
}

container icalendar-recurrence {
description
"A container for a scheduled iCalendar recurrence.";
uses schedule:icalendar-recurrence {
refine workweek-start {
default monday;
}
}
}
}

For each example, only the message body is provided with JSON, which
is used for encoding per the guidance in [RFC7951].

A.1. The "generic-schedule-params" Grouping

Figure 10 illustrates the example of a requested schedule that needs
to start no earlier than 08:00 AM, January 1, 2025 and end no later
than 8:00 PM, January 31, 2025 (Beijing time). Schedule requests
that fail to meet the requirements are ignored by the system, as
indicated by "discard-action".

{
"example-sch-usage-1:generic-schedule-params": {
"time-zone-identifier": "China/Beijing",
"min-allowed-start": "2025-01-01T08:00:00",
"max-allowed-end": "2025-01-31T20:00:00",
"discard-action": "ietf-schedule:silently-discard"
}
}

Figure 10: Generic Parameters with 'max-allowed-end' for Schedule
Validation

To illustrate the difference between "max-allowed-end" and "validity"
parameters, Figure 11 shows the example of a requested schedule that
needs to start no earlier than 08:00 AM, January 1, 2025 (Beijing
time). Schedule requests that fail to meet the requirements are
ignored by the system, as indicated by "discard-action". The
requested schedule may end after 8:00 PM, January 31, 2025, but any
occurrences that are generated after that time would not be
considered as valid.

{
"example-sch-usage-1:generic-schedule-params": {
"time-zone-identifier": "China/Beijing",
"validity": "2025-01-31T20:00:00",
"min-allowed-start": "2025-01-01T08:00:00",
"discard-action": "ietf-schedule:silently-discard"
}
}

Figure 11: Generic Parameters with 'validity' for Schedule Validation

A.2. The "period-of-time" Grouping

Figure 12 shows an example of a period that starts at 08:00:00 UTC on
January 1, 2025 and ends at 18:00:00 UTC on December 31, 2027.

{
"example-sch-usage-2:period-of-time": {
"period-start": "2025-01-01T08:00:00Z",
"period-end": "2027-12-31T18:00:00Z"
}
}

Figure 12: Simple Start/End Schedule

An example of a period that starts at 08:00:00 UTC on January 1, 2025
and lasts 15 days and 5 hours and 20 minutes is encoded as shown in
Figure 13.

{
"example-sch-usage-2:period-of-time": {
"period-start": "2025-01-01T08:00:00Z",
"duration": "P15DT05:20:00"
}
}

Figure 13: Simple Schedule with Duration

An example of a period that starts at 2:00 AM in Los Angeles on
November 19, 2025 and lasts 20 weeks is depicted in Figure 14.

{
"example-sch-usage-2:period-of-time": {
"period-start": "2025-11-19T02:00:00",
"time-zone-identifier": "America/Los_Angeles",
"duration": "P20W"
}
}

Figure 14: Simple Schedule with Time Zone Indication

A.3. The "recurrence-basic" Grouping

Figure 15 indicates a recurrence of every 2 days, which starts
immediately and repeats forever:

{
"example-sch-usage-3:recurrence-basic": {
"recurrence-description": "forever recurrence rule",
"frequency": "ietf-schedule:daily",
"interval": 2
}
}

Figure 15: Simple Schedule with Recurrence

A.4. The "recurrence-utc" Grouping

Figure 16 indicates a recurrence from 8:00 AM to 9:00 AM every day,
from December 1 to December 31, 2025 in UTC:

{
"example-sch-usage-4:recurrence-utc": {
"recurrence-first": {
"start-time-utc": "2025-12-01T08:00:00Z",
"duration": 3600
},
"frequency": "ietf-schedule:daily",
"interval": 1,
"utc-until": "2025-12-31T23:59:59Z"
}
}

Figure 16: Simple Schedule with Recurrence in UTC

A.5. The "recurrence-with-time-zone" Grouping

Figure 17 indicates a recurrence of every 2 hours for 10 occurrences
that lasts 10 minutes and starts at 3 PM on December 1, 2025 in New
York:

{
"example-sch-usage-5:recurrence-with-time-zone": {
"recurrence-first": {
"start-time": "2025-12-01T15:00:00",
"duration": "PT00:10:00"
},
"time-zone-identifier": "America/New_York",
"frequency": "ietf-schedule:hourly",
"interval": 2,
"count": 10
}
}

Figure 17: Simple Schedule with Recurrence with Time Zone Indication

A.6. The "recurrence-utc-with-periods" Grouping

Figure 18 indicates a recurrence that occurs every two days starting
at 9:00 AM and 3:00 PM for a duration of 30 minutes and 40 minutes,
respectively, from 2025-06-01 to 2025-06-30 in UTC:

{
"example-sch-usage-6:recurrence-utc-with-periods": {
"recurrence-first": {
"start-time-utc": "2025-06-01T09:00:00Z"
},
"frequency": "ietf-schedule:daily",
"interval": 2,
"utc-until": "2025-06-30T23:59:59Z",
"period-timeticks": [
{
"period-start": 3240000,
"period-end": 3420000
},
{
"period-start": 5400000,
"period-end": 5640000
}
]
}
}

Figure 18: Example of Recurrence With Date Times

A.7. The "recurrence-time-zone-with-periods" Grouping

Figure 19 indicates a recurrence that occurs every 30 minutes and
lasts for 15 minutes from 9:00 AM to 5:00 PM and two extra
occurrences at 6:00 PM and 6:30 PM with each lasting for 20 minutes
on 2025-12-01 (New York):

{
"example-sch-usage-7:recurrence-time-zone-with-periods": {
"recurrence-first": {
"start-time": "2025-12-01T09:00:00",
"duration": "PT00:15:00"
},
"time-zone-identifier": "America/New_York",
"frequency": "ietf-schedule:minutely",
"interval": 30,
"until": "2025-12-01T17:00:00Z",
"period": [
{
"period-start": "2025-12-01T18:00:00",
"duration": "PT00:20:00"
},
{
"period-start": "2025-12-01T18:30:00",
"duration": "PT00:20:00"
}
]
}
}

Figure 19: Example of Advanced Recurrence Schedule

A.8. The "icalendar-recurrence" Grouping

Figure 20 indicates 10 occurrences at 8:00 AM (EST) every last
Saturday of the month starting in January 2024:

{
"example-sch-usage-8:icalendar-recurrence": {
"recurrence-first": {
"start-time": "2024-01-27T08:00:00"
},
"time-zone-identifier": "America/New_York",
"frequency": "ietf-schedule:monthly",
"count": 10,
"byday": [
{
"direction": [
-1
],
"weekday": "saturday"
}
]
}
}

Figure 20: Simple iCalendar Recurrence

Figure 21 is an example of a recurrence that occurs on the last
workday of the month until December 25, 2025, starting January 1,
2025:

{
"example-sch-usage-8:icalendar-recurrence": {
"recurrence-first": {
"start-time": "2025-01-01T00:00:00"
},
"frequency": "ietf-schedule:monthly",
"until": "2025-12-25T23:59:59",
"byday": [
{
"weekday": "monday"
},
{
"weekday": "tuesday"
},
{
"weekday": "wednesday"
},
{
"weekday": "thursday"
},
{
"weekday": "friday"
}
],
"bysetpos": [
-1
]
}
}

Figure 21: Example of Advanced iCalendar Recurrence

Figure 22 indicates a recurrence that occurs every 20 minutes from
9:00 AM to 4:40 PM (UTC), with the exclusion of the occurrence
starting at 10:20 AM on 2025-12-01:

{
"example-sch-usage-8:icalendar-recurrence": {
"recurrence-first": {
"start-time": "2025-12-01T09:00:00Z"
},
"until": "2025-12-01T16:40:00Z",
"frequency": "ietf-schedule:minutely",
"byminute": [
0,
20,
40
],
"byhour": [
9,
10,
11,
12,
13,
14,
15,
16
],
"exception-dates": [
"2025-12-01T10:20:00Z"
]
}
}

Figure 22: Example of Advanced iCalendar Recurrence with Exceptions

A.9. The "schedule-status" Grouping

Figure 23 indicates the scheduled recurrence status of Figure 22 at
the time of 12:15 PM on 2025-12-01 (UTC):

{
"example-sch-usage-1:schedule-status": {
"state": "ietf-schedule:enabled",
"version": 1,
"schedule-type": "ietf-schedule:recurrence",
"counter": 9,
"last-occurrence": "2025-12-01T12:00:00Z",
"upcoming-occurrence": "2025-12-01T12:20:00Z"
}
}

Figure 23: Example of a Schedule Status

At the time of 12:15 PM on 2025-12-01 (UTC), the recurring event
occurred at (note that the occurrence at 10:20 AM is excluded): 9:00,
9:20, 9:40, 10:00, 10:40, 11:00, 11:20, 11:40, and 12:00. The last
occurrence was at 12:00, and the upcoming one is at 12:20.