cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements
206
Views
0
Helpful
1
Replies

ydk.errors.YModelError Validation error for date-time field

Seeing below YModel error while retrieving the components. (ydk==0.8.5)

 

>>> components = crud.read(provider, openconfig_platform.Components())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/var/pyats/lib/python3.6/site-packages/ydk/services/crud_service.py", line 61, in read
    return _crud_read(provider, read_filter, False, self._crud.read)
  File "/var/pyats/lib/python3.6/site-packages/ydk/services/crud_service.py", line 89, in _crud_read
    read_top_entity = crud_call(provider, top_filters)
  File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/var/pyats/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 82, in handle_runtime_error
    _raise(_exc)
  File "/var/pyats/lib/python3.6/site-packages/ydk/errors/error_handler.py", line 54, in _raise
    exec("raise exc from None")
  File "<string>", line 1, in <module>
ydk.errors.YModelError:  Value "2019-08-05T00:00:00Z+00:00" does not satisfy the constraint "^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z[+-][0-9]{2}:[0-9]{2}$" (range, length, or pattern). Path: /openconfig-platform:components/component[name='0/2-Optics0/2/0/0']/openconfig-platform-transceiver:transceiver/state/date-code

 

Though the value is complaint to the pattern

>>> dt = "2019-08-05T00:00:00Z+00:00"
>>> re.match("^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?Z[+-][0-9]{2}:[0-9]{2}$", dt)
<re.Match object; span=(0, 26), match='2019-08-05T00:00:00Z+00:00'
1 ACCEPTED SOLUTION

Accepted Solutions
yangorelik
Enthusiast

I am not sure, but most likely this is a bug in the Libyang code, where the pattern string is translated to C-like regular expression. I would open an issue on ydk-gen GitHub.

As a workaround I suggest you to disable data validation on this particular entity. You can find corresponding examples in YDK documentation online.

Yan Gorelik
YDK Solutions

View solution in original post

1 REPLY 1
yangorelik
Enthusiast

I am not sure, but most likely this is a bug in the Libyang code, where the pattern string is translated to C-like regular expression. I would open an issue on ydk-gen GitHub.

As a workaround I suggest you to disable data validation on this particular entity. You can find corresponding examples in YDK documentation online.

Yan Gorelik
YDK Solutions

View solution in original post