Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String leaf length constraints confused with range #346

Closed
111pontes opened this issue Dec 21, 2016 · 0 comments
Closed

String leaf length constraints confused with range #346

111pontes opened this issue Dec 21, 2016 · 0 comments

Comments

@111pontes
Copy link
Collaborator

111pontes commented Dec 21, 2016

It seems that a string length constraint is implemented as a range constraint which generates this error:

2016-12-21 13:49:47,702 - ydk.providers.netconf_provider - INFO - NetconfServiceProvider connected to Router:None using ssh
2016-12-21 13:49:47,728 - ydk.services.executor_service - INFO - Executor operation initiated
2016-12-21 13:49:47,728 - ydk.services.executor_service - INFO - Executor operation completed
Traceback (most recent call last):
  File "./nc-execute-xr-snmp-test-trap-act-522-ydk.py", line 81, in <module>
    executor.execute_rpc(provider, routing_mpls_ldp_session_down_rpc)
  File "/usr/local/lib/python2.7/dist-packages/ydk/services/executor_service.py", line 57, in execute_rpc
    provider.sp_instance.encode_rpc(rpc),
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_provider_plugin.py", line 122, in encode_rpc
    self._encode_rpc_request(root, rpc)
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_provider_plugin.py", line 462, in _encode_rpc_request
    XmlEncoder().encode_to_xml(rpc, root, '')
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_encoder.py", line 89, in encode_to_xml
    self.encode_to_xml(value, elem, optype)
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_encoder.py", line 48, in encode_to_xml
    validate_entity(entity, optype)
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_validator.py", line 39, in validate_entity
    validate_entity_delegate(entity, optype, errors)
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_validator.py", line 69, in validate_entity_delegate
    _dm_validate_value(member, value, entity, optype, errors)
  File "/usr/local/lib/python2.7/dist-packages/ydk/providers/_validator.py", line 152, in _dm_validate_value
    errmsg = "Invalid data or data range, value = %d" % value
TypeError: %d format: a number is required, not str

Regardless, the documentation confuses length with range:
image

image

@111pontes 111pontes changed the title String leaf length constraints not documented correctly String leaf length constraints confused with range Dec 21, 2016
@111pontes 111pontes added the bug label Dec 21, 2016
@ghost ghost mentioned this issue Jan 30, 2017
@ghost ghost closed this as completed Jan 31, 2017
@ghost ghost mentioned this issue Jan 31, 2017
ghost pushed a commit that referenced this issue Jan 31, 2017
* Issue #346
 * #208
 * #272
 * #300
 * #294
 * #318
 * #303 (only for bits)
 * #323
 * #305
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant