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

Chuck Anderson cra at WPI.EDU
Wed Sep 21 17:00:12 EDT 2016


On Wed, Sep 21, 2016 at 03:26:40PM -0400, Chuck Anderson wrote:
> 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>

After a close reading of the Perl Net::Netconf::Device code, I've come
to the conclusion that what I want to do is impossible with that API
as written, unless I modify it to add a get_configuration method that
accepts attributes.  I will either need to switch back to the
JUNOScript Perl API or change my approach.

It seems like this would be a common operation--commit my changes if
anything was actually changed during a merge/replace operation,
rollback otherwise.  Perhaps something could be built-in that does
this.  Even from the CLI I often do "show | compare" followed by
"rollback" and "exit" if there are no actual changes after e.g. a
"replace pattern" or "load merge" operation.


More information about the juniper-nsp mailing list