# Ntp

Module for managing the NTP configuration in EOS

This module provides an API for configuring NTP resources using EOS and eAPI.

param name: | The interface port that specifies the NTP source.
type name: | string

class `pyeapi.api.ntp.``Ntp`(*args, **kwargs)

  Bases: `pyeapi.api.abstract.Entity`

  The Ntp class implements global NTP router configuration

  `add_server`(name, prefer=False)

    Add or update an NTP server entry to the node config

    Parameters:

    - name (string) – The IP address or FQDN of the NTP server.
    - prefer (bool) – Sets the NTP server entry as preferred if True.

    Returns: | True if the operation succeeds, otherwise False.

  `create`(name)

    Instantiate the NTP by setting the source interface.

    Parameters: | name (string) – The interface port that specifies the NTP source.
    Returns: | True if the operation succeeds, otherwise False.

  `default`()

    Default the NTP source entry from the node.

    Returns: | True if the operation succeeds, otherwise False.

  `delete`()

    Delete the NTP source entry from the node.

    Returns: | True if the operation succeeds, otherwise False.

  `get`()

    Returns the current NTP configuration

    The Ntp resource returns the following:

    > - source_interface (str): The interface port that specifies
    >     NTP server
    > - servers (list): A list of the NTP servers that have been
    >     assigned to the node. Each entry in the list is a key/value pair of the name of the server as the key and None or ‘prefer’ as the value if the server is preferred.

    Returns:

    A Python dictionary object of key/value pairs that represents the current NTP configuration of the node:

        {
            "source_interface": 'Loopback0',
            'servers': [
                { '1.1.1.1': None },
                { '1.1.1.2': 'prefer' },
                { '1.1.1.3': 'prefer' },
                { '1.1.1.4': None },
            ]
        }

  `remove_all_servers`()

    Remove all NTP server entries from the node config

    Returns: | True if the operation succeeds, otherwise False.

  `remove_server`(name)

    Remove an NTP server entry from the node config

    Parameters: | name (string) – The IP address or FQDN of the NTP server.
    Returns: | True if the operation succeeds, otherwise False.

  `set_source_interface`(name)

    Assign the NTP source on the node

    Parameters: | name (string) – The interface port that specifies the NTP source.
    Returns: | True if the operation succeeds, otherwise False.

`pyeapi.api.ntp.``instance`(node)

  Returns an instance of Ntp

  Parameters: | node (Node) – The node argument passes an instance of Node to the resource
  Returns: | An instance of Ntp
  Return type: | object