[j-nsp] NETCONF <get-config> vs. <get-configuration>

Chuck Anderson cra at WPI.EDU
Wed Sep 21 15:26:40 EDT 2016


Using NETCONF with Perl Net::Netconf::Manager, I'm trying to get the
candidate configuration to see what changed before issuing a commit
request so I can avoid "empty" commits after doing a "replace"
operation on a subtree.  I see that NETCONF defines a standard
<get-config> call, and I believe <get-configuration> is a
legacy/proprietary Junos call.  There is a <get-config> example in the
documentation, but there doesn't appear to be a way to see what was
changed in the candidate config vs. the committed config:

https://www.juniper.net/techpubs/en_US/junos16.1/topics/task/program/netconf-perl-client-application-submitting-requests.html

The API call I want to make is documented here:

https://www.juniper.net/documentation/en_US/junos14.1/topics/reference/tag-summary/netconf-junos-xml-protocol-get-configuration.html

But I can't for the life of me figure out how to pass the various
attributes inside the <get-configuration> tag with Perl.  How does one
map the attributes INSIDE a tag to the Perl API call as below?

<get-configuration changed="changed" compare="rollback" database="candidate">

This doesn't work:

$res = $jnx->get_configuration(changed => 'changed', compare => 'rollback', database => 'candidate');

because that generates this:

<rpc message-id='2'>
  <get-configuration>
    <database>candidate</database>
    <compare>rollback</compare>
    <changed>changed</changed>
  </get-configuration>
</rpc>

when I need it to be this:

<rpc message-id='2'>
  <get-configuration database="candidate" compare="rollback" changed="changed">
  </get-configuration>
</rpc>

Thanks.


More information about the juniper-nsp mailing list