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_cli_config_gen): Adding new improved model for interface link tracking groups #4610

Open
wants to merge 11 commits into
base: devel
Choose a base branch
from

Conversation

Vibhu-gslab
Copy link
Contributor

@Vibhu-gslab Vibhu-gslab commented Oct 17, 2024

Change Summary

Introducing new model for link tracking group which supports only one direction for an interface

Related Issue(s)

Fixes #4584

Component(s) name

arista.avd.eos_cli_config_gen

Proposed changes

Adding a new model

How to 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

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-4610
# Activate the virtual environment
source test-avd-pr-4610/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Vibhu-gslab/avd.git@4584#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/Vibhu-gslab/avd.git#/ansible_collections/arista/avd/,4584 --force
# Optional: Install AVD examples
cd test-avd-pr-4610
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 Oct 17, 2024
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_cli_config_gen): Change the data model to support only one direction in link tracking group for an interface Refactor(eos_cli_config_gen, eos_designs): Change the data model to support only one direction in link tracking group for an interface Oct 17, 2024
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_cli_config_gen, eos_designs): Change the data model to support only one direction in link tracking group for an interface Refactor(eos_cli_config_gen, eos_designs): Link tracking group supports only one direction for an interface Oct 17, 2024
@gmuloc gmuloc added this to the v5.0.0 milestone Oct 17, 2024
Comment on lines 14 to 16
link_tracking_groups:
- name: EVPN_MH_ES1
direction: upstream
direction: upstream
names: [EVPN_MH_ES1, EVPN_MH_ES2]
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a breaking change which cannot get merged until 6.0.0. Instead I think we could do:

    link_tracking:
      direction: upstream
      groups: [EVPN_MH_ES1, EVPN_MH_ES2]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added!

@ClausHolbechArista ClausHolbechArista removed this from the v5.0.0 milestone Oct 18, 2024
@Vibhu-gslab Vibhu-gslab changed the title Refactor(eos_cli_config_gen, eos_designs): Link tracking group supports only one direction for an interface Refactor(eos_cli_config_gen): Adding new model for link tracking group which supports only one direction for an interface Oct 18, 2024
@@ -334,6 +334,11 @@
| {{ link_tracking_interface.name }} | {{ link_tracking_group.name }} | {{ link_tracking_group.direction }} |
{% endif %}
{% endfor %}
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined %}
{% for group_name in link_tracking_interface.link_tracking.groups | arista.avd.natural_sort %}
| {{ link_tracking_interface.name }} | {{ group_name }} | {{ link_tracking_interface.link_tracking.direction }} |
Copy link
Contributor

Choose a reason for hiding this comment

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

i think in new model we should join all group by comma and keep in one row only.
cc: @ClausHolbechArista

Copy link
Contributor

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed!

Copy link
Contributor

@Shivani-gslab Shivani-gslab left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 296 to 299
{% for group_name in link_tracking_interface.link_tracking.groups %}
{% do link_tracking_group_name.append(group_name) %}
| {{ link_tracking_interface.name }} | {{ link_tracking_group_name | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |
{% endfor %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% for group_name in link_tracking_interface.link_tracking.groups %}
{% do link_tracking_group_name.append(group_name) %}
| {{ link_tracking_interface.name }} | {{ link_tracking_group_name | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |
{% endfor %}
| {{ link_tracking_interface.name }} | {{ link_tracking_interface.link_tracking.groups | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

{% for link_tracking_group in link_tracking_interface.link_tracking_groups | arista.avd.natural_sort('name') %}
{% if link_tracking_group.name is arista.avd.defined and link_tracking_group.direction is arista.avd.defined %}
| {{ link_tracking_interface.name }} | {{ link_tracking_group.name }} | {{ link_tracking_group.direction }} |
{% endif %}
{% endfor %}
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined %}
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined and link_tracking_interface.link_tracking.group is arista.avd.defined %}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Comment on lines 338 to 343
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined %}
{% for group_name in link_tracking_interface.link_tracking.groups | arista.avd.natural_sort('name') %}
{% do link_tracking_group_name.append(group_name) %}
| {{ link_tracking_interface.name }} | {{ link_tracking_group_name | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |
{% endfor %}
{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined %}
{% for group_name in link_tracking_interface.link_tracking.groups | arista.avd.natural_sort('name') %}
{% do link_tracking_group_name.append(group_name) %}
| {{ link_tracking_interface.name }} | {{ link_tracking_group_name | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |
{% endfor %}
{% endif %}
{% if link_tracking_interface.link_tracking.direction is arista.avd.defined and link_tracking_interface.link_tracking.groups is arista.avd.defined %}
| {{ link_tracking_interface.name }} | {{ link_tracking_interface.link_tracking.groups | join(', ') }} | {{ link_tracking_interface.link_tracking.direction }} |
{% endif %}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

Comment on lines 224 to 225
| Ethernet1 | EVPN_MH_ES3 | upstream |
| Ethernet1 | EVPN_MH_ES3, EVPN_MH_ES4 | upstream |
Copy link
Contributor

Choose a reason for hiding this comment

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

You can see duplicate entries here...

@ClausHolbechArista ClausHolbechArista changed the title Refactor(eos_cli_config_gen): Adding new model for link tracking group which supports only one direction for an interface Feat(eos_cli_config_gen): Adding new improved model for interface link tracking groups Nov 6, 2024
@Vibhu-gslab Vibhu-gslab marked this pull request as draft November 6, 2024 11:20
Copy link

sonarcloud bot commented Nov 7, 2024

@Vibhu-gslab Vibhu-gslab marked this pull request as ready for review November 7, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

Cannot configure both upstream and downstream in link tracking group for the same interface
5 participants