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

Feat(eos_designs): Relax mode in structured config #4784

Merged

Conversation

gmuloc
Copy link
Contributor

@gmuloc gmuloc commented Dec 4, 2024

Change Summary

This pull request introduces a relaxed mode to validate the schema when handling structured_configuration (not custom_structured_configuration) in eos_designs. This relaxed validation mode ignore missing required keys.

Related Issue(s)

Component(s) name

arista.avd.eos_designs

Proposed changes

  • Introduce a relaxed_validation boolean key in the metaschema to be able to indicate in the schema which keys (and their children) should use the relaxed validation mode
  • Set relaxed_validation: true for all existing structured_config keys in eos_designs
  • adjust the validation code to ignore required keys when relaxed_validation is true
  • Set a required key in the aaa.accounting model in eos_cli_config_gen for testing

NOTE

The relaxed_validation key is for now allowed only for dict type in the metaschema. It can be added to the others later if/when use cases arise.

How to test

Added a molecule test

Checklist

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)

Copy link

github-actions bot commented Dec 4, 2024

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-4784
# Activate the virtual environment
source test-avd-pr-4784/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/gmuloc/avd.git@relax-mode-in-structured-config#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/gmuloc/avd.git#/ansible_collections/arista/avd/,relax-mode-in-structured-config --force
# Optional: Install AVD examples
cd test-avd-pr-4784
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added role: eos_cli_config_gen issue related to eos_cli_config_gen role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated labels Dec 4, 2024
Copy link
Contributor

@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.

it is still in draft, but looks good to me.

@gmuloc gmuloc marked this pull request as ready for review December 6, 2024 10:47
@gmuloc gmuloc requested review from a team as code owners December 6, 2024 10:47
@gmuloc gmuloc added the one approval This PR has one approval and is only missing one more. label Dec 6, 2024
@gmuloc
Copy link
Contributor Author

gmuloc commented Dec 6, 2024

@ClausHolbechArista the next steps will be to go over eos_cli_config_gen and start to see where to add required keys.

@carlbuchmann
Copy link
Member

@gmuloc can you add a brief change summary on this PR?

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 absent router_isis.instance key in structured_config which generates schema errors with devel, but with this PR the relaxed validation ignores it. LGTM!

@carlbuchmann carlbuchmann merged commit 4cf6d39 into aristanetworks:devel Dec 12, 2024
46 checks passed
emilarista pushed a commit to emilarista/ansible-avd that referenced this pull request Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
one approval This PR has one approval and is only missing one more. rn: Feat(eos_designs) role: eos_cli_config_gen issue related to eos_cli_config_gen 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