I recieve an invailid-value which is defined with regular expression

I recieve an invailid-value as reply for edit-config rpc from ConfD Basic7.6.

What’s wrong with it ?
Thx !


<routing-policy xmlns="http://openconfig.net/yang/routing-policy" xmlns:oc-rpol="http://openconfig.net/yang/routing-policy">


<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
    <error-path xmlns:oc-rpol="http://openconfig.net/yang/routing-policy" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <error-message xml:lang="en">"21..24" is an invalid value.</error-message>

openconfig YANG:openconfig-routing-policy.yang

  grouping prefix-config {
      "Configuration data for a prefix definition";

    leaf ip-prefix {
      type oc-inet:ip-prefix;
      mandatory true;
        "The prefix member in CIDR notation -- while the
        prefix may be either IPv4 or IPv6, most
        implementations require all members of the prefix set
        to be the same address family.  Mixing address types in
        the same prefix set is likely to cause an error.";

    leaf masklength-range {
      type string {
        pattern '^(([0-9]+\.\.[0-9]+)|exact)$';
        oc-ext:posix-pattern '^(([0-9]+\.\.[0-9]+)|exact)$';
        "Defines a range for the masklength, or 'exact' if
        the prefix has an exact length.

        Example: through would be
        expressed as prefix:,
        masklength-range: 21..24.

        Example: would be expressed as
        masklength-range: exact";


This is the reason:

pattern '^(([0-9]+\.\.[0-9]+)|exact)$';

Note the anchors (^ and $ characters). They do not have any special meaning in YANG patterns, but OpenConfig models have somewhat lenient approach to standards and use POSIX regular expressions, so the expression above is supposed to match strings like "12..34", but it actually matches "^12..34$".

So as to fix it I suggest you simply go ahead and modify the patterns (there are more of them in other OpenConfig YANG modules). Another option is to use yanger_oc plugin from the misc/openconfig example distributed with ConfD, but here the problem is that the plugin assumes that all patterns use incorrect anchors, which is no longer true - about a year ago OpenConfig decided to remove anchors from some patterns and keep them in others.