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_validate_state): ANTA Refactor AvdTestBase #3701
Refactor(eos_validate_state): ANTA Refactor AvdTestBase #3701
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ansible_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/avdtestbase.py
Show resolved
Hide resolved
ansible_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/config_manager.py
Show resolved
Hide resolved
for loopback_interface in loopback_interfaces: | ||
if loopback_interface.get("name") == "Loopback0": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for loopback_interface in loopback_interfaces: | |
if loopback_interface.get("name") == "Loopback0": | |
for loopback_interface in loopback_interfaces: | |
if (loopback_intefrace := get_item(loopback_interface, "name", "Loopback0") is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I refactored the function a bit in 554e20b we can't really use continue
since we want to check the VTEP loopbacks as well.
...ble_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/get_anta_results.py
Show resolved
Hide resolved
ansible_collections/arista/avd/plugins/plugin_utils/eos_validate_state_utils/mixins.py
Outdated
Show resolved
Hide resolved
...le_collections/arista/avd/roles/eos_validate_state/python_modules/tests/avdtestinterfaces.py
Outdated
Show resolved
Hide resolved
..._collections/arista/avd/roles/eos_validate_state/python_modules/tests/avdtestconnectivity.py
Outdated
Show resolved
Hide resolved
log_msg = f"{message}. {log_msg}" if prepend_message else f"{log_msg} {message}." | ||
|
||
# Logging the message | ||
log_level = logging.getLevelName(log_level.upper()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upper is seless here as it would have failed line 38 already if not upper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No because I want the function to handle both lower and upper case log_level
argument.
Change Summary
Refactor AvdTestBase to improve maintainability, clarity and performance (fixes #3304).
Related Issue(s)
Fixes #3304
Component(s) name
arista.avd.eos_validate_state
ANTA modeProposed changes
ConfigManager
class to manage each device configuration and create required variables for the tests. This class improves performance since it is created per device and not per tests.DeviceUtilsMixin
andValidationMixin
mixin classes to theAvdTestBase
and move the existing methods to these.logged_get
as it was unnecessary and was removing functionality of theget
util function.How to test
ansible-playbook playbooks/fabric-validate.yml -e use_anta=true
Checklist
User Checklist
Repository Checklist