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

How to pass ansible variables to jsnapy test files? #390

Open
chuegel opened this issue Oct 5, 2021 · 0 comments
Open

How to pass ansible variables to jsnapy test files? #390

chuegel opened this issue Oct 5, 2021 · 0 comments
Milestone

Comments

@chuegel
Copy link

chuegel commented Oct 5, 2021

Description of Issue/Question

How to pass ansible variables to jsnapy test files?

Setup

(Please provide relevant configs, xml snapshots and related files (Be sure to remove sensitive info).)
jsnapy is installed as part of the juniper.device collection

Steps to Reproduce Issue

(Include debug logs if possible and relevant. Error trace would be helpful too)
Consider this inventory:

[all:vars]
bgp_total-prefix-count: 3000

[MX104]
10.10.10.1

task:

---
- name: check BGP on "{{ inventory_hostname }}"
  juniper.device.jsnapy:
    port: "{{ netconf_port }}"
    dir: "{{ playbook_dir }}/testfiles/"
    test_files: test_bgp.yml
    action: snapcheck
  register: result_pre_bgp

testfile:

---
tests_include:
  - bgp_summary
  - bgp_neighbor

bgp_summary:
  - rpc: get-bgp-summary-information
  - item:
      xpath: '//bgp-rib'
      tests:
        - is-gt: total-prefix-count, "{{ bgp_total-prefix-count }}"
          err: "Test Failed!! value of total-prefix-count is not greater then "{{ bgp_total-prefix-count }}", it is equal to <{{post['total-prefix-count']}}>"
          info: "Test succeeded!! value of total-prefix-count is not greater then "{{ bgp_total-prefix-count }}", it is equal to <{{post['total-prefix-count']}}>"

But jsnapy throws an error: Complete Message: could not convert string to float: '"{{ bgp_total-prefix-count }}"'
How can I pass ansible variables to jsnapy test files?

Versions Report

(Provided by running jsnapy --version. Please also mention python version.)

pip list | grep jsnapy
jsnapy                1.3.6
@ydnath ydnath added this to the Release 1.3.8 milestone Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants