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): Improve structured_config object duplication checks with opt-in #4897

Conversation

ClausHolbechArista
Copy link
Contributor

@ClausHolbechArista ClausHolbechArista commented Jan 20, 2025

Change Summary

Improve structured_config object duplication checks with opt-in

Component(s) name

arista.avd.eos_designs

Proposed changes

  • Check for duplicate objects across all structured config modules - today we only check within one module
    • Like only finding duplicate interfaces if assigned for different connected endpoints
    • With this we also catch if uplink is the same as a connected endpoint
  • This may lead to issues for people "misusing" various protocols to build their configs, so the feature is introduced behind the knob avd_eos_designs_enforce_duplication_checks_across_all_models: true
  • The duplication check is moved to the schema-based classes where performance is improved significantly.
    • Now using hash lookup instead of looping over all the items for each added item.
  • Refactored connected endpoints ethernet_interfaces and port_channel_interfaces to use the new classes.
    • Fix missing default value for port-channel LACP fallback timer in schema.

How to test

  • Added molecule coverage to negative test with the knob enabled.
  • Tested performance for the refactor and seeing ~14% performance improvement for this change alone. Expecting many improvements as we refactor the rest.

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)

@ClausHolbechArista ClausHolbechArista requested review from a team as code owners January 20, 2025 18:08
Copy link

Review docs on Read the Docs

To test this pull request:

# Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4897
# Activate the virtual environment
source test-avd-pr-4897/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/ClausHolbechArista/avd.git@refactor/eos_designs/structured_config_rendering#subdirectory=python-avd" --force
# Point Ansible collections path to the Python virtual environment
export ANSIBLE_COLLECTIONS_PATH=$VIRTUAL_ENV/ansible_collections
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/ClausHolbechArista/avd.git#/ansible_collections/arista/avd/,refactor/eos_designs/structured_config_rendering --force
# Optional: Install AVD examples
cd test-avd-pr-4897
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated role: eos_designs issue related to eos_designs role labels Jan 20, 2025
@emilarista emilarista self-assigned this Jan 24, 2025
Copy link
Contributor

@emilarista emilarista left a comment

Choose a reason for hiding this comment

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

Tested with some different conflict combos between servers, uplinks and core_interfaces. The new knob works as expected. LGTM!

Copy link
Contributor Author

@ClausHolbechArista ClausHolbechArista left a comment

Choose a reason for hiding this comment

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

Address review comments

@gmuloc gmuloc merged commit 15bad4d into aristanetworks:devel Jan 27, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn: Refactor(eos_designs) role: eos_designs issue related to eos_designs role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants