メインコンテンツまでスキップ

Appendix B. Examples of Using/Extending the "ietf-schedule" Module

この節では ietf-schedule YANG model の RFC テキストを保持し, recurrence groupings, iCalendar-like rules, schedule status groupings, DISMAN-SCHEDULE-MIB relationship, IANA registrations, YANG/XML examples, scheduled resource examples を扱う.

RFC 原文​

Appendix B.  Examples of Using/Extending the "ietf-schedule" Module

   This non-normative section shows two examples for how the "ietf-
   schedule" module can be used or extended for scheduled events or
   attributes based on date and time.

B.1.  Example: Schedule Tasks to Execute Based on a Recurrence Rule

   Scheduled tasks can be used to execute specific actions based on
   certain recurrence rules (e.g., every Friday at 8:00 AM).  The
   following example module, which "uses" the "icalendar-recurrence"
   grouping from the "ietf-schedule" module, shows how a scheduled task
   could be defined with different features used for options.

   module example-scheduled-backup {
     yang-version 1.1;
     namespace "http://example.com/example-scheduled-backup";
     prefix "ex-scback";

     import ietf-inet-types {
       prefix "inet";
     }

     import ietf-schedule {
       prefix "schedule";
     }

     organization
       "Example, Inc.";

     contact
       "Support at example.com";

     description
       "Example of a module defining a scheduled-based backup
        operation.";

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

     container scheduled-backup-tasks {
       description
         "A container for backing up all current running configurations
          on the device.";
       list tasks {
         key "task-id";
         description
           "The list of backing up tasks on this device.";
         leaf task-id {
           type string;
           description
             "The task identifier that uniquely identifies a scheduled
              backup task.";
         }
         choice local-or-remote {
           description
             "Specifies whether the configuration to be backed up is
              local or remote.";
           case local {
             description
               "Configuration parameters for the backing up of local
                devices.";
             leaf local {
               type empty;
               description
                 "The parameter specifies the configuration to be
                  backed up is on the local device.";
             }
           }
           case remote {
             description
               "Configuration parameters for backing up of remote
                devices.";
             leaf remote {
               type inet:domain-name;
               description
                 "The parameter specifies the remote device domain
                  name.";
             }
           }
         }

         container basic-recurrence-schedules {
           if-feature schedule:basic-recurrence;
           description
             "Basic recurrence schedule specification, which only
              applies when the schedule:basic-recurrence feature
              is supported.";
           leaf schedule-id {
             type string;
             description
               "The schedule identifier for this recurrence rule.";
           }
           uses schedule:recurrence-basic {
             refine frequency {
               mandatory true;
             }
             refine interval {
               default 1;
             }
           }
         }

         container icalendar-recurrence-schedules {
           if-feature schedule:icalendar-recurrence;
           description
             "Basic recurrence schedule specification, which only
              applies when the schedule:icalendar-recurrence feature
              is supported.";
           leaf schedule-id {
             type string;
             description
               "The schedule identifier for this recurrence rule.";
           }
           uses schedule:icalendar-recurrence {
             refine workweek-start {
               default monday;
             }
           }
         }
       }

       list schedule-set {
         key "schedule-name";
         description
           "Schedule status list for the backup tasks.";
         uses schedule:schedule-status-with-name;
       }
     }
   }

B.2.  Example: Schedule Network Properties to Change Based on Date and
      Time

   Network properties may change over a specific period of time or based
   on a recurrence rule, e.g., [RFC9657].  The following example module,
   which augments the "recurrence-utc-with-periods" grouping from the
   "ietf-schedule" module, shows how a scheduled attribute could be
   defined.  Note that [RFC8345] and this document are referenced in the
   module.

   module example-scheduled-link-bandwidth {
     yang-version 1.1;
     namespace "http://example.com/example-scheduled-link-bandwidth";
     prefix "ex-scattr";

     import ietf-network {
       prefix "nw";
       reference
         "RFC 8345: A YANG Data Model for Network Topologies";
     }

     import ietf-schedule {
       prefix "schedule";
       reference
         "RFC 9922: A YANG Data Model for Scheduling";
     }

     organization
       "Example, Inc.";

     contact
       "Support at example.com";

     description
       "Example of a module defining a scheduled link bandwidth.";

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

     grouping link-bandwidth-grouping {
       description
         "Grouping of the link bandwidth definition.";
       leaf scheduled-bandwidth {
         type uint64;
         units "Kbps";
         description
           "Bandwidth values, expressed in kilobits per second.";
       }
     }

     container link-attributes {
       description
         "Definition of link attributes.";
       list link {
         key "source-node destination-node";
         description
           "Definition of link attributes.";
         leaf source-node {
           type nw:node-id;
           description
             "Indicates the source node identifier.";
         }
         leaf destination-node {
           type nw:node-id;
           description
             "Indicates the source node identifier.";
         }

         leaf default-bandwidth {
           type uint64;
           units "Kbps";
           description
             "Bandwidth value used for periods that don't match
              a schedule.";
         }

         choice time-variant-type {
           description
             "Controls the schedule type.";
           case period {
             uses schedule:period-of-time;
           }
           case recurrence {
             uses schedule:recurrence-utc-with-periods {
               augment "period-timeticks" {
                 description
                   "Specifies the attributes inside each
                    'period-timeticks' entry.";
                 uses link-bandwidth-grouping;
               }
             }
           }
         }
       }
     }
   }

   Figure 24 shows a configuration example in XML [W3C.XML1.0] of a
   link's bandwidth that is scheduled between 2025-12-01 0:00 UTC to the
   end of 2025-12-31 with a daily schedule.  In each day, the bandwidth
   value is scheduled to be 500 Kbps between 1:00 AM to 6:00 AM and 800
   Kbps between 10:00 PM to 11:00 PM.  The bandwidth value that is not
   covered by the period above is 1000 Kbps.

   <?xml version="1.0" encoding="utf-8"?>
   <link-attributes
     xmlns="http://example.com/example-scheduled-link-bandwidth"
     xmlns:schedule="urn:ietf:params:xml:ns:yang:ietf-schedule">
     <link>
       <source-node>ne1</source-node>
       <destination-node>ne2</destination-node>
       <default-bandwidth>1000</default-bandwidth>
       <recurrence-first>
         <start-time-utc>2025-12-01T01:00:00Z</start-time-utc>
       </recurrence-first>
       <frequency>schedule:daily</frequency>
       <utc-until>2025-12-31T23:59:59Z</utc-until>
       <period-timeticks>
         <period-start>360000</period-start>
         <period-end>2160000</period-end>
         <scheduled-bandwidth>500</scheduled-bandwidth>
       </period-timeticks>
       <period-timeticks>
         <period-start>7920000</period-start>
         <period-end>8280000</period-end>
         <scheduled-bandwidth>800</scheduled-bandwidth>
       </period-timeticks>
     </link>
   </link-attributes>

              Figure 24: Example of Scheduled Link's Bandwidth