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

Unable to run xpath functions #174

Closed
eeishaan opened this issue Sep 27, 2016 · 2 comments
Closed

Unable to run xpath functions #174

eeishaan opened this issue Sep 27, 2016 · 2 comments
Labels
Milestone

Comments

@eeishaan
Copy link
Contributor

eeishaan commented Sep 27, 2016

Due to improper splitting here (in check.py) the following test case is unable to run :

test_interfaces_terse:
  - command: show interfaces terse
  - iterate:
      id: ./name
      xpath: //physical-interface
      tests:
        - exists: ./name[contains(substring(.,1,3),'pfe')]

An error is produced which says that the xpath is invalid.
This can be reproduced by using xpath functions in the xpath specified with the operator( exists here )

@ydnath ydnath added the bug label Oct 21, 2016
@ydnath ydnath added this to the 1.3 milestone Oct 21, 2016
@sidhujasminder
Copy link
Contributor

@eeishaan What i see in XPATH docs is that most of the xpath functions have "[ ]", So do you think it will be ok to split considering this in code?

@eeishaan
Copy link
Contributor Author

eeishaan commented Oct 27, 2017

How about using a regexp? This regexp: /((?!,)(?! ).*?\[.*?\])/ should capture all the nodes in the exists list without the , and space separators.

Reading to understand the regexp:

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

No branches or pull requests

3 participants