Jsnapy

Latest version: v1.3.7

Safety actively analyzes 630523 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 2 of 4

1.3.1

Minor bug fixes

* Bdist_wheel build fail for PyYaml and six modules 295
* setup logging called before SnapAdmin initialization 299

1.3.0

Bug Fixes
- XPath Function Support -- 174 via 279

Feature Enhancement

- Changing File structure for JSNAPy -- via 289

The /etc folder will from `version >= 1.3` contain-

a) jsnapy.cfg: JSNAPy configparser file containing file paths, modify this file to change file paths
b) logging.yml: File describing loggging settings. Modify this file if you want to change logging levels or
output format

And the Testfiles and Snapshots stored in ~/jsnapy folder.

Testfiles and Snapshots stored in ~/jsnapy folder.
The testfiles and snapshots will now get stored in the home folder of the user.
User will have to create the path to ~/jsnapy/snapshots and ~/jsnapy/testfiles
if they do not exist.

These changes are necessary with respect to security and user permission in /etc folder

1.2.2

Not secure
Bug Fixes
- Snapcheck not working from command line-- 286 fixed via 287
- Double printing of output when password not given-- 284 fixed via 285

1.2.1

Not secure
Bug Fixes
- Ansible mulitple device Testing issue --Fix 263 via 274
- bdist_wheel error during pip install jsnapy --Fix 265 via 268
- MacOS Darwin jsnapy install failure- Fix 266 via 267
- list-not-more function not showing failed messages -Fix 269 via 273
- Including kwargs hash value in snapshot file name 282

1.2.0

Not secure
Feature addition
- Compatibility to Windows and Python Virtual Environment.252
- Now install jsnapy on windows using `pip install jsnapy`. For Documentation related to Windows refer
[windows support](https://github.com/Juniper/jsnapy/wiki#windows-and-python-virtual-environment-support-added-in-v12)
- If user does not have sudo permissions, create virtual environment in python and activate it. Install jsnapy
using `pip install jsnapy`. For Documentation related to Python virtual environment refer [Virtual Environment support](https://github.com/Juniper/jsnapy/wiki#python-virtualenv-support)

- JSNAPy Compatible to Python 3.4+
- In addition to existing features, the newer version of JSNAPy also supports python 3.4+ .

Feature Enhancement

- Running testfile through CLI 199
Enabling passing testfile through Command Line.
For Single Testfile
`jsnapy --snapcheck <snap_name> --testfiles <test_file1> --hostname <host_name> --login <login> --passwd <passwd>`
For Multiple Testfiles
`jsnapy --snapcheck <snap_name> --testfiles <test_file1> <test_file2> <test_file3> --hostname <host_name> --login <login> --passwd <passwd>`

For more Reference, see how to use [optional arguments](https://github.com/Juniper/jsnapy/wiki/3.-Command-Line-Tool#optional-arguments) in jsnapy through cli

- Adding message to Dictionary 254
python
from jnpr.jsnapy import SnapAdmin
from pprint import pprint

js = SnapAdmin()
pre_pass = js.snap('config.yml', 'pre_check')
post_pass = js.snap('config.yml', 'post_check')
snapval = js.check('config.yml', 'pre_check', 'post_check')

for item in snapval:
print("\n -----------check----------")
print("Tested on", item.device)
print("Final result: ", item.result)
print("Total passed: ", item.no_passed)
print("Total failed:", item.no_failed)
pprint(item.test_results)



config.yml
yaml
hosts:
- device: 1.1.1.1
username: abc
passwd: xyz

tests:
- test_in_range.yml


test_in_range.yml

yaml
check_chassis_fpc:
- command: show chassis fpc
- iterate:
xpath: fpc[normalize-space(slot) = "0"]
tests:
- in-range: memory-heap-utilization, 5, 40
info: "Test Succeeded!! memory heap utilisation of the FPCs is within the range of 5-40, it is <{{post['memory-heap-utilization']}}> with temperature: <{{post['temperature']}}>"
err: "Test Failed!! memory heap utilisation of the FPCs is not in range of 5-40, it is <{{post['memory-heap-utilization']}}> with temperature: <{{post['temperature']}}>"


**Output**

yaml

-----------check----------

1.1.1.1

('Final result: ', 'Passed')
('Total passed: ', 1)
('Total failed:', 0)
{'check_chassis_fpc': [{'command': 'show chassis fpc',
'count': {'fail': 0, 'pass': 1},
'expected_node_value': [5.0, 40.0],
'failed': [],
'node_name': 'memory-heap-utilization',
'passed': [{'actual_node_value': '20',
'id': {},
'message': 'Test Succeeded!! memory heap utilisation of the FPCs is within the range of 5-40, it is <20> with temperature: <Testing>',
'post': {'memory-heap-utilization': '20',
'temperature': 'Testing'},
'pre': {'memory-heap-utilization': '20'}}],
'result': True,
'testoperation': 'in-range',
'xpath': 'fpc[normalize-space(slot) = "0"]'}]}




Bug Fixes
- Port issue fixed -- Fix 215 via 216
- Jsnapy python module and snapcheck method with local=True argument --Fix 217 via 218
- Changes for virtualenv --Fix 221 via 252
- Corrected --diff command example 234
- Duplicate log for delta operator if ID is missing 236 via 237
- ID.1 not getting converted to id_0 solved 226 via 238
- Delta Operator-fix for positive percentages 241
- Fix for range in positive value for delta 243
- Finding Testop error 245
- multiple devices thread infinite loop issue 256

**NOTE**<br>
- For Extending the support to virtualenv Python there have been a few major structure changes, Keeping into consideration the user's with no sudo permissions. This will help to extend code to wider audience.

Page 2 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.