03-16-2018 01:43 AM - edited 03-01-2019 04:07 AM
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
Solved! Go to Solution.
03-21-2018 02:55 PM
Sure, see attached YANG and python code. Scan the python code for DataCallbacks and the YANG model for tailf:callpoint "stats".
03-21-2018 12:07 PM
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?
03-21-2018 01:15 PM
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.
03-21-2018 01:33 PM
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.
03-21-2018 01:40 PM
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?
03-21-2018 02:55 PM
03-21-2018 10:56 PM
Thank you, that was exactly what I needed!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide