Junos Automation (Scripting)
Junos Automation (Scripting)

JSNAP

‎11-15-2016 03:12 AM

Hi Guys !!

 

I just started to read up on jsnap, and one of the thing that i would like to check will be the point to point ping test. Is this do-able to get it done in the jsnap ?

 

 

Regards

Fahmi

5 REPLIES 5
Junos Automation (Scripting)

Re: JSNAP

‎11-15-2016 02:11 PM

Hi

 

I can't answer your question, but would like to add my own to this thread Smiley Happy

 

I see only JSNAP 1.0R1 from 13 Jun 2013 on the download page.

Is this project still alive? 

Best Regards,
PK

Juniper Ambassador, Juniper Networks Certified Instructor,
JNCIE-SEC #98, JNCIE-ENT #393, JNCIE-SP #2253
Twitter: @JuniperTrain
GitHub: https://github.com/pklimai
[Juniper Authorized Education & Support in Russia]
Junos Automation (Scripting)

Re: JSNAP

‎11-16-2016 03:01 AM

So, I think that you'll find JSNAPy (the Python version of JSNAP) more capable in this regard.

 

The project is very active, and can be found on github.  https://github.com/Juniper/jsnapy

 

JSNAPy can run as a standalone tool, or be integrated into PyEz as a module.  There is a utility to assist in conversion of existing (JSNAP configuration files into the yaml format configuration files used by JSNAPy).   I also believe that there is integration possible of JSNAPy with Ansible 2.1+ (IIRC), I'm not 100% sure on this as I've not performed that level of integration with JSNAPy, only to the point of executing it from within an Ansible playbook in version 2.0.2.0.

 

As for ping tests, I've not tried it, but I see no reason as to why this wouldn't be possible, JSNAPy provides the ability to execute CLI commands and Junos RPC's, and I've writtent SLAX scripts to leverage the ping rpc before so I see no reason why this wouldn't be possible with JSNAPy.

 

Regards,

Andy

Junos Automation (Scripting)

Re: JSNAP

‎12-05-2019 02:26 PM

Hey Fahmi,

Did you ever get anywhere with this? I'm just looking to do something similar and saw the thread so thought would see where you got to.

 

Cheers,

Dave

Junos Automation (Scripting)

Re: JSNAP

‎12-09-2019 02:09 AM

Best place to start is the free Day One book on Jsnapy

 

https://www.juniper.net/us/en/training/jnbooks/day-one/automation-series/jsnapy/

 

Steve Puluka BSEET - Juniper Ambassador
IP Architect - DQE Communications Pittsburgh, PA (Metro Ethernet & ISP)
http://puluka.com/home
Junos Automation (Scripting)

Re: JSNAP

‎12-09-2019 03:15 PM

You can do it like this:

ping-rpc:
# One can use either Junos XML API RPCs or CLI commands for testing, e.g
#  - command: ping inet count 4 one.one.one.one
  - rpc: ping
  - kwargs:
        host: 'one.one.one.one'
        count: '4'
        inet: True
  - item:
      xpath: probe-results-summary
      id: ../target-host
      tests:
        # Test should fail if packet loss has increased.
        - delta: packet-loss, -100
          err: "Test failed! Packet loss to {{id_0}} before the change:
               {{pre['packet-loss']}}%. Packet loss after the change:
               {{post['packet-loss']}}%."
          info: "Test succeeded! Packet loss to {{id_0}} before the change:
                {{pre['packet-loss']}}%. Packet loss after the change:
                {{post['packet-loss']}}%."

 

However, it's worth pointing out that while the Junos control-plane initiated ping is fine, for example for checking whether the p2p link is operational after the configuration change, then it is not suitable for RTT measurements if high accuracy is needed. This is documented in KB11792 and KB28157 and discussed in detail here.