cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1136
Views
5
Helpful
6
Replies

Callback python code

I have a simple requirement, using the webui as northbound interface I want to display the interface description of an interface on a Cisco router:

leaf interface-description {

config false;

tailf:callpoint "interface-description-call";

type string;

}

I want to solve this using a callback instead of a leafref. Can someone point me to the python code implementing this callback? I need to display it in the webui already before the service is created or modified.

Cheers,

Florian

1 Accepted Solution

Accepted Solutions

Sure, see attached YANG and python code. Scan the python code for DataCallbacks and the YANG model for tailf:callpoint "stats".

View solution in original post

6 Replies 6

frjansso
Cisco Employee
Cisco Employee

Can you please elaborate on what you're trying to accomplish?

Is it an action that takes a device and an interface that returns that interfaces description?

Hi Frederik,

I implemented an Action first, because there is Python example code available for that. The problem with Action is that it is quite cumbersome in the webui, you need to "launch" the action, you will be redirected to another page and when the action is done you get the result displayed, then you somehow need to go back to your service model mask. What I have in my mind is a leaf, which is not configurable but which dynamically displays the interface description of the interface which is currently selected.

Ok, now I understand.

So I think you have two options, either non config (but probably persistent) or a data provider (DP).

Is this leaf in a service YANG model? If that's the case, the service code could populate that interface description leaf.

Otherwise you can build a DP, for python I'd recommend using experimental.DataCallbacks.

I tried a yang approach with leafref and tailf:link, both ended up in TAC cases where some of them are still open. The service model Python code also does not help as it is only triggered at service creation time, which obviously is too late. Do you have a hint for Python example code for these experimental callbacks?

Sure, see attached YANG and python code. Scan the python code for DataCallbacks and the YANG model for tailf:callpoint "stats".

Thank you, that was exactly what I needed!