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

Underscores in query arguments gets converted to hyphens in RPC request #35

Open
Balakrishnan-Easwaran opened this issue Oct 21, 2017 · 4 comments

Comments

@Balakrishnan-Easwaran
Copy link

Balakrishnan-Easwaran commented Oct 21, 2017

I am using Net::Netconf::Manager to query a device with RPC commands. In the query I should send a list of arguments. So I'm adding query arguments in a hash. One such argument is verbosity_level

Please note I am using underscore ( _ ) in this argument. When I print the hash, it is still underscore.But when I print the XML RPC request that is sent to the device, the argument is changed to verbosity-level

abcd

instead of<verbosity_level>abcd</verbosity_level> So the device throws error.
Why is the underscore gets convered to hyphen??

Waiting for your kind quick response.

Thanks in advance.

@vnitinv
Copy link
Contributor

vnitinv commented Oct 23, 2017

@Balakrishnan-Easwaran hyphen is reserved for subtraction in many programming lang. If we have hyphen in the variable then the program will get confused. say:

x = profit-loss   

how to make out whether profit-loss is a variable or mathematical operation. Any variable should ideally consist of [A-Za-z0-9_].

Hence we take underscore from user input but convert it to hyphen in RPC call (as RPC tags should contain hyphen and not underscore). In this case verbosity_level having underscore in RPC should be considered a junos bug. I have raised an internal issue to get this fixed.

@Balakrishnan-Easwaran
Copy link
Author

Thanks Nitin.

I understand that you are standardizing the RPC calls to have only "hyphens".

As of now I am going ahead by commenting out the underscore to hyphen conversion statement, but I'm not sure whether someother requests will be affected by this.

To make sure things are not blocked I'm going ahead by commenting out line 492 in Net/Netconf/Device.pm and adding a new line with just $tag = $field

Please let me know once the issue is fixed. Thanks.

@vnitinv
Copy link
Contributor

vnitinv commented Oct 23, 2017

If you comment the given line, it will impact other RPC calls. on the other hand, you can put a check to ignore, if the arg is verbose_level.

hope that helps.

@Balakrishnan-Easwaran
Copy link
Author

Correct Nitin. Will do. Please let me know when this issue is fixed. Thanks.

vignesh-k added a commit to vignesh-k/netconf-perl that referenced this issue Dec 5, 2018
Issue Juniper#35 : For fields which are not predefined in %methods, use the input as it is without changing _ to -.
Issue Juniper#37 : Included quotes
Issue Juniper#38 : Commented out the print statement.

Additional change : Commented out 'Disconnecting' carp call.
ydnath pushed a commit that referenced this issue Dec 11, 2018
Issue #35 : For fields which are not predefined in %methods, use the input as it is without changing _ to -.
Issue #37 : Included quotes
Issue #38 : Commented out the print statement.

Additional change : Commented out 'Disconnecting' carp call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants