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

Fix: Description key not considered with connected endpoints #2745

Merged
merged 14 commits into from Apr 28, 2023

Conversation

pvinci-arista
Copy link
Contributor

@pvinci-arista pvinci-arista commented Apr 19, 2023

Change Summary

description key under connected endpoints not used.

Related Issue(s)

Fixes #2744

Component(s) name

arista.avd.eos_designs

Proposed changes

How to test

molecule test

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)

@pvinci-arista pvinci-arista requested a review from a team as a code owner April 19, 2023 20:43
@github-actions github-actions bot added the state: CI Updated CI scenario have been updated in the PR label Apr 19, 2023
@pvinci-arista pvinci-arista changed the title Description key not considered with connected endpoints Fix: Description key not considered with connected endpoints Apr 19, 2023
@pvinci-arista pvinci-arista added the cherry-pick-for-3.8.x PR to be cherry-picked to releases/v3.8.x brach later label Apr 19, 2023
@github-actions github-actions bot added the role: eos_designs issue related to eos_designs role label Apr 20, 2023
@pvinci-arista pvinci-arista added the type: bug Something isn't working label Apr 20, 2023
Copy link
Contributor

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

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

Great catch - could you also please implement the same for Port-channels?

@@ -75,7 +75,7 @@ def _get_ethernet_interface_cfg(self, adapter: dict, node_index: int, connected_
"peer_interface": peer_interface,
"peer_type": connected_endpoint["type"],
"port_profile": adapter.get("profile"),
"description": self.shared_utils.interface_descriptions.connected_endpoints_ethernet_interfaces(peer, peer_interface),
"description": adapter.get("description") or self.shared_utils.interface_descriptions.connected_endpoints_ethernet_interfaces(peer, peer_interface),
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
"description": adapter.get("description") or self.shared_utils.interface_descriptions.connected_endpoints_ethernet_interfaces(peer, peer_interface),
"description": default(adapter.get("description"), self.shared_utils.interface_descriptions.connected_endpoints_ethernet_interfaces(peer, peer_interface)),

Comment on lines 1 to 35
loopback_ipv4_pool: 192.168.0.0/24

port_profiles:
common:
spanning_tree_portfast: edge
spanning_tree_bpduguard: true
storm_control:
all:
level: 1
desktop_phone-1234-2345:
parent_profile: common
mode: trunk phone
structured_config:
# profile: dot1x
phone:
trunk: tagged
vlan: "2345"
native_vlan: "1234"

type: l2leaf
l2leaf:
defaults:
nodes:
connected_endpoints:

servers:
OLD_SW-1/4:
adapters:
- switches: [connected_endpoints]
switch_ports: [Ethernet4]
profile: desktop_phone-1234-2345
description: VVxx:abcd123
native_vlan: 2020
raw_eos_cli: |-
!! VoIP/PC
Copy link
Contributor

Choose a reason for hiding this comment

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

can you limit even further the test?

@ClausHolbechArista
Copy link
Contributor

It was implemented as part of network_ports, where we want a more generic description, but makes perfect sense to include here as well. I would prefer to move the logic to the description module, so anyone customizing those keep full control. Similar to how it is done with port_channel_description.

@gmuloc
Copy link
Contributor

gmuloc commented Apr 20, 2023

It was implemented as part of network_ports, where we want a more generic description, but makes perfect sense to include here as well. I would prefer to move the logic to the description module, so anyone customizing those keep full control. Similar to how it is done with port_channel_description.

On this topic @ClausHolbechArista - should port-channel description also take into account this special description at the adapter level as currently it is doing <adapter_description>_<oprtional_port_channel_description>

@ClausHolbechArista
Copy link
Contributor

It was implemented as part of network_ports, where we want a more generic description, but makes perfect sense to include here as well. I would prefer to move the logic to the description module, so anyone customizing those keep full control. Similar to how it is done with port_channel_description.

On this topic @ClausHolbechArista - should port-channel description also take into account this special description at the adapter level as currently it is doing <adapter_description>_<oprtional_port_channel_description>

That would be good

@pvinci-arista
Copy link
Contributor Author

I would prefer to move the logic to the description module, so anyone customizing those keep full control. Similar to how it is done with port_channel_description.

If I follow, won't we need to modify the method signature in the base class and all the subclasses?

@gmuloc
Copy link
Contributor

gmuloc commented Apr 21, 2023

Hi @pvinci-arista so basically the suggestion is to add as an optional keyword argument the adapter.description key so that you don't break possible subclasses (though for now nobody has been using this functionality as it has not been officially released anyway).

Let's take the opportunity in this PR to also document better how the descriptions are built!

Let me know if you need some help

@gmuloc gmuloc closed this Apr 21, 2023
@gmuloc gmuloc reopened this Apr 21, 2023
@gmuloc gmuloc requested a review from a team April 27, 2023 16:11
@carlbuchmann carlbuchmann added this to the v4.0.0-dev11 milestone Apr 27, 2023
@gmuloc gmuloc requested a review from a team April 27, 2023 16:14
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

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

The fix looks good - As mentioned in one of the comments, we should add an explanation of how the descriptions are built for physical ports and port-channels.

@pvinci-arista
Copy link
Contributor Author

we should add an explanation of how the descriptions are built for physical ports and port-channels.

Docstrings were added to the methods. Do you want something additional? See, as an example: https://github.com/aristanetworks/ansible-avd/pull/2745/files#diff-bbfc03125089c9310eb2bebb44079e7849bbf1e5031bae6df3024d280c0f306dR94

@carlbuchmann
Copy link
Member

we should add an explanation of how the descriptions are built for physical ports and port-channels.

Docstrings were added to the methods. Do you want something additional? See, as an example: https://github.com/aristanetworks/ansible-avd/pull/2745/files#diff-bbfc03125089c9310eb2bebb44079e7849bbf1e5031bae6df3024d280c0f306dR94

We have added addition information in schema/documentation.

@carlbuchmann carlbuchmann self-requested a review April 28, 2023 13:19
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

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

LGTM

@gmuloc gmuloc merged commit 13210ba into aristanetworks:devel Apr 28, 2023
36 checks passed
@carlbuchmann carlbuchmann removed the cherry-pick-for-3.8.x PR to be cherry-picked to releases/v3.8.x brach later label May 12, 2023
gmuloc pushed a commit that referenced this pull request May 12, 2023
…2816)

Co-authored-by: pvinci-arista <102165259+pvinci-arista@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn: Fix role: eos_designs issue related to eos_designs role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Description key not considered with connected endpoints
4 participants