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

Better handling of index error p2p_links nodes and other fields in core_interface / l3_edge schema #4727

Open
gmuloc opened this issue Nov 15, 2024 · 0 comments

Comments

@gmuloc
Copy link
Contributor

gmuloc commented Nov 15, 2024

  p2p_links:
    # Pe_P
    - nodes: [pe11-sav366, p11-brv350, pe11-sav366, p12-brv350]
      interfaces: [Ethernet43/1, Ethernet1/1, Ethernet44/1, Ethernet1/1]
      profile: pe_p_profile
      id: 1

This is accepted but fails sadly

The full traceback is:
Traceback (most recent call last):
  File "/home/arista/.ansible/collections/ansible_collections/arista/avd/plugins/action/eos_designs_structured_config.py", line 100, in run
    output = get_structured_config(
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/structured_config/__init__.py", line 96, in get_structured_config
    results = eos_designs_module.render()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/__init__.py", line 40, in render
    result_list.append(super().render())
                       ^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/avdfacts.py", line 64, in render
    return {key: getattr(self, key) for key in self.keys() if getattr(self, key) is not None}
                                                              ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/ethernet_interfaces.py", line 30, in ethernet_interfaces
    for p2p_link in self._filtered_p2p_links:
                    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/utils.py", line 67, in _filtered_p2p_links
    [p2p_link.update({"data": self._get_p2p_data(p2p_link)}) for p2p_link in p2p_links]
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arista/.local/share/pipx/venvs/pyavd/lib/python3.12/site-packages/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/utils.py", line 146, in _get_p2p_data
    "ip": ip[index],
          ~~^^^^^^^
IndexError: list index out of range
fatal: [p22-qzd516 -> localhost]: FAILED! => {
    "changed": false,
    "msg": "list index out of range"
}

First idea was to limit the llength in the list

@gmuloc gmuloc changed the title Add max length of 2 for p2p_links nodes and other fields in core_interface schema Add max _length of 2 for p2p_links nodes and other fields in core_interface / l3_edge schema Nov 15, 2024
@gmuloc gmuloc changed the title Add max _length of 2 for p2p_links nodes and other fields in core_interface / l3_edge schema Better handling of index error p2p_links nodes and other fields in core_interface / l3_edge schema Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant