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): Refactor eos_designs structured_config code ip_access_list #4972

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

Conversation

MaheshGSLAB
Copy link
Contributor

Change Summary

Refactor eos_designs structured_config code ip_access_list

Related Issue(s)

Fixes #

Component(s) name

arista.avd.eos_designs

Proposed changes

Refactor eos_designs structured_config code ip_access_list

How to test

Run Molecule

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)

@MaheshGSLAB MaheshGSLAB self-assigned this Feb 4, 2025
Copy link

github-actions bot commented Feb 4, 2025

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

@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Feb 10, 2025
@Vibhu-gslab Vibhu-gslab marked this pull request as ready for review February 11, 2025 11:03
@Vibhu-gslab Vibhu-gslab requested review from a team as code owners February 11, 2025 11:03
@Vibhu-gslab Vibhu-gslab self-requested a review February 11, 2025 11:03
@github-actions github-actions bot added the state: conflict PR with conflict label Feb 12, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

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

@github-actions github-actions bot removed the state: conflict PR with conflict label Feb 21, 2025
Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review February 21, 2025 10:30

return natural_sort(ip_access_lists, "name") or None
self.structured_config.ip_access_lists = EosCliConfigGen.IpAccessLists(natural_sort(self.structured_config.ip_access_lists, sort_key="name"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't do this. Reading back structured config and reordering it will be very inefficient. It is ok if we reorder structured config a bit as long as the eos config and docs are the same.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment on lines 153 to 157
- source: any
destination: 100.64.30.2
sequence: 10
action: permit
protocol: udp
Copy link
Contributor

Choose a reason for hiding this comment

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

Something is wrong with this reordering. We The order of these outputs are controlled by the order of the fields in the classes, so we should not see this, if we output the correct class. Can you check that you don't have any type errors that could explain this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated as you suggested(reference from underlay port-channel refactoring)

@MaheshGSLAB MaheshGSLAB marked this pull request as draft February 24, 2025 12:38
@MaheshGSLAB MaheshGSLAB changed the title Refactor(eos_designs): Refactor eos_designs structured_config code ip_access_list Refactor(eos_designs): Refactor eos_designs structured_config code ip_access_list(Hold) Feb 24, 2025
@github-actions github-actions bot added the state: conflict PR with conflict label Feb 24, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the state: conflict PR with conflict label Feb 25, 2025
Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@github-actions github-actions bot added the state: conflict PR with conflict label Feb 25, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the state: conflict PR with conflict label Feb 25, 2025
Copy link

Conflicts have been resolved. A maintainer will review the pull request shortly.

@MaheshGSLAB MaheshGSLAB changed the title Refactor(eos_designs): Refactor eos_designs structured_config code ip_access_list(Hold) Refactor(eos_designs): Refactor eos_designs structured_config code ip_access_list Feb 25, 2025
@MaheshGSLAB MaheshGSLAB marked this pull request as ready for review February 25, 2025 13:33
elif internet_exit_policy_type == "direct":
self._acl_internet_exit_direct()

@structured_config_contributor
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move this method to the top

@@ -86,41 +63,33 @@ def _acl_internet_exit_user_defined(
acl = self.shared_utils.get_ipv4_acl(acl_name, "random", interface_ip="random", peer_ip="random")
if acl.name == acl_name:
# ACL doesn't need replacement
return [acl._as_dict()]
return acl
Copy link
Contributor

Choose a reason for hiding this comment

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

There is a type error

Suggested change
return acl
return acl._cast_as(EosCliConfigGen.IpAccessListsItem)

Update the return type in line 54 as well

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, this change fixes the ordering as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
72.1% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: CI Updated CI scenario have been updated in the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants