Internet-Draft schedule YANG October 2023
Ma, et al. Expires 22 April 2024 [Page]
Workgroup:
OPSAWG
Internet-Draft:
draft-ma-opsawg-schedule-yang-01
Published:
Intended Status:
Standards Track
Expires:
Authors:
Q. Ma
Huawei
Q. Wu
Huawei
M. Boucadair
Orange
D. King
Lancaster University

A YANG Data Model for Scheduling

Abstract

This document defines a common schedule YANG module which is designed to be applicable for scheduling information such as event, policy, services, or resources based on date and time.

Discussion Venues

This note is to be removed before publishing as an RFC.

Discussion of this document takes place on the Operations and Management Area Working Group Working Group mailing list (opsawg@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/opsawg/.

Source for this draft and an issue tracker can be found at https://github.com/boucadair/policy-based-network-acl.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 22 April 2024.

Table of Contents

1. Introduction

Several specifications include a provision for scheduling. Examples of such specifications are [I-D.ietf-opsawg-ucl-acl], [I-D.contreras-opsawg-scheduling-oam-tests], and [I-D.united-tvr-schedule-yang]. Both [I-D.ietf-opsawg-ucl-acl] and [I-D.contreras-opsawg-scheduling-oam-tests] use the "ietf-schedule" module initially specified in [I-D.ietf-opsawg-ucl-acl].

Given that the applicability of the "ietf-schedule" module is more general than scheduled policy and OAMs, this document defines "ietf-schedule" as a common schedule YANG module. The module includes a set of reusable groupings which are designed to be applicable for scheduling information such as event, policy, services or resources based on date and time.

1.1. Editorial Note (To be removed by RFC Editor)

Note to the RFC Editor: This section is to be removed prior to publication.

This document contains placeholder values that need to be replaced with finalized values at the time of publication. This note summarizes all of the substitutions that are needed. No other RFC Editor instructions are specified elsewhere in this document.

Please apply the following replacements:

  • XXXX --> the assigned RFC number for this draft

  • YYYY --> the assigned RFC number for [I-D.ietf-netmod-rfc6991-bis]

  • 2023-01-19 --> the actual date of the publication of this document

2. Conventions and Definitions

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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

The meanings of the symbols in tree diagrams are defined in [RFC8340].

Also, this document uses the YANG terminology defined in Section 3 of [RFC7950].

3. Modules Overview

3.1. The Schedule YANG Module

This module defines two groupings "period" and "recurrence", which conform to the definition of the "period of time" and "recurrence rule" formats defined in [RFC5545]. Other formats may be considered in future revisions.

Figure 1 provides an overview of the tree structure of the "ietf- schedule" module in terms of its groupings.

module: ietf-schedule

  grouping period:
    +-- period-of-time
       +-- period-start?            yang:date-and-time
       +-- (period-type)?
          +--:(period-explicit)
          |  +-- period-end?        yang:date-and-time
          +--:(period-duration)
             +-- period-duration?   duration
  grouping recurrence:
    +-- recurrence
       +-- freq           enumeration
       +-- (recurrence-bound)?
       |  +--:(until)
       |  |  +-- until?   union
       |  +--:(count)
       |     +-- count?   uint32
       +-- interval?      uint32
       +-- bysecond*      uint32
       +-- byminute*      uint32
       +-- byhour*        uint32
       +-- byday* [weekday]
       |  +-- direction*   int32
       |  +-- weekday?     schedule:weekday
       +-- bymonthday*    int32
       +-- byyearday*     int32
       +-- byyearweek*    int32
       +-- byyearmonth*   uint32
       +-- bysetpos*      int32
       +-- wkst?          schedule:weekday
Figure 1: Schedule Tree Structure

The "period-of-time" allows a time period to be represented using either a start ("period-start") and end date and time ("period-end"), or a start ("period-start") and a positive time duration ("period-duration").

The "recurrence" indicates the scheduling recurrence of an event. The repetition can be scoped by a specified end time or by a count of occurences, and the frequency identifies the type of recurrence rule. For example, a "daily" frequency value specifies repeating events based on an interval of a day or more. The interval represents at which intervals the recurrence rule repeats. For example, within a daily recurrence rule, an interval value of "8" means every eight days.

An array of the "bysecond" (or "byminut", "byhour") specifies a list of seconds within a minute (or minutes within an hour, hours of the day).

The parameter "byday" specifies a list of days of the week, with an optional direction which indicates the nth occurrence of a specific day within the "monthly" or "yearly" frequency. For example, within a "monthly" rule, the "weekday" with a value of "monday" and the "direction" with a value of "-1" represents the last Monday of the month.

An array of the "bymonthday" (or byyearday", "byyearweek", or "byyearmonth") specifies a list of days of the month (or days of the year, weeks of the year, or months of the year).

The "bysetpos" conveys a list of values that corresponds to the nth occurrence within the set of recurrence instances to be specified. For example, in a "monthly" recurrence rule, the "byday" data node specifies every Monday of the week, the "bysetpos" with value of "-1" represents the last Monday of the month. Not setting the "bysetpos" data node represents every Monday of the month.

The "wkst" data node specifies the day on which the week starts. This is significant when a "weekly" recurrence rule has an interval greater than 1, and a "byday" data node is specified. This is also significant when in a "yearly" rule and a "byyearweek" is specified. The default value is "monday".

3.2. Examples

The following subsections provide some examples to illustrate the use of the period and recurrence formats defined as YANG groupings. Only the message body is provided with JSON used for encoding [RFC7951].

3.2.1. Period of Time

The example of a period that starts at 08:00:00 UTC, on January 1, 2023 and ends at 18:00:00 UTC on December 31, 2025 is encoded as follows:

{
  "period-of-time": {
    "period-start": "2023-01-01T08:00:00Z",
    "period-end": "2025-12-01T18:00:00Z"
  }
}

An example of a period that starts at 08:00:00 UTC, on January 1, 2023 and lasts 15 days and 5 hours and 20 minutes is encoded as follows:

{
  "period-of-time": {
    "period-start": "2023-01-01T08:00:00Z",
    "period-duration": "P15DT05:20:00"
  }
}

Now, consider the example of a period that starts at 08:00:00 UTC, on January 1, 2023 and lasts 20 weeks:

{
  "period-of-time": {
    "period-start": "2023-01-01T08:00:00Z",
    "period-duration": "P20W"
  }
}

3.2.2. Recurrence Rule

The following snippet can be used to indicate a daily recurrent in December:

{
  "recurrence": {
    "freq": "daily",
    "byyearmonth": [12]
  }
}

The following snippet can be used to indicate 10 occurrences that occur every last Saturday of the month:

{
  "recurrence": {
    "freq": "monthly",
    "count": 10,
    "byday": [
      {
        "direction": [-1],
        "weekday": "saturday"
      }
    ]
  }
}

The following indicates the example of a recurrence that occurs on the last workday of the month until December 25, 2023:

{
  "recurrence": {
    "freq": "monthly",
    "until": "2023-12-25",
    "byday": [
      { "weekday": "monday" },
      { "weekday": "tuesday" },
      { "weekday": "wednesday" },
      { "weekday": "thursday" },
      { "weekday": "friday" }
    ],
    "bysetpos": [-1]
  }
}

The following depicts the example of a recurrence that occurs every other week on Tuesday and Sunday, the week starts from Monday:

{
  "recurrence": {
    "freq": "weekly",
    "interval": 2,
    "byday": [
      { "weekday": "tuesday" },
      { "weekday": "sunday" }
    ],
    "wkst": "monday"
  }
}

4. The "ietf-schedule" YANG Module

This module imports types defined in [I-D.ietf-netmod-rfc6991-bis].

<CODE BEGINS> file "ietf-schedule@2023-01-19.yang"

module ietf-schedule {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-schedule";
  prefix schedule;

  import ietf-yang-types {
    prefix yang;
    revision-date 2023-01-23;
    reference
      "RFC YYYY: Common YANG Data Types";
  }

  organization
    "IETF OPSAWG Working Group";
  contact
    "WG Web: <https://datatracker.ietf.org/wg/opsawg/>
     WG List: <mailto:opsawg@ietf.org>";
  description
    "This YANG module defines two groupings for iCalendar (Internet
     Calendaring and Scheduling Core Object Specification) data
     types: period of time and recurrence rule, for representing and
     exchanging calendaring and scheduling information. The YANG
     module complies with Sections 3.3.9 and 3.3.10 of RFC 5545.

     Copyright (c) 2023 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 XXXX
     (https://www.rfc-editor.org/info/rfcXXXX); see the RFC
     itself for full legal notices.";

  revision 2023-01-19 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: A Policy-based Network Access Control";
  }

  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";
  }

  grouping period {
    description
      "This grouping is defined for period of time property.";
    reference
      "RFC 5545: Internet Calendaring and Scheduling Core Object
                 Specification (iCalendar), Section 3.3.9";
    container period-of-time {
      description
        "This container is defined to identify period values that
         contain a precise period of time.";
      leaf period-start {
        type yang:date-and-time;
        description
          "Period start time.";
      }
      choice period-type {
        description
          "Indicates the type of the time period. Two types are
            supported.";
        case period-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
              "Period end time.";
          }
        }
        case period-duration {
          description
            "A period of time is defined by a start and a
             positive duration of time.";
          leaf period-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 positive duration of the time. This value is
               equivalent to the format of duration type except that
               the value cannot be negative.";
          }
        }
      }
    }
  }

  grouping recurrence {
    description
      "This grouping is defined to identify properties that contain a
       recurrence rule.";
    reference
      "RFC 5545: Internet Calendaring and Scheduling Core Object
       Specification (iCalendar), Section 3.3.10";
    container recurrence {
      description
        "Recurrence rule definition.";
      leaf freq {
        type enumeration {
          enum secondly {
            value 1;
            description
              "Repeating events based on an interval of a second
               or more.";
          }
          enum minutely {
            value 2;
            description
              "Repeating events based on an interval of a minute
               or more.";
          }
          enum hourly {
            value 3;
            description
              "Repeating events based on an interval of an hour
               or more.";
          }
          enum daily {
            value 4;
            description
              "Repeating events based on an interval of a day or
               more.";
          }
          enum weekly {
            value 5;
            description
              "Repeating events based on an interval of a week or
               more.";
          }
          enum monthly {
            value 6;
            description
              "Repeating events based on an interval of a month or
               more.";
          }
          enum yearly {
            value 7;
            description
              "Repeating events based on an interval of a year or
               more.";
          }
        }
        mandatory true;
        description
          "This parameter is defined to identify the type of
           recurrence rule.";
      }
      choice recurrence-bound {
        description
          "Modes to bound the recurrence rule. If no choice is
           indicated, the recurrence rule is considered to repeat
           forever.";
        case until {
          description
            "This case defines a way that bounds the recurrence
             rule in an inclusive manner.";
          leaf until {
            type union {
              type yang:date-no-zone;
              type yang:date-and-time;
            }
            description
              "This parameter specifies a date-no-zone or
               date-time value to bounds the recurrence. The
               specified value becomes the last instance of the
               recurrence.";
          }
        }
        case count {
          description
            "This case defines the number of occurrences at which
             to range-bound the recurrence.";
          leaf count {
            type uint32;
            description
              "The positive number of occurrences at which to
               range-bound the recurrence.";
          }
        }
      }
      leaf interval {
        type uint32;
        default "1";
        description
          "A positive integer representing at which intervals the
           recurrence rule repeats. The default value is '1',
           meaning every second for a secondly rule, every minute
           for a minutely rule, every hour for an hourly rule, every
           day for a daily rule, every week for a weekly rule, every
           month for a monthly rule, and every year for a yearly
           rule.";
      }
      leaf-list bysecond {
        type uint32 {
          range "0..60";
        }
        description
          "A list of seconds within a minute.";
      }
      leaf-list byminute {
        type uint32 {
          range "0..59";
        }
        description
          "A list of minutes within an hour.";
      }
      leaf-list byhour {
        type uint32 {
          range "0..23";
        }
        description
          "Specify a list of hours of the day.";
      }
      list byday {
        key "weekday";
        description
          "Specify a list of days of the week.";
        leaf-list direction {
          when '(enum-value(../../freq) = 6) or ' +
            '(enum-value(../../freq) = 7) 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 'RRULE'. 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
            "Corresponding 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 'enum-value(../freq)=7';
        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 by the rule part.";
      }
      leaf wkst {
        type schedule:weekday;
        default "monday";
        description
          "Specifies the day on which the workweek starts.";
      }
    }
  }
}


