install JSNAPy container and Configuration file





Docker container

Use juniper container: pyez-ansible

Install juniper/pyez-ansible Docker image

docker pull juniper/pyes-ansible
docker run -it --rm -v $PWD:/project juniper/pyez-ansible ash


pip list | grep j


config file  (no device file )
config file
---
hosts:
  - device: qfx5100
    username : netbox
    passwd: Netbox
    port: 22

tests:
  - jsnapy_tests.yaml

sqlite:
  - store_in_sqlite: yes
    check_from_sqlite: yes
    database_name: jbb1.db
 
test file:  jsnapy_tests.yaml
test file
---
test_rpc_bgp:
  - rpc: get-bgp-summary-information
  - item:
      xpath: '//bgp-information'
      tests:
        - is-equal: group-count, 1
          err: "Test Failed!! BGP group count is <{{post['group-count']}}>"
          info: "Test succeeded!! BGP group count is: <{{post['group-count']}}>"

        - is-equal: peer-count, 2
          err: "Test Failed!! BGP group configured peer count is <{{post['peer-count']}}>"
          info: "Test succeeded!! BGP group configured peer count is: <{{post['peer-count']}}>"

        - is-equal: down-peer-count, 0
          err: "Test Failed!! BGP down peer count is <{{post['down-peer-count']}}>"
          info: "Test succeeded!! BGP down peer count is: <{{post['down-peer-count']}}>"
run jsnapy

jsnapy --snap pre -f jsnapy_config.yml


run jsnapy
/project # jsnapy --snap pre -f jsnapy_config.yml
/usr/lib/python3.6/site-packages/jnpr/jsnapy/setup_logging.py:25: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(f.read())
/usr/lib/python3.6/site-packages/jnpr/jsnapy/jsnapy.py:330: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  self.main_file = yaml.load(config_file)
Connecting to device 172.30.95.177 ................
/usr/lib/python3.6/site-packages/jnpr/jsnapy/jsnapy.py:391: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  test_files.append(yaml.load(test_file))
Taking snapshot of RPC: get-bgp-summary-information
/project #



Multi file
Config ( point to devices.yml, test.yml, mail.yml )

hosts ( list of devices )


devices.yml ( list of groups of devices)
test.yml  ( multiple files )