Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

juniper_junos_jsnapy issue with Vagrant vQFX #430

Open
gmoisio opened this issue May 12, 2019 · 6 comments
Open

juniper_junos_jsnapy issue with Vagrant vQFX #430

gmoisio opened this issue May 12, 2019 · 6 comments

Comments

@gmoisio
Copy link

gmoisio commented May 12, 2019

Issue Type: Feature Idea
Module Name: juniper_junos_jsnapy
Last Master Juniper.Junos role and last Python libraries version

Using Vagrant vQFX and Ansible provisioning to simulate a network, there is an issue with juniper_junos_jsnapy module.
The inventory file generated by Vagrant use a specific generated inventory_hostname for each device, but the ansible_host is the same (127.0.0.1). Difference is made with ansible_port for each device.
JSNAPy use the IP address for the snap files. It's the same for each device, so we do not get the expected behavior in a simulation environment.

Is there a trick to change the way JSNAPy records the snap files names?

Thanks
Regards

@rsmekala
Copy link
Contributor

@gmoisio The support to specify custom file names is already present in JSNAPy, but is not currently supported via Ansible module: juniper_junos_jsnappy.
Link: https://github.com/Juniper/jsnapy/wiki/4.-Module

Marking as an enhancement. Thanks for reporting the feature, will work on it and raise a PR.

Are there any specifics or ideas you think should be included in the feature ??

@gmoisio
Copy link
Author

gmoisio commented May 14, 2019

Hi, thank you for your answer.

Using the snap_file_name parameter as in JSNAPy would be great.
The parameter named "devicename" is in fact the IP@ of the ansible_host in ansible/vagrant. The "prefix" parameter would be the {{ inventory_hostname }} to build a unique file name.

Thanks
Best Regards

@gmoisio
Copy link
Author

gmoisio commented May 15, 2019

Hi, one more question please.
When using JSNAPy as a module in Python, is there a way to access a field in a configuration file like this one in order to use it as a prefix for the file name?
----conf.yml----

hosts:
  - device: localhost
    username: root
    passwd: Juniper
    port: 2222

--Python code--

config_file = "conf.yml"
snapchk = js.snapcheck(config_file, <a_syntax_to_access_the_port_field>)

Thanks
Regards

@rsmekala
Copy link
Contributor

There is no such feature in Jsnapy, but this would be a nice feature to have. Will work on it and keep you posted.

@rsmekala rsmekala assigned rsmekala and unassigned rsmekala Jan 7, 2020
@rsmekala
Copy link
Contributor

rsmekala commented Jan 7, 2020

@rahkumar651991 Can you please take a look at this ??

@rsmekala rsmekala removed their assignment Jan 10, 2020
@chidanandpujar chidanandpujar self-assigned this May 9, 2024
@chidanandpujar
Copy link
Collaborator

Hi ,
We have option to pass snap_file_name parameter as below.

~/ansible_release_test5/ansible-junos-stdlib/tests# jsnapy --snapcheck /root/ansible_release_test5/venv/etc/jsnapy/snapshots/test1_pre_show_system_storage.xml -f junos_jsnapy/common_config.yml -v
jsnapy.cfg file location used : /root/ansible_release_test5/venv/etc/jsnapy
Configuration file location used : /root/ansible_release_test5/venv/etc/jsnapy
Connecting to device x.x.x.x ................
Tests Included: check_storage 
Taking snapshot of COMMAND: show system storage 
**************************** Device: x.x.x.x ****************************
Tests Included: check_storage 
************************ Command: show system storage ************************
-----------------------Performing is-lt Test Operation-----------------------
File system /.mount use less than 95%
PASS | All "used-percent" is less than 95 [ 1 value matched ]
------------------------------- Final Result!! -------------------------------
check_storage : Passed
Total No of tests passed: 1
Total No of tests failed: 0 
Overall Tests passed!!! 

Thanks
Chidanand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants