Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

diff? not working as expected #65

@TvL2386

Description

@TvL2386

Hi, I'm playing around with this library but for some reason diff? is not returning the diff.
I don't get it.

My code is:

require 'pp'
require 'net/netconf/jnpr'
require 'junos-ez/stdlib'

login = {
    target: '10.202.255.188',
    username: 'tom',
    password: 'secret'
}

ndev = Netconf::SSH.new( login )
print "Connecting to device #{login[:target]} ... "
ndev.open
puts "OK!"

Junos::Ez::Provider( ndev )
Junos::Ez::Config::Utils( ndev, :cu )


hostname = "TESTSRX-#{Time.now.strftime('%M%S')}"
puts "Trying to set new hostname: #{hostname}"

ndev.cu.load! content: "set system host-name #{hostname}", format: :set

pp ndev.cu.diff?
pp ndev.cu.commit?

ndev.close

The output is:

$ ruby junos.rb 
Connecting to device 10.202.255.188 ... OK!
Trying to set new hostname: TESTSRX-0319
""
true

On the SRX320 I see the following:

tom@BOOTSTRAPPED> show configuration | compare    

tom@BOOTSTRAPPED> configure 
Entering configuration mode
The configuration has been changed but not committed

[edit]
tom@BOOTSTRAPPED# show | compare 
[edit system]
-  host-name BOOTSTRAPPED;
+  host-name TESTSRX-0319;

[edit]
tom@BOOTSTRAPPED# 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions