Network Time Protocol (NTP) is a protocol used to synchronize computer clock times in a network.
NTP OpEN API
This document provides a brief description of the NTP OpEN APIs. The NTP OpEN APIs allow processes outside of the EFOS main process (switchdrvr) access to NTP services. It provides the following services:
- Add/Get/Delete a NTP server.
- Get maximum number of NTP servers supported.
- Get maximum length of NTP server address.
- Get NTP server address type.
- Set/Get NTP mode.
- Get NTP supported mode.
- Get the address type, IP address, stratum, reference ID, mode of the active NTP server.
- Get the number of NTP servers configured.
- Set/Get NTP authentication mode.
- Set/Get NTP broadcast delay.
- Set/Get NTP source interface.
- Set/Get NTP VRF name.
- Set/Get NTP server authentication key.
- Set/Get NTP server max poll interval.
- Set/Get NTP server min poll interval.
- Set/Get NTP server prefer status.
- Set/Get NTP server burst status.
- Set/Get NTP server iburst status.
- Set/Get NTP server version.
- Add/Get/Delete NTP authentication table key.
- Set/Get NTP authentication table key value.
- Set/Get NTP authentication table algorithm.
- Set/Get NTP autentication key trusted status.
All 'Set' operations may affect the Switch behavior and configuration.
Example C Application ntp_example
Initialization
In the main function, the sample application initializes the OpEN API RPC service by calling openapiClientRegister() and waits for the RPC service in switchdrvr to start. A Client Handle is returned by openapiClientRegister() which is used while invoking the OpEN APIs. The application then exercises the associated OpEN APIs and logs informational and/or error messages on the console. The example application runs to its completion and exits.
ntp_example
ntp_example.c is a sample application that demonstrates the use of the NTP OpEN APIs. ntp_example is started from the command line and has the following usage syntax:
Usage: ntp_example <test#> <arg1> <arg2> ...
- Test 1: Add NTP server: ntp_example 1 <ntp-server>
- Test 2: Delete NTP server: ntp_example 2 <ntp-server>
- Test 3: Get NTP server info: ntp_example 3
- Test 4: Set NTP mode: ntp_example 4 <ntp-mode>
- Test 5: Get NTP info: ntp_example 5
- Test 6: Set NTP authentication mode: ntp_example 6 <ntp auth="" mode>="">
- Test 7: Set NTP broadcast delay: ntp_example 7 <broadcast delay>="">
- Test 8: Set NTP source interface: ntp_example 8 <interface number>="">
- Test 9: Set NTP VRF name: ntp_example 9 <vrf-name>
- Test 10: Set NTP server authentication key: ntp_example 10 <key-number>
- Test 11: Set NTP server max poll interval: ntp_example 11 <max-poll>
- Test 12: Set NTP server min poll interval: ntp_example 12 <min-poll>
- Test 13: Set NTP server prefer status: ntp_example 13 <prefer-status>
- Test 14: Set NTP server burst status: ntp_example 14 <burst-status>
- Test 15: Set NTP server iburst status: ntp_example 15 <iburst-status>
- Test 16: Set NTP server version: ntp_example 16 <version>
- Test 17: Add NTP authentication table key: ntp_example 17 <key-number> <key-value> <isEncrypted> <auth alg>="">
- Test 18: Delete NTP authentication table key: ntp_example 18 <key-number>
- Test 19: Set NTP authentication table key value: ntp_example 19 <key-number> <key-value> <isEncrypted>
- Test 20: Set NTP authentication table algorithm: ntp_example 20 <key-number> <auth alg>="">
- Test 21: Set NTP autentication key trusted status: ntp_example 21 <key-number> <trusted status>="">
- Test 22: Get NTP authentication table info: ntp_example 22
- Test 23: ntp_example OpEN APIs sanity: ntp_example 23
It exercises all the NTP OpEN APIs with appropriate arguments to manage the NTP component in the EFOS main process (switchdrvr).
NTP CLI/API Cross Reference