Automation

 View Only
last person joined: 10 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Question on JSNAPy

     
    Posted 11-09-2023 15:52

    Hi.

    Here is a test file that posts an error message if an interface status changes between snapshots.

    Test interfaces:
     - command: show interfaces terse
     - iterate:
         xpath: physical-interface
         id: name
         tests:
           - no-diff: oper-status
             err: "Test Failed: oper-status of {{id_0}} got changed from <{{pre['oper-status']}}> to <{{post['oper-status']}}>"
             info: "Test Passed: oper-status is the same, before it was <{{pre['oper-status']}}>, now it is <{{post['oper-status']}}>"

    I know that {{ id_0 }} is a variable containing the name of the interface whose status has changed. But what does the "_0" in the variable name stand for?

    Thanks,

    Deepak



  • 2.  RE: Question on JSNAPy
    Best Answer

    Posted 11-09-2023 19:12

    the id is a Key Value for elements in pre and post checks 

    See Point 7 at the below Document

    https://github.com/Juniper/jsnapy/wiki/2.-Writing-test-and-config-file#example-1-sample-test-file1-test_is_equalyml



    ------------------------------
    David Divins
    ------------------------------



  • 3.  RE: Question on JSNAPy

     
    Posted 12-13-2023 00:52

    Thanks David for your reply.

    Cheers!