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

Refactor(eos_designs): Move IP and description logic to Python (step1) #2091

Merged

Conversation

ClausHolbechArista
Copy link
Contributor

@ClausHolbechArista ClausHolbechArista commented Sep 22, 2022

Change Summary

Refactor(eos_designs): Move IP and description logic to Python (step1)

Component(s) name

arista.avd.eos_designs

Proposed changes

  • Add support for loading configurable python modules with IP addressing and Interface Description logic:
templates:
  ip_addressing:
    python_module: 'ansible_collections.arista.avd.roles.eos_designs.python_modules.ip_addressing'
    python_class_name: 'AvdIpAddressing'
  interface_descriptions:
    python_module: 'ansible_collections.arista.avd.roles.eos_designs.python_modules.interface_descriptions'
    python_class_name: 'AvdInterfaceDescriptions'
  • Refactor eos_designs_facts to leverage these new python modules.
    • The new logic uses python builtin ipaddress and enforces correct sizing of pools.
    • Errors will be raised if we try to fetch IPs outside the pool. Historically we just ignored the pool mask and assigned outside it.
  • The default python modules still respect any custom templates, and since these take precedence, the python modules will not have any effect, until we remove the default templates.
  • In this PR we remove the default IP templates that are only leveraged inside eos_designs_facts

How to test

No changes to molecule. Tested locally with some refactored code.

  • had to change a bad mask on an IP pool, since we now enforce taking from the pool instead of overflowing.

Checklist

User Checklist

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@github-actions github-actions bot added filter: is_in_filter issue related to is_in_filter plugin filter: list_compress issue related to list_compress filter plugin filter: natural_sort issue related to natural_sort filter plugin module: configlet_build_config issue related to configlet_build_config module module: inventory_to_container issue related to inventory_to_container module type: code quality CI and development toolset type: documentation Improvements or additions to documentation type: Python filters labels Sep 26, 2022
@ClausHolbechArista ClausHolbechArista marked this pull request as draft September 26, 2022 11:42
@github-actions github-actions bot added the state: conflict PR with conflict label Sep 26, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions
Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot removed the state: conflict PR with conflict label Sep 26, 2022
@ClausHolbechArista ClausHolbechArista marked this pull request as ready for review September 26, 2022 16:37
@ClausHolbechArista ClausHolbechArista requested a review from a team October 3, 2022 09:41
@ClausHolbechArista ClausHolbechArista force-pushed the python-ip-address branch 2 times, most recently from f49d9ce to d2a64a3 Compare October 7, 2022 10:10
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

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

LGTM - Tested with customers repos

Copy link
Contributor

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

LGTM

@ClausHolbechArista ClausHolbechArista merged commit 2f0653c into aristanetworks:devel Oct 7, 2022
@ClausHolbechArista ClausHolbechArista deleted the python-ip-address branch December 22, 2022 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
filter: is_in_filter issue related to is_in_filter plugin filter: list_compress issue related to list_compress filter plugin filter: natural_sort issue related to natural_sort filter plugin module: configlet_build_config issue related to configlet_build_config module module: inventory_to_container issue related to inventory_to_container module rn: Refactor(eos_designs) role: eos_designs issue related to eos_designs role state: CI Updated CI scenario have been updated in the PR type: code quality CI and development toolset type: documentation Improvements or additions to documentation type: Python filters
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants