cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
888
Views
0
Helpful
1
Replies

tailf set-hook with python

Thomas Tribolet
Level 1
Level 1

Hello,

 

Has someone an example of using tailf:set-hook in yang with python code call ?

How to define and register the call to the function ?

 

I can't find any doc on this.

 

Thanks for your help.

 

1 Reply 1

rogaglia
Cisco Employee
Cisco Employee

Hi,

 

tailf:set-hook is basically an extension that appliies to tailf:callpoint. It does not have any requirements from python or java or erlang as the callpoint ID will be applied as normal.

 

What tailf:set-hook does is to define if the scope of the transformation. I believe by default is "subtree" but could be set to "node" or "object".

 

Roque

 

 

tailf:callpoint id

Identifies a callback in a data provider. A data provider implements access to external data, either configuration data in a database or operational data. By default ConfD uses the embedded database (CDB) to store all data. However, some or all of the configuration data may be stored in an external source. In order for ConfD to be able to manipulate external data, a data provider registers itself using the callpoint id as described in confd_lib_dp(3).

A callpoint is inherited to all child nodes unless another 'callpoint' or an 'cdb-oper' is defined.

The callpoint statement can be used in: leaf, leaf-list, list, container, refine, and grouping.

The following substatements can be used:

tailf:config If this statement is present, the callpoint is applied to nodes with a matching value of their 'config' property.

tailf:transform If set to 'true', the callpoint is a transformation callpoint. How transformation callpoints are used is described in the 'Transformations, Hooks, Hidden Data and Symlinks' chapter in the User's Guide.

tailf:set-hook Set hooks are a means to associate user code to the transaction. Whenever an element gets written, created, or deleted, user code gets invoked and can optionally write more data into the same transaction.

The difference between set- and transaction hooks are that set hooks are invoked immediately when a write operation is requested by a north bound agent, and transaction hooks are invoked at commit time.

The value 'subtree' means that all nodes in the configuration below where the hook is defined are affected.

The value 'object' means that the hook only applies to the list where it is defined, i.e. it applies to all child nodes that are not themselves lists.

The value 'node' means that the hook only applies to the node where it is defined and none of its children.

For more details on hooks, see the 'Transformations, Hooks, Hidden Data and Symlinks' chapter in the User's Guide.

tailf:transaction-hook Transaction hooks are a means to associate user code to the transaction. Whenever an element gets written, created, or deleted, user code gets invoked and can optionally write more data into the same transaction.

The difference between set- and transaction hooks are that set hooks are invoked immediately when an element is modified, but transaction hooks are invoked at commit time.

The value 'subtree' means that all nodes in the configuration below where the hook is defined are affected.

The value 'object' means that the hook only applies to the list where it is defined, i.e. it applies to all child nodes that are not themselves lists.

The value 'node' means that the hook only applies to the node where it is defined and none of its children.

For more details on hooks, see the 'Transformations, Hooks, Hidden Data and Symlinks' chapter in the User's Guide.

tailf:cache If set to 'true', the operational data served by the callpoint will be cached by ConfD. If set to 'true' in a node that represents configuration data, the statement 'tailf:config' must be present and set to 'false'. This feature is further described in the section 'Caching operational data' in the 'Operational data' chapter in the User's Guide.

tailf:opaque Defines an opaque string which is passed to the callback function in the context.

tailf:internal For internal ConfD / NCS use only.