<CODE ENDS>

5. Security Considerations

The "ietf-schedule" YANG module specified in this document defines schema for data that is designed to be accessed via network management protocols such as NETCONF [RFC6241] or RESTCONF [RFC8040]. The lowest NETCONF layer is the secure transport layer, and the mandatory-to-implement secure transport is Secure Shell (SSH) [RFC6242]. The lowest RESTCONF layer is HTTPS, and the mandatory-to-implement secure transport is TLS [RFC8446].

The Network Configuration Access Control Model (NACM) [RFC8341] provides the means to restrict access for particular NETCONF or RESTCONF users to a preconfigured subset of all available NETCONF or RESTCONF protocol operations and content.

The "ietf-schedule" module defines a set of types and groupings. These nodes are intended to be reused by other YANG modules. The module by itself does not expose any data nodes that are writable, data nodes that contain read-only state, or RPCs. As such, there are no additional security issues related to the "ietf- schedule" module that need to be considered.

6. IANA Considerations

6.1. The "IETF XML" Registry

This document registers the following URI in the "IETF XML Registry" [RFC3688].

        URI: urn:ietf:params:xml:ns:yang:ietf-schedule
        Registrant Contact: The IESG.
        XML: N/A, the requested URI is an XML namespace.

6.2. The "YANG Module Names" Registry

