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 6991: Common YANG Data Types";
  }

  import ietf-yang-types {
    prefix "yang";
    reference
      "RFC 6991: 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) 2024 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 2024-10-20 {
    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 "schedules/attr-value" {
          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 interfaces {
        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 "schedules/attr-value" {
              description
                "Augment scheduled interface state.";
              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.";
              }
            }
          }
        }
      }
    }
  }
}
