{"id":14985708,"url":"https://github.com/juniper/jsnapy","last_synced_at":"2025-04-05T01:06:32.597Z","repository":{"id":27816219,"uuid":"31305772","full_name":"Juniper/jsnapy","owner":"Juniper","description":"Python version of Junos Snapshot Administrator","archived":false,"fork":false,"pushed_at":"2024-08-06T07:05:56.000Z","size":13460,"stargazers_count":119,"open_issues_count":45,"forks_count":59,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-05T01:06:20.537Z","etag":null,"topics":["audit","jsnapy","junos-snapshot-administrator","python","yaml"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"chrislgarry/Apollo-11","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Juniper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-25T09:15:53.000Z","updated_at":"2025-03-26T10:47:12.000Z","dependencies_parsed_at":"2024-05-13T04:41:56.835Z","dependency_job_id":"1ddd319a-2649-4fa6-b09b-e84015bc6076","html_url":"https://github.com/Juniper/jsnapy","commit_stats":{"total_commits":677,"total_committers":32,"mean_commits":21.15625,"dds":0.7607090103397341,"last_synced_commit":"6bd53abc96b1d58feb68a6f921ae2430f41864cb"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fjsnapy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fjsnapy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fjsnapy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Juniper%2Fjsnapy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Juniper","download_url":"https://codeload.github.com/Juniper/jsnapy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247271530,"owners_count":20911587,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit","jsnapy","junos-snapshot-administrator","python","yaml"],"created_at":"2024-09-24T14:11:31.222Z","updated_at":"2025-04-05T01:06:32.578Z","avatar_url":"https://github.com/Juniper.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPi Version](https://img.shields.io/pypi/v/jsnapy.svg)](https://pypi.python.org/pypi/jsnapy/)\n[![Coverage Status](https://travis-ci.org/Juniper/jsnapy.svg?branch=master)](https://travis-ci.org/Juniper/jsnapy)\n[![Coverage Status](https://coveralls.io/repos/github/Juniper/jsnapy/badge.svg?branch=master)](https://coveralls.io/github/Juniper/jsnapy?branch=master)\n\n# JSNAPy\nPython version of Junos Snapshot Administrator\n\n![JSNAPy logo](static/JSNAPy.png?raw=true \"JSNAPy logo\")\n\nInspired by https://github.com/Juniper/junos-snapshot-administrator\n\n## Abstract\n\nJunos Snapshot Administrator enables you to capture and audit runtime environment snapshots of your networked devices running   the Junos operating system (Junos OS).\n  \nYou can write your test cases in yaml file and run those tests cases against pre and post snapshots.\n  \n\n## Installation\n\nInstallation requires Python \u003e 3.5 and associated pip tool\n      \n    1. Install using pip command\n          sudo pip install jsnapy\n    2. Install using pip command from github\n          sudo pip install git+https://github.com/Juniper/jsnapy.git \n    3. Updating using pip command (from github)\n          sudo pip install -U git+https://github.com/Juniper/jsnapy.git \n    4. Download or clone the source code from this git repository\n          git clone https://github.com/Juniper/jsnapy\n       Or Untar jsnapy-master.zip (if downloaded zip folder)\n          unzip jsnapy-master.zip\n       Go to jsnapy-master folder and install by:\n          sudo python setup.py sdist\n          sudo pip install dist/jsnapy-x.x.tar.gz\n          \n## Docker\n\nJSNAPy can also be run as a Docker container. Until the build pushes the image to Docker Hub, build it from Github:\n\n```bash\n$ docker build -t jsnapy https://github.com/Juniper/jsnapy.git\n\u003c... snipped ...\u003e\nSuccessfully tagged jsnapy:test\n```\n\nBind mount the directory containing the tests to the container and append the usual arguments. Assuming the tests are in the current directory, this should work.\n\n```bash\n$ docker run -it -v $PWD:/scripts jsnapy --snap pre -f config_check.yml\n```\n\n### Build Arguments\n\nThe following build arguments are currently supported:\n\n| ARG           | Default Value |\n|---------------|---------------|\n| `JSNAPY_HOME` | `/jsnapy`     |\n\n## Hello, World\n\nJSNAPy requires one main config file and test files.\nConfig file contains device details and test files to be executed.\n\nconfig_check.yml:\n\n```yaml\n# for one device, can be given like this:\n    hosts:\n      - device: router \n        username : abc\n        passwd: pqr\n    tests:\n      - test_no_diff.yml \n```\n\ntest_no_diff.yml\n\n```yaml\ntest_command_version:\n  - command: show interfaces terse lo* \n  - iterate:\n      xpath: physical-interface\n      id: './name'\n      tests:\n        - no-diff: oper-status       # element in which test is performed\n          err: \"Test Failed!! oper-status  got changed, before it was \u003c{{pre['oper-status']}}\u003e, now it is \u003c{{post['oper-status']}}\u003e\"\n          info: \"Test Passed!! oper-status is same, before it is \u003c{{pre['oper-status']}}\u003e now it is \u003c{{post['oper-status']}}\u003e \n```\n\nTo run this test execute following command:\n\n```text\n1. jsnapy --snap pre -f config_check.yml (for taking pre snapshot)\n2. jsnapy --snap post -f config_check.yml (for taking post snapshot after some modification)\n3. jsnapy --check pre post -f config_check.yml (compares pre post snapshot as per test cases)\n4. jsnapy --diff pre post -f config_check.yml (compares pre post snapshot files, shows the diff in 2 Columns)\n```\n\nOutput will look something like this:\n\n```bash\n(venv)sh-3.2# jsnapy --check pre post -f config_single_check.yml \n*************************Performing test on Device: 10.209.16.204*************************\nTests Included: test_command_version \n*************************Command is show interfaces terse lo**************************\n----------------------Performing no-diff Test Operation----------------------\nTest succeeded!! oper_status is same, before it is \u003c['up']\u003e now it is \u003c['up']\u003e \nFinal result of no-diff: PASSED \n------------------------------- Final Result!! -------------------------------\nTotal No of tests passed: 1\nTotal No of tests failed: 0 \nOverall Tests passed!!! \n```\n\n## File Paths\n\n1. config file (can give either):\n    - full file path  \n    - only file name, in this case JSNAPy will first look in present working \n      directory, if file is not present then it will take file path from \"config_file_path\" \n      in jsnapy.cfg file. Default config file path is \"/etc/jsnapy\"\n2. test file (either)\n    - full file path  \n    - only file name, in this case it will take path from \"test_file_path\" in jsnapy.cfg file. \n      Default test file path is \"/etc/jsnapy/testfiles\"\n3. snap file (either)\n    - full file path\n    - tag, in this case file name is formed automatically (\u003cdevicename\u003e_\u003ctag\u003e_\u003ccommand/rpc\u003e.\u003cxml/text\u003e)\n      Snap files will be taken from \"snapshot_path\" in jsnapy.cfg file. \n      Default path is `/etc/jsnapy/snapshots`\n\n## jsnap2py: \n\nTool to convert conf file of JSNAP slax into yaml file that can be consumed by JSNAPy.\n```\njsnap2py -i test_interface.conf\n```\nThis will convert slax conf file \"test_interface.conf\" into yaml file \"test_interface.yaml\".  \nIf you want to give different output file name, then use -o option\n```\njsnap2py -i test_interface.conf -o interface.yml\n```\nFor more information please refer [jsnap2py-wiki] (https://github.com/Juniper/jsnapy/wiki/7.-jsnap2py)\n\n\nLogging:\n--------\nLog related details will be extracted from \"logging.yml\" in jsnapy.cfg file.\n      Default path is \"/etc/jsnapy/logging.yml\"\n\nCONTRIBUTORS\n-------------\n\nJuniper Networks is actively contributing to and maintaining this repo. Please contact jnpr-community-netdev@juniper.net for any queries.\n\nContributors:  \n\n* v1.3.5: [Rahul Kumar](https://github.com/rahkumar651991)\n* v1.3.4: [Luis Lezcano Airaldi](https://github.com/luislezcair)\n* v1.3.3: [Rahul Kumar](https://github.com/rahkumar651991)\n* v1.2.0 - v1.3.2: [Jasminderpal Singh Sidhu](https://github.com/sidhujasminder)\n* v1.1.0: [Ishaan Kumar](https://github.com/eeishaan)\n* v1.0.0: [Priyal Jain](https://github.com/jainpriyal), [Nitin Kumar](https://github.com/vnitinv)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fjsnapy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuniper%2Fjsnapy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuniper%2Fjsnapy/lists"}