Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.

Question on JSNAPy --check

  • 1.  Question on JSNAPy --check

     
    Posted 05-16-2022 14:12

    Hi.

     

    I have the following JSNAPy config and test files:

     

    [lab@desktop hey]$ cat config.yml

    hosts:

      - device: 172.25.11.1

        username: lab

        passwd: lab123

     

    tests:

      - test.yml

     

     

     

    [lab@desktop hey]$ cat test.yml

    check_loopback_interface:

        - command: show interfaces terse lo0.0

        - item:

            xpath: //interface-address

            tests:

              - no-diff: ifa-local

                err: "Test Failed"

     

     

    I take two snapshots, once with my target device's loopback address = 1.1.1.1, and another with my target device's loopback address changed to 2.2.2.2.

     

    [lab@desktop hey]$ jsnapy --snap snapshot1 -f config.yml

     

    <<change the managed device's loopback address from 1.1.1.1 to 2.2.2.2>>

     

    [lab@desktop hey]$ jsnapy --snap snapshot2 -f config.yml

     

     

     

    I am able to view the diff of the two snapshots:

     

    [lab@desktop hey]$ jsnapy --diff snapshot1 snapshot2 -f config.yml

    **************************** Device: 172.25.11.1 ****************************

    Tests Included: check_loopback_interface

    ******************** Command: show interfaces terse lo0.0 ********************

    /home/lab/jsnapy/snapshots/172.25.11.1_snapshot1_show_interfaces_terse_lo0_0.xml /home/lab/jsnapy/snapshots/172.25.11.1_snapshot2_show_interface

    s_terse_lo0_0.xml

    up                                                                      up                                                                    

    </oper-status><filter-information>                                      </oper-status><filter-information>                                    

    </filter-information><address-family><address-family-name>              </filter-information><address-family><address-family-name>            

    inet                                                                    inet                                                                  

    </address-family-name><interface-address><ifa-local>                    </address-family-name><interface-address><ifa-local>                  

    1.1.1.1                                                                 2.2.2.2                                                               

    </ifa-local><ifa-destination emit="emit">                               </ifa-local><ifa-destination emit="emit">                              

    0/0                                                                     0/0                                                                   

    </ifa-destination></interface-address></address-family></logical-inter  </ifa-destination></interface-address></address-family></logical-inter

    face></interface-information>                                           face></interface-information>      

     

     

     

    However, I am unable to execute the JSNAPy test to see whether the snapshots have different loopback addresses (from  no-diff: ifa-local in the test file)

     

    [lab@desktop hey]$ jsnapy --check snapshot1 snapshot2 -f config.yml

    **************************** Device: 172.25.11.1 ****************************

    Tests Included: check_loopback_interface

    ******************** Command: show interfaces terse lo0.0 ********************

    ------------------------------- Final Result!! -------------------------------

    check_loopback_interface : Skipped

    Total No of tests passed: 0

    Total No of tests failed: 0

    None of the test cases executed !!!

     

     

    I expected the above test to fail since the snapshots have different loopback addresses. What am I doing wrong here?

     

    Thanks,

    Deepak


    Juniper Business Use Only