-
Notifications
You must be signed in to change notification settings - Fork 220
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_cli_config_gen): Add support to set vlan and vni ranges in vxlan interface #4749
base: devel
Are you sure you want to change the base?
Refactor(eos_cli_config_gen): Add support to set vlan and vni ranges in vxlan interface #4749
Conversation
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-4749
# Activate the virtual environment
source test-avd-pr-4749/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/laxmikantchintakindi/avd.git@refactor/eos_cli/vxlan_vni#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/laxmikantchintakindi/avd.git#/ansible_collections/arista/avd/,refactor/eos_cli/vxlan_vni --force
# Optional: Install AVD examples
cd test-avd-pr-4749
ansible-playbook arista.avd.install_examples |
Quality Gate passedIssues Measures |
ansible_collections/arista/avd/molecule/eos_cli_config_gen/intended/configs/host1.cfg
Show resolved
Hide resolved
797398b
to
ce4705e
Compare
python-avd/pyavd/_eos_cli_config_gen/j2templates/documentation/vxlan-interface.j2
Outdated
Show resolved
Hide resolved
…/vxlan-interface.j2 Co-authored-by: Shivani-gslab <145646625+Shivani-gslab@users.noreply.github.com>
{% set all_vlans = vxlan_config.vxlan.vlans | map(attribute='id') | map('arista.avd.range_expand') | sum(start=[]) %} | ||
{% for all_vlans_item in all_vlans | arista.avd.natural_sort %} | ||
{% for vxlan_vlans in vxlan_config.vxlan.vlans %} | ||
{% set vlans = vxlan_vlans.id | arista.avd.range_expand %} | ||
{% if all_vlans_item in vlans %} | ||
{% if vxlan_vlans.vni is arista.avd.defined %} | ||
{% set vlan_idx = vlans.index(all_vlans_item) %} | ||
{% set vlan_vnis = vxlan_vlans.vni | arista.avd.range_expand %} | ||
{% set vlan_vni = vlan_vnis[vlan_idx] %} | ||
{% else %} | ||
{% set vlan_vni = '-' %} | ||
{% endif %} | ||
{% set multicast_group = vxlan_vlans.multicast_group | arista.avd.default('-') %} | ||
{% if vxlan_vlans.flood_vteps is arista.avd.defined %} | ||
{% set flood_list = vxlan_vlans.flood_vteps | join('<br/>') %} | ||
{% else %} | ||
{% set flood_list = '-' %} | ||
{% endif %} | ||
| {{ all_vlans_item }} | {{ vlan_vni }} | {{ flood_list }} | {{ multicast_group }} | | ||
{% endif %} | ||
{% endfor %} | ||
{% endfor %} |
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.
it could be more optimized like this (discussed with @Vibhu-gslab)
{% set all_vlans = vxlan_config.vxlan.vlans | map(attribute='id') | map('arista.avd.range_expand') | sum(start=[]) %} | |
{% for all_vlans_item in all_vlans | arista.avd.natural_sort %} | |
{% for vxlan_vlans in vxlan_config.vxlan.vlans %} | |
{% set vlans = vxlan_vlans.id | arista.avd.range_expand %} | |
{% if all_vlans_item in vlans %} | |
{% if vxlan_vlans.vni is arista.avd.defined %} | |
{% set vlan_idx = vlans.index(all_vlans_item) %} | |
{% set vlan_vnis = vxlan_vlans.vni | arista.avd.range_expand %} | |
{% set vlan_vni = vlan_vnis[vlan_idx] %} | |
{% else %} | |
{% set vlan_vni = '-' %} | |
{% endif %} | |
{% set multicast_group = vxlan_vlans.multicast_group | arista.avd.default('-') %} | |
{% if vxlan_vlans.flood_vteps is arista.avd.defined %} | |
{% set flood_list = vxlan_vlans.flood_vteps | join('<br/>') %} | |
{% else %} | |
{% set flood_list = '-' %} | |
{% endif %} | |
| {{ all_vlans_item }} | {{ vlan_vni }} | {{ flood_list }} | {{ multicast_group }} | | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
{% for vxlan_vlans in vxlan_config.vxlan.vlans %} | |
{% set vlans = vxlan_vlans.id | arista.avd.range_expand %} | |
{% if vxlan_vlans.vni is arista.avd.defined %} | |
{% set vlan_vni = vxlan_vlans.vni | arista.avd.range_expand %} | |
{% endif %} | |
{% set multicast_group = vxlan_vlans.multicast_group | arista.avd.default('-') %} | |
{% if vxlan_vlans.flood_vteps is arista.avd.defined %} | |
{% set flood_list = vxlan_vlans.flood_vteps | join('<br/>') %} | |
{% endif %} | |
{% for idx in range(vlans | length) %} | |
| {{ vlans[idx] }} | {{ vlan_vni[idx] | arista.avd.default("-") }} | {{ flood_list | arista.avd.default("-") }} | {{ multicast_group }} | | |
{% endfor %} | |
{% endfor %} |
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 is not sorting the vlan ids in documentation which is hard to read when there are large no of vlans. Also if you add one more item {id:113, multicast_group:239.1.1.1} for host one, it creates a new row for vlan 113.
fff30e2
to
1ae28e3
Compare
Shall I add ability to set multicast_group on vlan ranges?
This will result in below commands:
|
79dfddc
to
33961f6
Compare
c04db11
to
4c907a0
Compare
Change Summary
Add support to set vlan and vni ranges in vxlan interface
Related Issue(s)
Fixes #4664
Component(s) name
arista.avd.eos_cli_config_gen
Proposed changes
Add support to set vlan and vni ranges in vxlan interface.
How to test
Checklist
User Checklist
Repository Checklist