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

Uninett/jinja2 filters #167

Merged
merged 5 commits into from
May 18, 2021

Conversation

katsel
Copy link
Contributor

@katsel katsel commented Apr 28, 2021

Unfinished draft/WIP PR for review purposes.

ToDo:

Jinja2 filter functions

  • increment IP
  • IPv4 to ISO
  • IPv4 to IPv6

Unit tests for functions

  • increment IP
    • IPv4
    • IPv6
  • IPv4 to ISO
  • IPv4 to IPv6

invoke filter functions

Any part that touches jinja2 templates should be made aware of the filter functions, e.g.

  • in sync_devices.py
  • in nornir_helper.py
  • in template_dry_run.py

@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #167 (e2aa35d) into develop (9d9c3ef) will increase coverage by 0.04%.
The diff coverage is 23.68%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #167      +/-   ##
===========================================
+ Coverage    58.33%   58.37%   +0.04%     
===========================================
  Files           59       60       +1     
  Lines         5942     5980      +38     
===========================================
+ Hits          3466     3491      +25     
- Misses        2476     2489      +13     
Impacted Files Coverage Δ
src/cnaas_nms/db/helper.py 60.65% <ø> (ø)
src/cnaas_nms/db/settings.py 81.43% <ø> (+0.79%) ⬆️
src/cnaas_nms/tools/jinja_filters.py 14.70% <14.70%> (ø)
src/cnaas_nms/confpush/nornir_helper.py 94.54% <100.00%> (+0.42%) ⬆️
src/cnaas_nms/api/groups.py 81.25% <0.00%> (+20.31%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea1f6a2...e2aa35d. Read the comment docs.

@katsel katsel marked this pull request as ready for review May 11, 2021 11:51
@katsel
Copy link
Contributor Author

katsel commented May 11, 2021

Almost ready for merge now.

Still to do

  • incorporate last feedback
  • rebase

@katsel
Copy link
Contributor Author

katsel commented May 11, 2021

ipv4_to_iso function is still a blocker

@katsel katsel force-pushed the uninett/jinja2-filters branch 2 times, most recently from 58989d7 to 5c6dced Compare May 18, 2021 13:49
katsel and others added 5 commits May 18, 2021 16:16
- Import filters into the jinja environment via nornir_helper
- Add jinja filter to increment an IP address/interface
- Add unit tests for IP incrementation, covering IPv4 and IPv6
- it messes with the jinja filter unit tests
- "probably not needed any longer"
Co-authored-by: Svein Ove Undal <sveinov@uninett.no>
@katsel
Copy link
Contributor Author

katsel commented May 18, 2021

  • IPv4 to ISO function solved:
    • Sunet's version of padding
    • with parameter for the prefix (no partial ISO address in the templates)
  • rebase against current develop

Branch is ready for merge now from our side.

@indy-independence indy-independence merged commit ba2635a into SUNET:develop May 18, 2021
@indy-independence indy-independence added this to the v1.3.0 milestone Jul 12, 2021
@lunkwill42 lunkwill42 deleted the uninett/jinja2-filters branch September 19, 2022 13:30
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

Successfully merging this pull request may close these issues.

2 participants