Configuring NTP

FlexSwitch provides the ability to connect to multiple NTP servers. This can be done using either the CLI (ntpserver context) or through the REST interface.

Using the CLI to Configure NTP Servers

Use the CLI ntpserver context to create an NTP server object. You may specify an IP Address or a valid fully qualified URL.

Create the NTP Server Object

Follow the example below to create the NTP server object and assign a server address.

localhost(config)#ntpserver 0.north-america.pool.ntp.org
localhost(config-ntpserver)#

Note

You can specify either a fully qualified domain name (FQDN) or an IP Address as the argument to ntpserver.

Verify the Information

Use the showunapplied context control command to verify that information you supplied is ready to be applied.

localhost(config-ntpserver)#showunapplied 

Pending Config
NOTE: If attribute is not user provisioned default values shown, when config is applied a
read before write action will occur to fill in values of attributes not set by user.

id: 1   object: NtpServer   status: PENDING CONFIG  valid: True delete: False num user cmds: 1
 command                         attr         value                           model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------------------------------------------------
 ntpserver                       ntpserver    0.north-america.pool.ntp.org    IpAddr        True     X           X           Wed Aug  2 23:04:42 2017 
 0.north-america.pool.ntp.org     

Apply the Configuration

Use the apply command to apply the configuration.

localhost(config-ntpserver)#apply
Applying Config:
id: 1   object: NtpServer   status: APPLIED CONFIG  valid: True delete: False num user cmds: 1
 command                         attr         value                           model attr    iskey    required    userprov    time provisioned         
------------------------------------------------------------------------------------------------------------------------------------------------------
 ntpserver                       ntpserver    0.north-america.pool.ntp.org    IpAddr        True     X           X           Wed Aug  2 23:04:42 2017 
 0.north-america.pool.ntp.org                                                                                                                         

sdk:createNtpServer(0.north-america.pool.ntp.org,MinPoll=6,MaxPoll=10,SourceIntf=ma1) result: SUCCESS: http status code: 201

Verify the Configuration

Use the show ntpserver command, as shown in the example below, to verify that the configuration was successfully applied.

localhost(config)#show ntpserver 
Applying Show:
------------------------------------------------------------------
 IpAddr                          SourceIntf    MinPoll    MaxPoll 
------------------------------------------------------------------
 0.north-america.pool.ntp.org    ma1           6          10      
sdk:printNtpServerStates() result: SUCCESS

Using the REST Interface to Configure NTP Servers

Create an NTP Server Object

To configure an NTP server object, follow the example below.

localhost$ curl -k -u <username>:<password> -H "Content-Type: application/json" -d '{"IpAddr":"0.north-america.pool.ntp.org"}' -X POST https://192.168.100.91/public/v1/config/ntpserver | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   325  100   284  100    41    114     16  0:00:02  0:00:02 --:--:--   114
{
    "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
    "Access-Control-Allow-Methods": "POST, GET, OPTIONS, PATCH, DELETE",
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Max_age": "86400",
    "ObjectId": "712ee94b-c440-4782-5740-eb5222c0588a",
    "Result": "Success"
}

Verify the Configuration

Use the REST GET method as shown below to verify the configuration.

localhost$ curl -X  GET -k -u <username>:<password>  https://192.168.100.91:443/public/v1/config/NtpServers | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   224  100   224    0     0    822      0 --:--:-- --:--:-- --:--:--   823
{
    "CurrentMarker": 0,
    "MoreExist": false,
    "NextMarker": 0,
    "ObjCount": 1,
    "Objects": [
        {
            "Object": {
                "IpAddr": "0.north-america.pool.ntp.org",
                "MaxPoll": 10,
                "MinPoll": 6,
                "SourceIntf": "ma1"
            },
            "ObjectId": "712ee94b-c440-4782-5740-eb5222c0588a"
        }
    ]
}