This document registers the following YANG module in the "YANG Module Names" registry [RFC6020].

        name:               ietf-schedule
        namespace:          urn:ietf:params:xml:ns:yang:ietf-schedule
        prefix:             schedule
        maintained by IANA: N
        reference:          RFC XXXX

7. References

7.1. Normative References

[I-D.ietf-netmod-rfc6991-bis]
Schönwälder, J., "Common YANG Data Types", Work in Progress, Internet-Draft, draft-ietf-netmod-rfc6991-bis-15, , <https://datatracker.ietf.org/doc/html/draft-ietf-netmod-rfc6991-bis-15>.
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/rfc/rfc2119>.
[RFC3688]
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, , <https://www.rfc-editor.org/rfc/rfc3688>.
[RFC6020]
Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, , <https://www.rfc-editor.org/rfc/rfc6020>.
[RFC6241]
Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, , <https://www.rfc-editor.org/rfc/rfc6241>.
[RFC6242]
Wasserman, M., "Using the NETCONF Protocol over Secure Shell (SSH)", RFC 6242, DOI 10.17487/RFC6242, , <https://www.rfc-editor.org/rfc/rfc6242>.
[RFC7950]
Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, , <https://www.rfc-editor.org/rfc/rfc7950>.
[RFC8040]
Bierman, A., Bjorklund, M., and K. Watsen, "RESTCONF Protocol", RFC 8040, DOI 10.17487/RFC8040, , <https://www.rfc-editor.org/rfc/rfc8040>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/rfc/rfc8174>.
[RFC8341]
Bierman, A. and M. Bjorklund, "Network Configuration Access Control Model", STD 91, RFC 8341, DOI 10.17487/RFC8341, , <https://www.rfc-editor.org/rfc/rfc8341>.
[RFC8446]
Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, , <https://www.rfc-editor.org/rfc/rfc8446>.

