0

I am using Net::Netconf::Manager to query a device with RPC commands. In the RPC commands 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

<verbosity-level>abcd</verbosity-level>

instead of

<verbosity_level>abcd</verbosity_level>

So the device says it does not know such argument.

Why is the underscore gets converted to hyphen?

Borodin
  • 126,100
  • 9
  • 70
  • 144
Bala Krishnan
  • 374
  • 3
  • 18

1 Answers1

2

The code that does this is on line 492 of Net/Netconf/Device.pm. It's a simple substitution, and there's no comment to explain why it's there

All I can think of to do is to comment out that line

($tag = $field) =~ s/_/-/g

and replace it with

$tag = $field

which should get things going for you. In the mean time, you could perhaps email the Juniper Networks Perl Team at netconf-support@juniper.net and ask about it. If you do, please let us know the response

Borodin
  • 126,100
  • 9
  • 70
  • 144
  • 1
    Probably an artifact of Junos not having any *underscores* in their XML tags and adding some sugar in objectifying the RPC requests. [Some examples show it done on their methods](https://www.juniper.net/documentation/en_US/junos13.2/topics/task/program/netconf-perl-client-application-submitting-requests.html). I would guess that there hasn't been a lot of other vendors doing netconf until recently. – salparadise Oct 21 '17 at 18:45
  • Thanks Borodin. I have raised an issue in netconf-perl API in github. Seems like they are standardizing only to have hyphens in RPC requests instead of underscores. The issue can be tracked in the following link https://github.com/Juniper/netconf-perl/issues/35 – Bala Krishnan Oct 23 '17 at 06:08