12-06-2020 07:52 PM
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'
Solved! Go to Solution.
12-07-2020 11:32 AM
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.
12-07-2020 11:32 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide