Showing results for 
Search instead for 
Did you mean: 
Cisco Employee

Contributing custom applications for NTP configuration

Just got my first YDK contribution merged (thanks for the awesome assistance  saalvare )!  We started with a relatively easy target with NTP.  Contributed two applications. - IPv4 server - IPv4 server with source interface and update-calendar knob

You can view them at:

Give them a try and let me know if you have any comments.  While we tested them on a lab environment, I also tested them to a VIRL XRv router as well that I am using as a sandbox.

To offer some input, one thing I found useful, is viewing the CLI configuration inside an XML format (using a NETCONF client).  This approach provided me a nice visual of the YANG model command hierarchy/tree, including for referencing the YDK API documents.  Give this a try.

One last thing I would add is, I am a 21 year CCIE, so this network programmability is still relatively new (last 18 months or so I have been focusing more), and I would encourage all of the network engineers to start poking around in this stuff, including GitHub.  The YDK developers have done an awesome job in making the use of YANG models much easier with these API's that are generated.  There is always a learning curve of course, and while it is different than CLI, you can see the power of automation and scalable network element changes with this tool set and NC/YANG.  I am hoping to start targeting more YDK contributions that focus on my customer use cases, so this should be one of several applications I plan to contribute.

Cisco Employee

Nice job Craig.

Cisco Employee

Thanks for the contribution.  Very much appreciated.  We're getting close to 200 sample apps! :-)


I am very new to YDK and experimenting with configuration in a lab environment. Let me ask a silly question : how do I know if configuration was successful ? I get no error message, however debugging YFW on router displays the below error - well, actually a warning :

RP/0/0/CPU0:Sep 14 10:42:03.565 : netconf[1113]: WRN: YFW: ctx=1000da90,sysdb_find_data returned an error: 'sysdb' detected the 'warning' condition 'A SysDB client tried to access a nonexistent item or list an empty directory', sysdb_path: 'cfg/gl/ip-ntp/peer/default/ipv4/08080808/'

I understand that the configuration I am trying is not valid, but still, how do I find it out only via YDK app ?

All apps have a command line option to enable logging (-v | --verbose).  You bring up a good point of adding more details on how to debug the app and validate the results.  I've created an issue to add more details on that:

Add details on app execution and debugging · Issue #74 · CiscoDevNet/ydk-py-samples · GitHub

If there's any error in your configuration, YDK will raise an exception.  It may do so because local validation of your configuration failed (e.g. your config object is not compliant with the model) or because an error was received form the NETCONF/YANG agent running on the router.

Here's an example of debugging one of Craig's apps:

$ ./ -h

usage: [-h] [-v] device

positional arguments:

  device         NETCONF device (ssh://user:password@host:port)

optional arguments:

  -h, --help     show this help message and exit

  -v, --verbose  print debugging messages



$ ./ ssh://xxxx:xxxx@pavarotti -v

2016-09-14 13:06:04,575 - ydk.providers.netconf_provider - INFO - NetconfServiceProvider connected to pavarotti:None using ssh

2016-09-14 13:06:04,586 - ydk.providers.NetconfServiceProvider - DEBUG -


<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:aa9454f8-7ab6-11e6-8c95-081196796e8c">





    <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">

      <ntp xmlns="">


















2016-09-14 13:06:04,701 - ydk.providers.NetconfServiceProvider - DEBUG -

<?xml version="1.0"?>

<rpc-reply message-id="urn:uuid:aa9454f8-7ab6-11e6-8c95-081196796e8c" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">



2016-09-14 13:06:04,701 - ydk.providers.NetconfServiceProvider - DEBUG -

<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101">



2016-09-14 13:06:05,016 - ydk.providers.NetconfServiceProvider - DEBUG -

<?xml version="1.0"?>

<rpc-reply message-id="urn:uuid:aa9454f8-7ab6-11e6-8c95-081196796e8c" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">




2016-09-14 13:06:05,017 - - INFO - CREATE operation completed

2016-09-14 13:06:05,247 - ydk.providers.netconf_provider - INFO -

NetconfServiceProvider disconnected from pavarotti:None using ssh


Thanks for the answer Santiago.

In fact, the logger shows the below line:

2016-09-15 12:02:14,066 - - INFO - CREATE operation completed

And got the answer :

<?xml version="1.0"?>

<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

<ok />


But in reality the configuration did not complete.

Create request was the following:


So actually I am unable to detect configuraiton errors.

Content for Community-Ad