-
Notifications
You must be signed in to change notification settings - Fork 73
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
Client-side validation of xr_shellutil_cfg.HostNames() in 0.7.0 #739
Comments
Hi @rikwade , as can be seen from the documentation, there is no restriction specified for the |
Hi @abhikeshav, thank you for the information. The behaviour I was expecting was to receive a YPYModelError if an int was passed to a str field in the model. For example if I explicitly cast the parameter as an int with:
it is accepted and configured on the XR device. Thank you for clarifying the behaviour we should expect. |
No problem, @rikwade. YPYModelError is only meant for checking the restrictions in the yang model. Python type checks for int instead of str is not part of this check. |
Thanks, @rikwade. We will look into enhancing this type of validation. |
Wonder why our automated testing didn't catch this issue. It seems we need to strengthen our type validation tests. |
@abhikeshav The confusing point is that the YANG model specifies hostname as a 'str'. So one may expect a client-side type check if a developer passes an 'int'. The setting of a hostname is often used as a "YDK Hello World", and it is a good method of demonstrating client-side validation. Therefore if this simple example does not exhibit the expected behaviour then a more complex example needs to be used, such as setting a static route (which does exhibit the expected behaviour if an invalid IP address is passed as the parameter). @111pontes It would be good to look at this validation. |
Thanks. We will investigate into fixing this.
@abhikeshav<https://github.com/abhikeshav> The confusing point is that the YANG model specifies hostname as a 'str'. So one may expect a client-side type check if a developer passes an 'int'.
The setting of a hostname is often used as a "YDK Hello World", and it is a good method of demonstrating client-side validation. Therefore if this simple example does not exhibit the expected behaviour then a more complex example needs to be used, such as setting a static route (which does exhibit the expected behaviour if an invalid IP address is passed as the parameter).
@111pontes<https://github.com/111pontes> It would be good to look at this validation.
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#739 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AQTCR6XAeE1up_lXQTFRmGslm2bnNFdBks5tmshXgaJpZM4TIOtW>.
|
Fixed in #820 |
Issue tracker is ONLY used for reporting bugs. Please use the YDK Community for any support issues.
Expected Behavior
Sending incorrect type parameter returns: <class 'ydk.errors.YPYModelError'>
Current Behavior
Incorrect parameter returns: <class 'ydk.errors.YPYServiceProviderError'>
Steps to Reproduce
Send Int as parameter to xr_shellutil_cfg.HostNames.host_name rather than String
Your Script
Logs
Enable logging and post the logs below
System Information
Python 2.7.14
YDK 0.7.0
Ubuntu 17.10
x86
XR: 6.1.4.16I
The text was updated successfully, but these errors were encountered: