<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc [
    <!ENTITY RFC2119 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
    <!ENTITY RFC3688 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3688.xml'>
    <!ENTITY RFC6020 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml'>
    <!ENTITY RFC6241 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml'>
    <!ENTITY RFC6242 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6242.xml'>
    <!ENTITY RFC7950 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml'>
    <!ENTITY RFC8040 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8040.xml'>
    <!ENTITY RFC8174 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml'>
    <!ENTITY RFC8340 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml'>
    <!ENTITY RFC8341 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8341.xml'>
    <!ENTITY RFC8342 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8342.xml'>
    <!ENTITY RFC8446 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml'>
    <!ENTITY RFC8792 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8792.xml'>
    <!ENTITY RFC9657 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.9657.xml'>
    <!ENTITY RFC9911 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.9911.xml'>
    <!ENTITY I-D.ietf-netmod-schedule-yang PUBLIC ''
     'http://xml.resource.org/public/rfc/bibxml-ids/reference.I-D.draft-ietf-netmod-schedule-yang-10.xml'>
    ]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="no" ?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>

<?rfc rfcedstyle="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" docName="draft-ietf-tvr-schedule-yang-08" ipr="trust200902"
     consensus="true" submissionType="IETF" version="3">
  <!-- category values: std, bcp, info, exp, and historic
     ipr values: full3667, noModification3667, noDerivatives3667
     you can add the attributes updates="NNNN" and obsoletes="NNNN"
     they will automatically be output with "(if approved)" -->

  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the
         full title is longer than 39 characters -->

  <title abbrev="TVR Schedule YANG">YANG Data Model for Scheduled Attributes </title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <!-- Another author who claims to be an editor -->

    <author fullname="Yingzhen Qu" initials="Y" surname="Qu">
      <organization>Futurewei Technologies</organization>
      <address>
        <phone></phone>
        <email>yingzhen.ietf@gmail.com</email>
      </address>
    </author>
    <author fullname="Acee Lindem" initials="A." surname="Lindem">
      <organization>Arrcus, Inc.</organization>
      <address>
        <email>acee.ietf@gmail.com</email>
      </address>
    </author>
    <author initials='E.' surname='Kinzie' fullname='Eric Kinzie'>
      <organization>LabN Consulting, L.L.C.</organization>
      <address>
        <email>ekinzie@labn.net</email>
      </address>
    </author>
    <author initials='D.' surname='Fedyk' fullname='Don Fedyk'>
      <organization>LabN Consulting, L.L.C.</organization>
      <address>
        <email>dfedyk@labn.net</email>
      </address>
    </author>
    <author fullname="Marc Blanchet" initials="M." surname="Blanchet">
      <organization>Viagenie</organization>
      <address>
        <postal>
          <street></street>
          <city></city>
        </postal>
        <email>marc.blanchet@viagenie.ca</email>
      </address>
    </author>
    <date/>

    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill
         in the current day for you. If only the current year is specified, xml2rfc will fill
   in the current day and month for you. If the year is not the current one, it is
   necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the
   purpose of calculating the expiry date).  With drafts it is normally sufficient to
   specify just the year. -->

    <!-- Meta-data Declarations -->

    <area>General</area>

    <workgroup>Internet</workgroup>

    <!-- WG name at the upperleft corner of the doc,
         IETF is fine for individual submissions.
   If this element is not present, the default is "Network Working Group",
         which is used by the RFC Editor as a nod to the history of the IETF. -->

    <!-- Keywords will be incorporated into HTML output
         files in a meta tag but they have no effect on text or nroff
         output. If you submit your draft to the RFC Editor, the
         keywords will be used for the search engine. -->

    <abstract>
      <t>
        The YANG model in this document includes three modules, and can be used
        to manage network resources and topologies with scheduled attributes, such
        as predictable link loss and link connectivity as a function of time. The intent
        is to have this information be utilized by Time-Variant Routing systems.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Overview">
      <t>
        YANG <xref target="RFC7950"></xref> is a data definition language
        used to define the contents of a conceptual data store
        that allows networked devices to be managed using NETCONF
        <xref target="RFC6241"/>.  YANG is proving relevant beyond its
        initial confines, as bindings to other interfaces (e.g., ReST) and
        encodings other than XML (e.g., JSON) are being defined.  Furthermore,
        YANG data models can be used as the basis for implementation of other
        interfaces, such as CLI and programmatic APIs.
      </t>

      <t>There are use cases where changes to the routing topology are expected as
      part of network operations. In some network scenarios, it's possible to predict the times
        at which one router will be able to establish a link with another router.
        Links can be predictably lost and re-established, and neighbors may
        change as a function of time. For examples of such networks and
        scenarios, please reference TVR (Time-Variant Routing) Use Cases
       <xref target="RFC9657"/>.</t>

      <t>
        The YANG model in this document can be used to manage network resources
        and topologies with scheduled attributes. There are three YANG modules
        in this document.
      </t>

      <t>Module ietf-tvr-schedule.yang contains the schedule YANG definitions. Module
        ietf-tvr-topology.yang defines a network topology with time-variant
        availability. Module ietf-tvr-node.yang is to be used to manage scheduled
        attributes of a single node.
      </t>

      <t>
        The YANG modules in this document conform to the Network Management
        Datastore Architecture (NMDA) <xref target="RFC8342"/>.
      </t>

      <section title="Requirements Language">
        <t>
          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 <xref target="RFC2119"/> <xref target="RFC8174" format="default"/>
        when, and only when, they appear in all capitals, as shown here.</t>
      </section>
    </section>

    <section title="Tree Diagrams">
      <t>
        This document uses the graphical representation of data models
        defined in <xref target="RFC8340"/>.
      </t>
    </section>

    <section title="Design of the model">
      <section title="Schedule Definitions">
        <t>Module ietf-tvr-schedule.yang contains schedule definitions
          that can be used by other modules.
        </t>
        <t>
          The grouping "tvr-schedule" consists of a list of schedules, and each
          schedule is either a single time period or recurring time periods. For each schedule
          instance, it utilizes the groupings "period-of-time" and "recurrence-utc" as
          defined in <xref target="I-D.ietf-netmod-schedule-yang"/>.
        </t>
        <t>
          Users can supply attributes or containers that augment the schedule.
          The "tvr-node" has a container "scheduled-attributes" that  
          uses the "tvr-schedule". 
        </t> 
        <t>
          When an attribute's schedule ends, the "value-default" MAY
          be used, when present. Alternatively, values can remain as set until another
          schedule alters values. 
        </t>

        <t>
          The following figure provides an illustration of two attributes and
          their scheduled value changes. The attributes A1 and A2 take on different
          values at different times. The attribute A1 will take on the value v1 from
          the time t0 until t1, the value v2 from t1 until t2, and v3 from t2 until t3.
          The schedule of A1 may contain a list of 3 time periods with different values.
          The attribute A2 will take on the value vv1 from time t0 until t1, default value
          va2 from t1 until t2, and vv2 from t1 until t3. The schedule of A2 may contain
          a list of two time periods, and the default value is used between scheduled values.
        </t>
        <figure>
          <name>Time Varying Properties</name>
          <artwork>
Attributes
          +-------------------+----------+------+
      A1  |       v1          |   v2     |  v3  |
          +-------------------+----------+------+
      A2  |      vv1          |  va2     |  vv2 |
          +-------------------+-----------------+
         t0                  t1        t2      t3
                         Time
          </artwork>
        </figure>

      </section>
      <section title="TVR Node YANG Module">
        <t>Module ietf-tvr-node.yang is a device model and designed to
          manage a single node with scheduled attributes.</t>
        <t>Each node has scheduled power at the node level. At the interface
          level, a node has a list of interfaces, and each interface has its
          own schedule for availability/power up and down, scheduled
          bandwidth, and scheduled neighbors.</t>
      </section>
      <section title="TVR Topology YANG Module">
        <t>
          Module ietf-tvr-topology.yang describes a network topology with
          a time-variant availability schedule.
        </t>
        <t>
          The module has a list of nodes, identified by a unique "node-id".
          Each node has a list of links. Links are modeled as unidirectional.
          Link availability is described from the viewpoint of a particular
          source node (the transmitting node) and beginning at a particular
          time. Each link in the list contains the range of times during
          which it is available.
        </t>
        <t>
          The "source-link-id" is a string and used to identify a link
          as viewed from the source-node. Bandwidth and delay are predicted
          link attributes. Delay is the link propagation time and does not
          include any queuing delays. "destination-node" of a link may follow
          a schedule as well.
        </t>
      </section>

    </section>

  <section title="TVR YANG Trees">
    <section title="TVR Node YANG Tree">
    <t>
      The following figure shows the tree diagram of the TVR Node
      scheduling.
    </t>

      <artwork>
module: ietf-tvr-node
  +--rw node-schedule
     +--rw node-id?               inet:uri
     +--rw node-power-schedule
     |  +--rw power-default?   boolean
     |  +--rw schedule* [schedule-id]
     |     +--rw schedule-id                     uint32
     |     +--rw (schedule-type)?
     |     |  +--:(period)
     |     |  |  +--rw period-description?       string
     |     |  |  +--rw period-start?             yang:date-and-time
     |     |  |  +--rw time-zone-identifier?     sys:timezone-name
     |     |  |  +--rw (period-type)?
     |     |  |     +--:(explicit)
     |     |  |     |  +--rw period-end?         yang:date-and-time
     |     |  |     +--:(duration)
     |     |  |        +--rw duration?           duration
     |     |  +--:(recurrence)
     |     |     +--rw recurrence-first
     |     |     |  +--rw start-time-utc?   yang:date-and-time
     |     |     |  +--rw duration?         uint32
     |     |     +--rw (recurrence-end)?
     |     |     |  +--:(until)
     |     |     |  |  +--rw utc-until?          yang:date-and-time
     |     |     |  +--:(count)
     |     |     |     +--rw count?              uint32
     |     |     +--rw recurrence-description?   string
     |     |     +--rw frequency?                identityref
     |     |     +--rw interval?                 uint32
     |     +--rw power-state?                    boolean
     +--rw interface-schedule
        +--rw interface* [name]
           +--rw name                  union
           +--rw default-available?    boolean
           +--rw default-bandwidth?    yang:gauge64
           +--rw attribute-schedule
              +--rw schedule* [schedule-id]
                 +--rw schedule-id                     uint32
                 +--rw (schedule-type)?
                 |  +--:(period)
                 |  |  +--rw period-description?       string
                 |  |  +--rw period-start?
                 |  |  |       yang:date-and-time
                 |  |  +--rw time-zone-identifier?
                 |  |  |       sys:timezone-name
                 |  |  +--rw (period-type)?
                 |  |     +--:(explicit)
                 |  |     |  +--rw period-end?
                 |  |     |          yang:date-and-time
                 |  |     +--:(duration)
                 |  |        +--rw duration?           duration
                 |  +--:(recurrence)
                 |     +--rw recurrence-first
                 |     |  +--rw start-time-utc?   yang:date-and-time
                 |     |  +--rw duration?         uint32
                 |     +--rw (recurrence-end)?
                 |     |  +--:(until)
                 |     |  |  +--rw utc-until?
                 |     |  |          yang:date-and-time
                 |     |  +--:(count)
                 |     |     +--rw count?              uint32
                 |     +--rw recurrence-description?   string
                 |     +--rw frequency?                identityref
                 |     +--rw interval?                 uint32
                 +--rw scheduled-attributes
                    +--rw available?   boolean
                    +--rw bandwidth?   yang:gauge64
                    +--rw neighbor?    inet:uri
      </artwork>
    </section>
    <section title="TVR Topology YANG Tree">
      <t>
        The following figure shows the tree diagram of the TVR Topology
      scheduling.
    </t>

      <artwork>
module: ietf-tvr-topology
  +--rw topology-schedule
     +--rw node* [node-id]
     |  +--rw node-id      inet:uri
     |  +--rw available
     |     +--rw default-node-available?   boolean
     |     +--rw schedule* [schedule-id]
     |        +--rw schedule-id                     uint32
     |        +--rw (schedule-type)?
     |        |  +--:(period)
     |        |  |  +--rw period-description?       string
     |        |  |  +--rw period-start?
     |        |  |  |       yang:date-and-time
     |        |  |  +--rw time-zone-identifier?     sys:timezone-name
     |        |  |  +--rw (period-type)?
     |        |  |     +--:(explicit)
     |        |  |     |  +--rw period-end?
     |        |  |     |          yang:date-and-time
     |        |  |     +--:(duration)
     |        |  |        +--rw duration?           duration
     |        |  +--:(recurrence)
     |        |     +--rw recurrence-first
     |        |     |  +--rw start-time-utc?   yang:date-and-time
     |        |     |  +--rw duration?         uint32
     |        |     +--rw (recurrence-end)?
     |        |     |  +--:(until)
     |        |     |  |  +--rw utc-until?
     |        |     |  |          yang:date-and-time
     |        |     |  +--:(count)
     |        |     |     +--rw count?              uint32
     |        |     +--rw recurrence-description?   string
     |        |     +--rw frequency?                identityref
     |        |     +--rw interval?                 uint32
     |        +--rw node-available?                 boolean
     +--rw link* [source-node source-link-id]
        +--rw source-node                           inet:uri
        +--rw source-link-id                        string
        +--rw available
           +--rw schedule* [schedule-id]
           |  +--rw schedule-id                     uint32
           |  +--rw (schedule-type)?
           |  |  +--:(period)
           |  |  |  +--rw period-description?       string
           |  |  |  +--rw period-start?
           |  |  |  |       yang:date-and-time
           |  |  |  +--rw time-zone-identifier?     sys:timezone-name
           |  |  |  +--rw (period-type)?
           |  |  |     +--:(explicit)
           |  |  |     |  +--rw period-end?
           |  |  |     |          yang:date-and-time
           |  |  |     +--:(duration)
           |  |  |        +--rw duration?           duration
           |  |  +--:(recurrence)
           |  |     +--rw recurrence-first
           |  |     |  +--rw start-time-utc?   yang:date-and-time
           |  |     |  +--rw duration?         uint32
           |  |     +--rw (recurrence-end)?
           |  |     |  +--:(until)
           |  |     |  |  +--rw utc-until?
           |  |     |  |          yang:date-and-time
           |  |     |  +--:(count)
           |  |     |     +--rw count?              uint32
           |  |     +--rw recurrence-description?   string
           |  |     +--rw frequency?                identityref
           |  |     +--rw interval?                 uint32
           |  +--rw link-attributes
           |     +--rw link-available?     boolean
           |     +--rw bandwidth?          yang:gauge64
           |     +--rw delay?              uint32
           |     +--rw destination-node?   inet:uri
           +--rw default-link-available?   boolean
           +--rw default-bandwidth?        yang:gauge64
           +--rw default-delay?            uint32
      </artwork>
    </section>

  </section>


  <section title="TVR Schedule YANG Modules">
    <t>
      The following RFC is not referenced in the document text but is
   referenced in the "ietf-tvr-schedule.yang" module and
   "ietf-tvr-topology.yang" module: <xref target="RFC9911"/>.
   </t>
    <section title="TVR Schedule YANG Module">
      <artwork><![CDATA[
<CODE BEGINS> file "ietf-tvr-schedule@2025-06-30.yang"
module ietf-tvr-schedule {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tvr-schedule";
  prefix tvr-schd;

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

  organization
    "IETF TVR - Time Variant Routing Working Group";
  contact
    "WG Web:   <http://datatracker.ietf.org/wg/tvr>
     WG List:  <mailto:tvr@ietf.org>

     Author:   Yingzhen Qu
               <mailto:yingzhen.ietf@gmail.com>
     Author:   Acee Lindem
               <mailto:acee.ietf@gmail.com>
     Author:   Marc Blanchet
               <mailto:marc.blanchet@viagenie.ca>
     Author:   Eric Kinzie
               <mailto:ekinzie@labn.net>
     Author:   Don Fedyk
               <mailto:dfedyk@labn.net>";

  description
    "The YANG module contains common YANG definitions for
     time-variant schedule.

     This YANG model conforms to the Network Management
     Datastore Architecture (NMDA) as described in RFC 8342.

     Copyright (c) 2025 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.";

  reference
    "RFC XXXX: YANG Data Model for Scheduled Attributes";

  revision 2025-06-30 {
    description
      "Initial Version";
    reference
      "RFC XXXX: YANG Data Model for Scheduled Attributes.";
  }

  grouping tvr-schedule {
    list schedule {
      key schedule-id;
      leaf schedule-id {
        type uint32;
        description
          "Identifies the schedule.";
      }
      choice schedule-type {
        description
          "Choice of schedule type.";
        case period {
          description
            "A schedule with a single instance.";
          uses schedule:period-of-time;
        }
        case recurrence {
          description
            "A schedule with recurrence. The time is defined in UTC
             format.";
          uses schedule:recurrence-utc;
        }
      }

      description
        "list of schedules.";
    }
    description
      "A common grouping definition of schedules.";
  }

}
<CODE ENDS>
      ]]></artwork>
    </section>
    <section title="TVR Schedule Node Module">
      <artwork><![CDATA[
<CODE BEGINS> file "ietf-tvr-node@2026-02-09.yang"
module ietf-tvr-node {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tvr-node";
  prefix tvr-node;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types";
  }

  import ietf-yang-types {
    prefix "yang";
    reference
      "RFC 9911: Common YANG Data Types";
  }

  import ietf-tvr-schedule {
    prefix "tvr-schd";
  }

  organization
    "IETF TVR - Time Variant Routing Working Group";
  contact
    "WG Web:   <http://datatracker.ietf.org/wg/tvr>
     WG List:  <mailto:tvr@ietf.org>

     Author:   Yingzhen Qu
               <mailto:yingzhen.ietf@gmail.com>
     Author:   Acee Lindem
               <mailto:acee.ietf@gmail.com>
     Author:   Marc Blanchet
               <mailto:marc.blanchet@viagenie.ca>
     Author:   Eric Kinzie
               <mailto:ekinzie@labn.net>
     Author:   Don Fedyk
               <mailto:dfedyk@labn.net>";

  description
    "The YANG module is to configure and manage node attributes
     with schedules.

     This YANG model conforms to the Network Management
     Datastore Architecture (NMDA) as described in RFC 8342.

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

  reference
    "RFC XXXX: YANG Data Model for Scheduled Attributes";

  revision 2022-02-09 {
    description
      "Initial Version";
    reference
      "RFC XXXX: YANG Data Model for Scheduled Attributes.";
  }

  container node-schedule {
    description
      "This container defines a node's time variant attributes
       with schedules.";

    leaf node-id {
      type inet:uri;
      description
        "Identifier for a node, uniquely identifies a node.";
    }


    container node-power-schedule {
      description
        "Power schedule for the node. The node's power is
         represented by a boolean value with 'true' indicating
         the node is powered on and 'false' indicating the node
         is powered off.";

      leaf power-default {
        type boolean;
        default false;
        description
          "This indicates the default node power for the time
           periods when no specific power value is specified. If
           unspecified, the node is powered down by default.";
      }
      uses tvr-schd:tvr-schedule {
        augment "schedule" {
          description
            "Augment the power state within each period.";
          leaf power-state {
            type boolean;
            description
              "Indicates whether the node is powered on.";
          }
        }
      }
    }

    container interface-schedule {
      description
        "Container for TVR node interface attributes.";

      list interface {
        key "name";
        description
          "List of interface with schedules.";
        leaf name {
          type union {
            type yang:xpath1.0;
            type string;
          }
          description
            "Name of the interface.
             If used with the ietf-interfaces module, the xpath name
             is to identify the interface.";
        }
        leaf default-available {
          type boolean;
          default false;
          description
            "By default, the link is not available.";
        }
        leaf default-bandwidth {
          type yang:gauge64;
          units "bits/second";
          default "0";
          description
            "The default interface bandwidth in bits
             per second";
        }

        container attribute-schedule {
          description
            "Interface attributes with schedules.";

          uses tvr-schd:tvr-schedule {
            augment "schedule" {
              description
                "Augment scheduled interface state.";
              container scheduled-attributes {
                description
                  "Augmentation container for links.";
                leaf available {
                  type boolean;
                  description
                    "Scheduled interface power state. This is to
                     work with the leaf 'enabled' for the configured
                     state of the interface.";
                }
                leaf bandwidth {
                  type yang:gauge64;
                  units "bits/second";
                  description
                    "The scheduled bandwidth in bits per second";
                }
                leaf neighbor {
                  type inet:uri;
                  description
                    "The node expected to be this interface's neighbor
                    during this time.";
                }
              }
            }
          }
        }
      }
    }
  }
}
<CODE ENDS>
      ]]></artwork>
    </section>
    <section title="TVR Network Topology Module">
      <artwork><![CDATA[
<CODE BEGINS> file "ietf-tvr-topology@2026-02-09.yang"
module ietf-tvr-topology {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-tvr-topology";
  prefix tvr-topo;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types";
  }

  import ietf-yang-types {
    prefix "yang";
    reference
      "RFC 9911: Common YANG Data Types";
  }

  import ietf-tvr-schedule {
    prefix "tvr-schd";
  }

  organization
    "IETF Time-Variant Routing Working Group";

  contact
    "WG Web:   <https://datatracker.ietf.org/wg/tvr/>
     WG List:  <mailto:tvr@ietf.org>

     Author:   Eric Kinzie
               <mailto:ekinzie@labn.net>
     Author:   Don Fedyk
               <mailto:dfedyk@labn.net>
     Author:   Yingzhen Qu
               <mailto:yingzhen.ietf@gmail.com>
     Author:   Acee Lindem
               <mailto:acee.ietf@gmail.com>
     Author:   Marc Blanchet
               <mailto:marc.blanchet@viagenie.ca>";

  description
    "This YANG module contains YANG definitions for describing
    network topology with a time-variant availability schedule.

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

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

  revision 2026-02-09 {
    description
      "Initial revision";
    reference
      "RFC XXXX: YANG Data Model for Scheduled Attributes";
  }

  container topology-schedule {
    description
      "Network topology schedules.";
    list node {
      key "node-id";
      description
        "List of nodes with schedules.";
      leaf node-id {
        type inet:uri;
        description
          "Identifier for a node; uniquely identifies a node. This
           may be the same as the node-id defined in the ietf-network
           module defined in RFC 8345.";
      }
      container available {
        description
          "The time at which this node becomes available.";

        leaf default-node-available {
          type boolean;
          default false;
          description
            "By default, the node is powered off.";
        }

        uses tvr-schd:tvr-schedule {
          augment "schedule" {
            description
              "Augment scheduled node availability.";
            leaf node-available {
              type boolean;
              description
                "Node availability.";
            }
          }
        }
      }
    }

    list link {
      key "source-node source-link-id";
      description
        "List of links.";
      leaf source-node {
        type inet:uri;
        description
          "A name refers to the source node of the link.";
      }
      leaf source-link-id {
        type string;
        description
          "A name refers to the link of the source node.";
      }
      container available {
        description
          "The time at which this link becomes available.";
        uses tvr-schd:tvr-schedule {
          augment "schedule" {
            description
              "Augment scheduled values.";
            container link-attributes {
              description "Augmentation container for links.";
              leaf link-available {
                type boolean;
                description
                  "The predicted link availability.";
              }
              leaf bandwidth {
                type yang:gauge64;
                units "bits/second";
                description
                  "The predicted link capacity. If the value measured
                   by the system is less than this value, the system
                   value is used. If the value measured by the system
                   is greater than this value the predicted value
                   SHOULD be used.";
              }
              leaf delay {
                type uint32 {
                  range "0..16777215";
                }
                description
                  "The predicted one-way delay or latency in
                  microseconds. If the value measured by the system is
                  less than this value the predicted value SHOULD be
                  used.";
              }
              leaf destination-node {
                type inet:uri;
                description
                  "A name refers to the destination node of the link.";
              }
            }
          }
        }
        leaf default-link-available {
          type boolean;
          default "false";
          description
            "The default link availability.  During times when the
             schedule does not specify an availability, this value
             is used.";
        }
        leaf default-bandwidth {
          type yang:gauge64;
          units "bits/second";
          default "0";
          description
            "The default link capacity specified in a
             generic format.";
        }
        leaf default-delay {
          type uint32 {
            range "0..16777215";
          }
          description
            "The default one-way delay in microseconds.";
        }
      }
    }
  }
}
<CODE ENDS>
      ]]></artwork>
    </section>
  </section>


    <!-- Possibly a 'Contributors' section ... -->
    <section anchor="Operation" title="Operational Considerations">
      <t>
        The TVR Schedule YANG modules provide a structured mechanism to
        represent time-variant attributes of network elements and topologies. The
        following aspects should be considered by operators deploying the modules.</t>
      <t>
        Operators should be aware that these scheduled attributes represent planned
        state changes, not instantaneous configuration changes or unplanned breakages.</t>
      <t>
        A schedule can be defined using a series of periods or intervals with
        recurrence. The model defined in this document doesn't prevent a configuration
        to mix both styles. However, it's not recommended.</t>
      <t>
        There should be synchronized clocks between controllers and devices. The time
        sources (e.g., NTP, PTP) should be accurate to avoid unintended time/schedule
        offsets. Inconsistent time bases can lead to network misbehavior, such as
        routing loops or network instability.</t>
      <t>
        The modules are to support TVR use cases where topology and attributes vary
        as a function of time. How control plane and data plane are impacted by the
        schedules should be considered by the operators.</t>
      <t>
        The TVR schedule modules are meant to work together with other models that
        manage node or interface attributes. Operators should consider the conflicting
        configurations between the scheduled and non-scheduled settings and how to
        handle the conflicts.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>
        The YANG modules specified in this document define a schema for
        data that is designed to be accessed via network
        management protocols such as NETCONF <xref target="RFC6241"/> or
        RESTCONF <xref target="RFC8040"/>. The lowest NETCONF layer is the secure transport
        layer, and the mandatory-to-implement secure transport is Secure Shell (SSH)
        <xref target="RFC6242"/>. The lowest RESTCONF layer is HTTPS, and the
        mandatory-to-implement secure transport is TLS <xref target="RFC8446"/>.
      </t>

      <t>
        The NETCONF access control model <xref target="RFC8341"/> provides the
        means to restrict access for particular NETCONF or RESTCONF users to a
        pre-configured subset of all available NETCONF or RESTCONF protocol
        operations and content.
      </t>

      <t>
        There are a number of data nodes defined in ietf-tvr-node.yang module and
        ietf-tvr-topology.yang
        that are writable/creatable/deletable (i.e., config true, which is the default).
        These data nodes may be considered sensitive or vulnerable in some network
        environments. Write operations (e.g., edit-config) to these data nodes without
        proper protection can have a negative effect on network operations. There are
        the subtrees and data nodes and their sensitivity/vulnerability:
      </t>
      <ul spacing="compact" empty="true">
        <li>/node-schedule/node-power-schedule</li>
        <li>/node-schedule/interface-schedule</li>
        <li>/topology-schedule/nodes/available</li>
        <li>/topology-schedule/links/available</li>
        <li>Modifications to these scheduled attributes may result in a
        denial of service.</li>
      </ul>

      <t>
        Some of the readable data nodes in the ietf-tvr-node.yang module and ietf-tvr-topolgy.yang module
        may be considered sensitive or vulnerable in some network environments. It is thus
        important to control read access (e.g., via get, get-config, or notification)
        to these data nodes.
      </t>

   </section>
