Junos Automation (Scripting)
Junos Automation (Scripting)

jsnapy and show_interfaces_diagnostics_optics

[ Edited ]
‎03-15-2017 03:50 AM

Hello All,

I am looking to use jsnapy tool, it looks very interesting and should "replace" a set of python/expect/diff scripts.


However, I found an issue and kindly looking for "community" help to clarify it.


What I am looking to have:

I would like to collect the interface diagnostics optics information before and after maintenance.

I would like to compare the Rx/Tx values (so laser-rx-optical-power-dbm and laser-output-power-dbm)


What I have now:


1. Very basic config_check.yml

# for one device, can be given like this:
- device: router.net
username : user
passwd: pass
- test_no_diff.yml


2. Very basic test_no_diff.yml


- command: show interfaces diagnostics optics
- iterate:
xpath: physical-interface
id: './name'
- no-diff: laser-rx-optical-power-dbm # element in which test is performed
err: "Test Failed!! Rx got changed, before it was <{{pre['laser-rx-optical-power-dbm']}}>, now it is <{{post['laser-rx-optical-power-dbm']}}>"
info: "Test Passed!! Rx is same, before it is <{{pre['laser-rx-optical-power-dbm']}}> now it is <{{post['laser-rx-optical-power-dbm']}}>"


3. The pre/post looks very good, my output files are listed the correct information 

4. Then I am manually updating one file (post or pre), changing the laser-rx-optical-power-dbm values.

As the values are "negative", I also tested on "positive" values only. 

5. Regardless of above modification, the  jsnapy  --check pre post -f config_check.yml always reports 


PASS | All "laser-rx-optical-power-dbm" is same in pre and post snapshot [ 133 matched ]
------------------------------- Final Result!! -------------------------------
test_command_version : Passed
Total No of tests passed: 1


6. if I will use a "standard" diff , jsnapy --diff snapshots/PRE snapshots/POST,  the difference is showing without any issues.


Please advise what can be the issue.