Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C++] NTP #25

Open
zinccyy opened this issue Mar 27, 2023 · 0 comments
Open

[C++] NTP #25

zinccyy opened this issue Mar 27, 2023 · 0 comments
Assignees
Labels
feature Application feature.

Comments

@zinccyy
Copy link
Contributor

zinccyy commented Mar 27, 2023

The following subset of the ietf-system YANG module should be implemented in the new C++ port of the plugin:

container ntp {
  if-feature ntp;
  presence
    "Enables the NTP client unless the 'enabled' leaf
     (which defaults to 'true') is set to 'false'";
  description
    "Configuration of the NTP client.";

  leaf enabled {
    type boolean;
    default true;
    description
      "Indicates that the system should attempt to
       synchronize the system clock with an NTP server
       from the 'ntp/server' list.";
  }
  list server {
    key name;
    description
      "List of NTP servers to use for system clock
       synchronization.  If '/system/ntp/enabled'
       is 'true', then the system will attempt to
       contact and utilize the specified NTP servers.";

    leaf name {
      type string;
      description
        "An arbitrary name for the NTP server.";
    }
    choice transport {
      mandatory true;
      description
        "The transport-protocol-specific parameters for this
         server.";

      case udp {
        container udp {
          description
            "Contains UDP-specific configuration parameters
             for NTP.";
          leaf address {
            type inet:host;
            mandatory true;
            description
              "The address of the NTP server.";
          }
          leaf port {
            if-feature ntp-udp-port;
            type inet:port-number;
            default 123;
            description
              "The port number of the NTP server.";
          }
        }
      }
    }
    leaf association-type {
      type enumeration {
        enum server {
          description
            "Use client association mode.  This device
             will not provide synchronization to the
             configured NTP server.";
        }
        enum peer {
          description
            "Use symmetric active association mode.
             This device may provide synchronization
             to the configured NTP server.";
        }
        enum pool {
          description
            "Use client association mode with one or
             more of the NTP servers found by DNS
             resolution of the domain name given by
             the 'address' leaf.  This device will not
             provide synchronization to the servers.";
        }
      }
      default server;
      description
        "The desired association type for this NTP server.";
    }
    leaf iburst {
      type boolean;
      default false;
      description
        "Indicates whether this server should enable burst
         synchronization or not.";
    }
    leaf prefer {
      type boolean;
      default false;
      description
        "Indicates whether this server should be preferred
         or not.";
    }
  }
}

augyang should be used as in the current C implementation for configuring the NTP config files. Support for systemd-timesyncd should also be added as a replacement for the config file manipulation.

@zinccyy zinccyy added the feature Application feature. label Mar 27, 2023
@zinccyy zinccyy self-assigned this Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Application feature.
Projects
None yet
Development

No branches or pull requests

1 participant