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

Add ttp_parse helper function to codebase #1563

Merged
merged 4 commits into from
Feb 13, 2022
Merged

Add ttp_parse helper function to codebase #1563

merged 4 commits into from
Feb 13, 2022

Conversation

dmulyalin
Copy link
Contributor

What this PR does

This PR developed as part of NANOG84 Hackathon efforts.

This PR add new helper function ttp_parse.

Motivation

Debugging and developing regular expressions can be tedious process, for some use cases it is possible to use TTP as a drop in to produce same results but with less efforts. Besides parsing, TTP also might bring other use cases like results data validation, formatting, testing or postprocessing.

How this was tested

Updated test/base/test_helpers.py file with test_ttp_parse test that does 5 sub-tests:

  • check if raises TemplateRenderException when template does not exist
  • check if raises TemplateRenderException for /utils/ttp_templates/bad_template.txt
  • check if returns expected result as output for ./utils/ttp_templates/good_template.txt
  • check if returns expected result as output for inline template
  • check if returns expected result as output for template from ttp templates

Copy link
Member

@mirceaulinic mirceaulinic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just please fix the lint errors, then we should be able to take this in.

@mirceaulinic mirceaulinic merged commit 2b88a1e into napalm-automation:develop Feb 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants