Some OpenConfig YANG modules use the pattern statement incorrectly. 

Set the CLI parameter --with-ocpattern=true to fix this problem.

This causes the tool to process patterns for YANG module names openconfig-* as OpenConfig (POSIX) patterns and all other modules as YANG patterns.

The YANG definition of a regular expression is defined in XSD-TYPES.

The OpenConfig modules use something different and this causes tools that conform to the YANG standard to process the pattern as if it were an XSD pattern.  This causes YANG compiler errors or sometimes run-time errors where the pattern-match results can be incorrect.

The following definition is for OpenConfig inet-types.yang

typedef ipv4-address {
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]' +

The following is from ietf-inet-types.yang:

  typedef ipv4-address {
    type string {
      +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
      + '(%[\p{N}\p{L}]+)?';

The with-ocpattern parameter can be found in the following configuration files in the /etc/yumapro directory:

  • netconfd-pro.conf
  • yangcli-pro.conf (for yangcli-pro and yp-shell)
  • yangdump-pro.conf (for yangdump-pro and yangdump-sdk)

The default is false so it must be enabled in the command line or the configuration file to handle OpenConfig YANG modules correctly.

#### leaf with-ocpattern
# If true, then OpenConfig patterns with be checked.
# If the module name starts with the string 'openconfig-'
# then all pattern statements within that module
# are treated as POSIX patterns, not YANG patterns.
# If false, then the pattern statements in all modules
# will be checked as YANG patterns.
with-ocpattern true