<section title="IANA Considerations">
  <t>
    This document registers a URI in the IETF XML registry
    <xref target="RFC3688"/>.  Following the format in <xref target="RFC3688"/>,
    the following registration is requested to be made:
  </t>

   <artwork>
   URI: urn:ietf:params:xml:ns:yang:ietf-tvr-schedule
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
   </artwork>
   <artwork>
   URI: urn:ietf:params:xml:ns:yang:ietf-tvr-node
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
   </artwork>
      <artwork>
   URI: urn:ietf:params:xml:ns:yang:ietf-tvr-topology
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
   </artwork>
   <t>
     This document registers a YANG module in the YANG Module Names
     registry <xref target="RFC6020"/>.
   </t>
   <artwork>
   name: ietf-tvr-schedule
   namespace: urn:ietf:params:xml:ns:yang:ietf-tvr-schedule
   prefix: tvr-schd
   reference: RFC XXXX
   </artwork>
    <artwork>
   name: ietf-tvr-node
   namespace: urn:ietf:params:xml:ns:yang:ietf-tvr-node
   prefix: tvr-node
   reference: RFC XXXX
   </artwork>
   <artwork>
   name: ietf-tvr-topology
   namespace: urn:ietf:params:xml:ns:yang:ietf-tvr-topology
   prefix: tvr-topo
   reference: RFC XXXX
   </artwork>
