-
Notifications
You must be signed in to change notification settings - Fork 233
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): Refactor eos_designs structured_config code for monitor_sessions #4937
base: devel
Are you sure you want to change the base?
Refactor(eos_designs): Refactor eos_designs structured_config code for monitor_sessions #4937
Conversation
…r monitor_sessions
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-4937
# Activate the virtual environment
source test-avd-pr-4937/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Shivani-gslab/avd.git@monitor_session_refactor#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/Shivani-gslab/avd.git#/ansible_collections/arista/avd/,monitor_session_refactor --force
# Optional: Install AVD examples
cd test-avd-pr-4937
ansible-playbook arista.avd.install_examples |
for more information, see https://pre-commit.ci
} | ||
monitor_session = EosCliConfigGen.MonitorSessionsItem( | ||
name=session_name, | ||
sources=[], |
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.
Not needed since it will be autocreated when needed.
sources=[], |
source.access_group = EosCliConfigGen.MonitorSessionsItem.SourcesItem.AccessGroup( | ||
type=session.source_settings.access_group.type, | ||
name=session.source_settings.access_group.name, | ||
priority=session.source_settings.access_group.priority, | ||
) |
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.
This the properties have the same name and type you can do:
source.access_group = EosCliConfigGen.MonitorSessionsItem.SourcesItem.AccessGroup( | |
type=session.source_settings.access_group.type, | |
name=session.source_settings.access_group.name, | |
priority=session.source_settings.access_group.priority, | |
) | |
source.access_group = session.source_settings.access_group._cast_as(EosCliConfigGen.MonitorSessionsItem.SourcesItem.AccessGroup) |
) | ||
if session.source_settings.access_group.name 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.
if session.source_settings.access_group.name is not None: | |
if session.source_settings.access_group.name: |
name=session.source_settings.access_group.name, | ||
priority=session.source_settings.access_group.priority, | ||
) | ||
monitor_session.sources.extend(source) |
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.
monitor_session.sources.extend(source) | |
monitor_session.sources.append(source) |
@cached_property | ||
def monitor_sessions(self: AvdStructuredConfigConnectedEndpoints) -> list | None: | ||
@structured_config_contributor | ||
def monitor_sessions(self: AvdStructuredConfigConnectedEndpoints) -> 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.
Check if it makes sense to populate the self._monitor_session_configs with the EosCliConfigGen models directly instead of having to convert all of them here. Only if it makes sense and we can save something.
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Conflicts have been resolved. A maintainer will review the pull request shortly. |
Quality Gate passedIssues Measures |
Change Summary
Related Issue(s)
Fixes #
Component(s) name
arista.avd.<role-name>
Proposed changes
How to test
Checklist
User Checklist
Repository Checklist