7.2. Informative References

[I-D.contreras-opsawg-scheduling-oam-tests]
Contreras, L. M. and V. Lopez, "A YANG Data Model for Network Diagnosis by scheduling sequences of OAM tests", Work in Progress, Internet-Draft, draft-contreras-opsawg-scheduling-oam-tests-01, , <https://datatracker.ietf.org/doc/html/draft-contreras-opsawg-scheduling-oam-tests-01>.
[I-D.ietf-opsawg-ucl-acl]
Ma, Q., Wu, Q., Boucadair, M., and D. King, "A YANG Data Model and RADIUS Extension for Policy-based Network Access Control", Work in Progress, Internet-Draft, draft-ietf-opsawg-ucl-acl-01, , <https://datatracker.ietf.org/doc/html/draft-ietf-opsawg-ucl-acl-01>.
[I-D.united-tvr-schedule-yang]
Qu, Y., Lindem, A., Kinzie, E., Fedyk, D., and M. Blanchet, "YANG Data Model for Scheduled Attributes", Work in Progress, Internet-Draft, draft-united-tvr-schedule-yang-00, , <https://datatracker.ietf.org/doc/html/draft-united-tvr-schedule-yang-00>.
[RFC5545]
Desruisseaux, B., Ed., "Internet Calendaring and Scheduling Core Object Specification (iCalendar)", RFC 5545, DOI 10.17487/RFC5545, , <https://www.rfc-editor.org/rfc/rfc5545>.
[RFC7951]
Lhotka, L., "JSON Encoding of Data Modeled with YANG", RFC 7951, DOI 10.17487/RFC7951, , <https://www.rfc-editor.org/rfc/rfc7951>.
[RFC8340]
Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", BCP 215, RFC 8340, DOI 10.17487/RFC8340, , <https://www.rfc-editor.org/rfc/rfc8340>.

Appendix A. Changes between Revisions

Acknowledgments

This work is derived from the [I-D.ietf-opsawg-ucl-acl]. There is a desire from the OPSAWG to see this model be separately defined for wide use in scheduling context.

Thanks to Adrian Farrel, Wei Pan, Tianran Zhou, and Joe Clarke for their valuable comments and inputs to this work.

Authors' Addresses

Qiufang Ma
Huawei
101 Software Avenue, Yuhua District
Jiangsu
210012
China
Qin Wu
Huawei
101 Software Avenue, Yuhua District
Jiangsu
210012
China
Mohamed Boucadair
Orange
35000 Rennes
France
Daniel King
Lancaster University
United Kingdom