ConfD User Community

Server-prefix 123.30.164.168/28 is not a valid value


#1

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:

http://www.netconfcentral.org/modules/ietf-inet-types
typedef ipv4-prefix {
type string {
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])’
+ ‘/(([0-9])|([1-2][0-9])|(3[0-2]))’;
}

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?


#2

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:

address     123.30.164.168    01111011 00011110 10100100 10101000 
netmask     255.255.255.240   11111111 11111111 11111111 11110000 

Example from CLI:

> dev(config)# test-leaf 123.30.164.168/28
> -----------------------^
> syntax error: "123.30.164.168/28" is not a valid value.
> dev(config)# test-leaf 123.30.164.168/29
> dev(config)#

#3

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.


#4

From ConfD UG Chapter “Advertising Capabilities and YANG Modules”:

A YANG module is supported by the NETCONF server if it’s fxs file is found in ConfD’s loadPath, and if the fxs files is exported to NETCONF.

The following YANG modules are built-in, which means that their fxs files must not be present in the loadPath:

• ietf-netconf
• ietf-netconf-with-defaults
• ietf-yang-library
• ietf-yang-types
• ietf-inet-types

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.