</section>
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The YANG model was developed using the suite of YANG tools written
      and maintained by numerous authors.</t>
    </section>
  </middle>

  <!--  *****BACK MATTER ***** -->

  <back>
    <!-- References split into informative and normative -->

    <!-- There are 2 ways to insert reference entries from the citation libraries:
     1. define an ENTITY at the top, and use "ampersand character"RFC2629; here (as shown)
     2. simply use a PI "less than character"?rfc include="reference.RFC.2119.xml"?> here
        (for I-Ds: include="reference.I-D.narten-iana-considerations-rfc2434bis.xml")

     Both are cited textually in the same manner: by using xref elements.
     If you use the PI option, xml2rfc will, by default, try to find included files in the same
     directory as the including file. You can also define the XML_LIBRARY environment variable
     with a value containing a set of directories to search.  These can be either in the local
     filing system or remote ones accessed by http (http://domain/dir/... ).-->

    <references title="Normative References">
      <!--?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?-->
      &RFC2119;
      &RFC3688;
      &RFC6020;
      &RFC6241;
      &RFC6242;
      &RFC7950;
      &RFC8040;
      &RFC8174;
      &RFC8341;
      &RFC8342;
      &RFC8446;
      &RFC9911;
      &I-D.ietf-netmod-schedule-yang;
    </references>
    <references title="Informative References">
      <!-- Here we use entities that we defined at the beginning. -->
      &RFC8340;
      &RFC8792;
      &RFC9657;
    </references>

    <section>
      <name>Example: Add a scheduled cost to OSPF interface</name>
      <t>In OSPF (Open Shortest Path First), the interface cost is a
        metric used to determine the preference or desirability of a
        particular link or interface. By default, the OSPF interface
        cost is calculated based on the bandwidth of the interface,
        and it is also configurable.</t>
      <t>This example demonstrates how an OSPF interface can be extended
        with a cost that changes with a schedule.</t>
      <artwork><![CDATA[
module example-tvr-ospf-schedule {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:example-tvr-ospf-schedule";
  prefix ospf-schedule;

  import ietf-routing {
    prefix "rt";
    reference
      "RFC 8349: A YANG Data Model for Routing
       Management (NMDA Version)";
  }
  import ietf-ospf {
    prefix "ospf";
    reference
      "RFC 9129: A YANG Data Model for OSPF Protocol";
  }

  import ietf-tvr-schedule {
    prefix "tvr-schd";
  }

  augment "/rt:routing/rt:control-plane-protocols/"
    + "rt:control-plane-protocol/ospf:ospf/ospf:areas/ospf:area/"
    + "ospf:interfaces/ospf:interface" {
    description
      "Augment OSPF interface configuration.";
    container scheduled-cost {
      description
        "Augment OSPF interface with a scheduled interface cost.";
      uses tvr-schd:tvr-schedule {
        augment "schedule" {
          leaf cost {
            type uint32;
            description
             "interface cost";
          }
          description
            "Augment schedule with an interface cost.";
        }
      }
    }
  }
}
      ]]></artwork>
    </section>

    <section>
      <name>Example: TVR Schedule Node Configuration</name>
      <t>The following is an XML example using the ietf-tvr-node YANG
        module.</t>
      <t>In this example, the node has a node-id of "node:1", and
        it's scheduled to be powered off starting from 2025-07-26T17:00:00Z
        to 2025-07-26T18:00:00Z. Interface "eth 1" has a recurrent 
        schedule to be "not available (off)" which starts from 2025-07-20T23:00:00Z, lasts for 7200
        seconds (2 hours) each time for 10 times every 2 days.</t>
      <t>
        Note: '\' line wrapping per <xref target="RFC8792"/>.</t>
      <artwork><![CDATA[
<node-schedule xmlns="urn:ietf:params:xml:ns:yang:ietf-tvr-node">
  <node-id>node:1</node-id>
  <node-power-schedule>
    <power-default>true</power-default>
    <schedule>
      <schedule-id>1</schedule-id>
      <period-description>pwr off</period-description>
      <period-start>2025-07-26T17:00:00Z</period-start>
      <time-zone-identifier>UTC</time-zone-identifier>
      <period-end>2025-07-26T18:00:00Z</period-end>
      <power-state>false</power-state>
    </schedule>
  </node-power-schedule>
  <interface-schedule>
    <interface>
      <name>eth 1</name>
      <attribute-schedule>
        <schedule>
          <schedule-id>100</schedule-id>
          <recurrence-first>
            <start-time-utc>2025-07-20T23:00:00Z</start-time-utc>
            <duration>7200</duration>
          </recurrence-first>
          <count>10</count>
          <recurrence-description>daily off</recurrence-description>
          <frequency xmlns:schedule="urn:ietf:params:xml:ns:yang:\
            ietf-schedule">schedule:daily</frequency>
          <interval>2</interval>
          <scheduled-attributes>
            <available>false</available>
          </scheduled-attributes>
        </schedule>
      </attribute-schedule>
    </interface>
  </interface-schedule>
</node-schedule>
       ]]></artwork> 
    <t>The following is the same example using JSON format.</t>
    <artwork><![CDATA[
{
    "node-schedule": {
        "-xmlns": "urn:ietf:params:xml:ns:yang:ietf-tvr-node",
        "node-id": "node:1",
        "node-power-schedule": {
            "power-default": "true",
            "schedule": {
                "schedule-id": "1",
                "period-description": "pwr off",
                "period-start": "2025-07-26T17:00:00Z",
                "time-zone-identifier": "UTC",
                "period-end": "2025-07-26T18:00:00Z",
                "power-state": "false"
            }
        },
        "interface-schedule": {
            "interface": {
                "name": "eth 1",
                "attribute-schedule": {
                    "schedule": {
                        "schedule-id": "100",
                        "recurrence-first": {
                            "start-time-utc": "2025-07-20T23:00:00Z",
                            "duration": "7200"
                        },
                        "count": "10",
                        "recurrence-description": "daily off",
                        "frequency": "ietf-schedule:daily",
                        "interval": "2",
                        "scheduled-attributes": {
                            "available": "false"
                        }
                    }
                }
            }
        }
    }
}
     ]]></artwork> 
    </section>

    <section>
      <name>Example: TVR Network Topology Configuration</name>
      <t>The following is an XML example using the ietf-tvr-topology YANG
        module.</t>
      <t>In this example, the node with a node-id of "node:1" is
        scheduled to be powered off start from 2025-07-26T17:00:00Z,
        for 2 days and four and half hours.</t>
      <t>
        Node "node:2" is scheduled to be off starting from 2025-07-20T23:00:00Z, lasting for 7200
        seconds (2 hours) every two days until 2025-08-20T23:00:00Z.</t>
      <t>
        Note: '\' line wrapping per <xref target="RFC8792"/>.</t>
      <artwork><![CDATA[
<topology-schedule xmlns="urn:ietf:params:xml:ns:yang\
  :ietf-tvr-topology">
  <node>
    <node-id>node:1</node-id>
    <available>
      <default-node-available>true</default-node-available>
      <schedule>
        <schedule-id>101</schedule-id>
        <period-description>node1 schedule</period-description>
        <period-start>2025-07-26T17:00:00Z</period-start>
        <time-zone-identifier>UTC</time-zone-identifier>
        <duration>P2DT04:30:00</duration>
        <node-available>false</node-available>
      </schedule>
    </available>
  </node>
  <node>
    <node-id>node:2</node-id>
    <available>
      <default-node-available>true</default-node-available>
      <schedule>
        <schedule-id>201</schedule-id>
        <recurrence-first>
          <start-time-utc>2025-07-20T23:00:00Z</start-time-utc>
          <duration>7200</duration>
        </recurrence-first>
        <utc-until>2025-08-20T23:00:00Z</utc-until>
        <recurrence-description>daily off</recurrence-description>
        <frequency xmlns:schedule="urn:ietf:params:xml:ns:yang:\
          ietf-schedule">schedule:daily</frequency>
        <interval>2</interval>
        <node-available>false</node-available>
      </schedule>
    </available>     
  </node>
</topology-schedule>
     ]]></artwork> 
    <t>The following is the same example using JSON format.</t>
    <artwork><![CDATA[
{
    "topology-schedule": {
        "-xmlns": "urn:ietf:params:xml:ns:yang:ietf-tvr-topology",
        "node": [
            {
                "node-id": "node:1",
                "available": {
                    "default-node-available": "true",
                    "schedule": {
                        "schedule-id": "101",
                        "period-description": "node1 schedule",
                        "period-start": "2025-07-26T17:00:00Z",
                        "time-zone-identifier": "UTC",
                        "duration": "P2DT04:30:00",
                        "node-available": "false"
                    }
                }
            },
            {
                "node-id": "node:2",
                "available": {
                    "default-node-available": "true",
                    "schedule": {
                        "schedule-id": "201",
                        "recurrence-first": {
                            "start-time-utc": "2025-07-20T23:00:00Z",
                            "duration": "7200"
                        },
                        "utc-until": "2025-08-20T23:00:00Z",
                        "recurrence-description": "daily off",
                        "frequency": "ietf-schedule:daily",
                        "interval": "2",
                        "node-available": "false"
                    }
                }
            }
        ]
    }
}
    ]]></artwork> 
    </section>


  </back>
</rfc>
