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 !

RPC:

<edit-config>
<target><running/></target>
<config>
<routing-policy xmlns="http://openconfig.net/yang/routing-policy" xmlns:oc-rpol="http://openconfig.net/yang/routing-policy">
  <defined-sets>
    <prefix-sets>
      <prefix-set>
        <name>prefix</name>
        <config>
          <name>prefix</name>
          <mode>IPV4</mode>
        </config>
        <prefixes>
          <prefix>
            <ip-prefix>10.3.192.0/21</ip-prefix>
            <masklength-range>21..24</masklength-range>
            <config>
              <ip-prefix>10.3.192.0/21</ip-prefix>
              <masklength-range>21..24</masklength-range>
            </config>
          </prefix>
        </prefixes>
      </prefix-set>
    </prefix-sets>
  </defined-sets>
</routing-policy>
</config>
</edit-config>

Reply:

<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>invalid-value</error-tag>
    <error-severity>error</error-severity>
    <error-path xmlns:oc-rpol="http://openconfig.net/yang/routing-policy" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    /nc:rpc/nc:edit-config/nc:config/oc-rpol:routing-policy/oc-rpol:defined-sets/oc-rpol:prefix-sets/oc-rpol:prefix-set[oc-rpol:name='prefix']/oc-rpol:prefixes/oc-rpol:prefix/oc-rpol:masklength-range
  </error-path>
    <error-message xml:lang="en">"21..24" is an invalid value.</error-message>
    <error-info>
      <bad-element>masklength-range</bad-element>
    </error-info>
  </rpc-error>
</rpc-reply>

openconfig YANG:openconfig-routing-policy.yang

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

    leaf ip-prefix {
      type oc-inet:ip-prefix;
      mandatory true;
      description
        "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)$';
      }
      description
        "Defines a range for the masklength, or 'exact' if
        the prefix has an exact length.

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

        Example: 10.3.192.0/21 would be expressed as
        prefix: 10.3.192.0/21,
        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.