ConfD User Community

How does Confd check range of instance's numbers?


#1

I need to know the C function which checks the range of instances. For example, I’ve got 9 instances of FastEthernet with mtu leaf:
(cli)(config)# interface FastEthernet/1-9
(cli)(config-interface-FastEthernet/1-9)# mtu 1400
(cli)(config-interface-FastEthernet/1-9)# commit
If I’ll type “FastEthernet/9-1” instead of “FastEthernet/1-9”, an error will occur smth like “No entries found.”, everything is ok.

However, if I try to “FastEthernet/1-999”, smth strange happens:
(cli)(config)# interface FastEthernet/1-999
(cli)(config-interface-FastEthernet/1-999)# mtu 1400
(cli)(config-interface-FastEthernet/1-999)# commit
There is no error occurs, and all of my 9 interfaces get “mtu 1400”.
So here my question comes. I want to change Confd’s C code to handle this “out of bounds” range.

In addition I’d like to know how to keep my current number of instances or where could I get that variable?
P.S. I’ve read confd_types manual and I’ve seen all of examples about range in “examples.confd”. And in “/examples.confd/cli/ranges/README” written next “Note that integer keys are automatically recognized as having range capabilities. Other types need an explicit declaration in the clispec file.” I don’t have any user-defined-ranges.


#2

Looks like you can specify in a range instances that are not configured (non exist). ConfD seems to ignore non existing instances and updates configuration only for existing instances.

E.g. from /examples.confd/cli/ranges

interface FastEthernet-1/1/1-33 mtu 16 

This would change mtu to 16 for FastEthernet-1/1/1, FastEthernet-1/1/2, FastEthernet-1/1/3 (FastEthernet-1/1/4 and above do not exist and are ignored).

interface FastEthernet-1/1/2-33 mtu 17

This would change mtu to 17 for FastEthernet-1/1/2, FastEthernet-1/1/3 (FastEthernet-1/1/1 is not changed, FastEthernet-1/1/4 and above do not exist and are ignored).


#3

Thanx for your answer, mnovak!

I understand that Confd by default ignores out of range interfaces. I want to know which Confd’s native C file (I mean existing C file, i.e cli.c) contains that “range” function. So then, I could change that function to handle out of range interfaces.


#4

Hello, I’m afraid this is ConfD build in functionality, so there is no (distributed) C file for this.