Whether you use a container or a list depends on whether the data you are configuring is a set of single values, or forms an entry in a table.
If you have a single router_dev instance, then you can have a container called router-dev, with leaf nodes representing ‘register’, ‘if type’, etc.
If however you can have multiple router_dev instances, then you need to determine what forms the key for that table. It sounds as though from your show command, that possibly all of those items form the key?
Perhaps you can let us know the answer to these questions, then we can make more detailed recommendations. Is there an existing CLI that you are trying to imitate, or is this just specific to your device?
Hi greg,
Thank you very much for your reply.
I am having the single router_dev which takes the multiple input arguments like (“register” “iftype” “device-add” “port-add” “register-add” all these arguments take the integer values with certain range of data like 0-500) to display the router_dev information.
No I am not using the multiple router_dev instances.
Yes the Confd CLI we are using to input the values to show command.
If I give the below command :
hp-flare1# show router_dev register 1 iftype 3 device-add 45 port-add 58 register-add 67
Through my .c file I need to extract these parameter like
register = 1
iftype = 3
device-add = 45
port-add = 58
register-add = 67
And Finally I need to call the API with the above parameters value to get the information of the device.
Please suggest me how to design the yang file for the below 5 parameter. should i consider the container or list.
Once I give the above command from the cli, at one shot I want to extract all the 5 paramaters from the my .c file , please suggest me the steps.
If you have a single router_dev instance, then it sounds as though you will want to model this as a container, with register, iftype, device-add, port-add, register-add all as leafs within that container.
I am still a little confused since your show command has all of the input arguments which make it sound as though it is a list with all of those input arguments forming the key. Normally if router_dev was a container then you would just say ‘show router_dev’ and everything inside the container would be displayed. You wouldn’t need to specify the input arguments. If you are saying you need to specify the input arguments, then it sounds as though you really have a list.
If you haven’t already done so, I would recommend that you watch module 5 and 6 of the training videos, which covers YANG, and module 10, which covers the CDB subscriber, and this would describe how to get the values within your C program.
Hi greg,
I designed the yang model with container router_dev with one list register with the 5 leaf items with all the leaf as key values.
Please find the below yang model
module arpe {
namespace “http://tail-f.com/ns/example/arpe”;
prefix arpe;
container router_dev {
config false;
tailf:callpoint arpe;
list register {
key “device_index if_type device_address port_address register_address”;
max-elements 1024;
leaf device_index {
type uint32;
}
leaf if_type {
type uint32;
}
leaf device_address {
type uint32;
}
leaf port_address {
type uint32;
}
leaf register_address {
type uint32;
}
}
}
}
And this working fine if i give show command as below
hp-flare1# show router_dev register 1 2 3 4 5
ROUTER_DEV
DEVICE IF DEVICE PORT REGISTER
INDEX TYPE ADDRESS ADDRESS ADDRESS
1 2 3 4 5
hp-flare1#
And I can able to extract the values from the .c file.
But I want to pass the leaf names also in the show command like below ;
case arpe_timeinterval:
{
printf("\n $$$$$ timeinterval") ;
int keep_alive = CONFD_GET_UINT32(&(keypath->v[2][0]));
printf("\n\t timeinterval =%d \n", timeinterval);
break;
}
Please suggest me further how to modify the existing code under case arpe_timeinterval for the keypath value from the API CONFD_GET_UINT32 ? and any modification I need to do in the get_next or get_elem call back ?
The type of your timeinterval is not correct. It seems to be in the YANG model you provided, but not in your CLI output. I don’t believe you are using the same YANG model in your CLI output as the one you provided.
So if your timeinterval really was a key, as in the YANG model you provided, ConfD would not retrieve it using get_elem.
Your YANG model does not match your debug output.
Please provide a matching YANG model, c-application, and debug output if you want/need help.