I am using confd 6.4 basic version. ConfD cannot be started as the error “server-prefix 123.30.164.168/28 is not a valid value”.
I used inet:ip-prefix for the server-prefix in YANG model. I also try to test the prefix by some online tool (https://regex101.com/) and (https://www.regextester.com/) and see that maybe the problem is at pattern of ipv4-prefix:
With this pattern two online tools give the full match “123.30.164.168/2”. But when I modify the pattern by move ([0-9]) to the end as the following:
pattern
‘(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]).){3}’
+ ‘([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])’
+ ‘/(([1-2][0-9])|(3[0-2])|([0-9]))’;
Two online tools give exactly the full match “123.30.164.168/28”.
So I decide to modify the yang file “ietf-inet-types”, re-compile it by confdc, and replace the fxs file. But the ConfD cannot still be started. And the same error above appears on the command line.
I try another workaround by typedef a new type, such as my-ipv4-prefix with the latter pattern that the prefix “123.30.164.168/28” is validated by two online tools, in my YANG file. This solution works and ConfD can be started without any error.
Please anyone show me if this error of pattern of ietf module or error of ConfD?
String pattern is not the only validation done on ipv4-prefix.
Quote from the ietf-inet-types YANG you reference:
A prefix length value of n corresponds to an IP address
mask that has n contiguous 1-bits from the most
significant bit (MSB) and all other bits set to 0.
The canonical format of an IPv4 prefix has all bits of
the IPv4 address set to zero that are not part of the
IPv4 prefix.";
To conform with base definition of ipv4-prefix, correct bitmask is not 28, but 29:
Many thanks josephm. I got your explaination. The address 123.30.164.168 is not a network address for the prefix 123.30.164.168/28.
Another confuse is that why the ConfD cannot still be started if I try to modify the yang file “ietf-inet-types” by changing the pattern of IPv4 prefix, re-compile it by confdc, and replace the fxs file? The same error above appears on the command line.
All built-in modules except ietf-netconf-with-defaults are always supported by the server. Support for ietf-netconf-with-defaults can be controlled by a setting in confd.conf.
So in the case of those built-in to ConfD standard YANG modules, including the ietf-inet-types module, rather than expanding the allowed value space of the pattern for the inet:ip-prefix type you would have to create your own type.