Skip to content

Commit

Permalink
Merge branch 'devel' into refactor/dot1-aaa-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc authored Feb 10, 2025
2 parents 416deff + 0c594b6 commit eeae0f7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 36 deletions.
2 changes: 1 addition & 1 deletion ansible_collections/arista/avd/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace: arista
name: avd

# The version of the collection. Must be compatible with semantic versioning
version: 5.2.0
version: 5.3.0-dev0
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

Expand Down
2 changes: 1 addition & 1 deletion ansible_collections/arista/avd/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# PyAVD must follow the exact same version as the Ansible collection.
# For development this should be installed as an editable install as specified in requirement-dev.txt
pyavd[ansible-collection]==5.2.0
pyavd[ansible-collection]==5.3.0.dev0
2 changes: 1 addition & 1 deletion python-avd/pyavd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
__author__ = "Arista Networks"
__copyright__ = "Copyright 2023-2024 Arista Networks"
__license__ = "Apache 2.0"
__version__ = "5.2.0"
__version__ = "5.3.0.dev0"

__all__ = [
"ValidationResult",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# that can be found in the LICENSE file.
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING, Protocol

from pyavd._eos_designs.structured_config.structured_config_generator import structured_config_contributor

if TYPE_CHECKING:
from . import AvdStructuredConfigNetworkServicesProtocol

Expand All @@ -17,14 +18,12 @@ class IpVirtualRouterMacAddressMixin(Protocol):
Class should only be used as Mixin to a AvdStructuredConfig class.
"""

@cached_property
def ip_virtual_router_mac_address(self: AvdStructuredConfigNetworkServicesProtocol) -> str | None:
"""Return structured config for ip_virtual_router_mac_address."""
@structured_config_contributor
def ip_virtual_router_mac_address(self: AvdStructuredConfigNetworkServicesProtocol) -> None:
"""Set the structured config for ip_virtual_router_mac_address."""
if (
self.shared_utils.network_services_l2
and self.shared_utils.network_services_l3
and self.shared_utils.node_config.virtual_router_mac_address is not None
):
return str(self.shared_utils.node_config.virtual_router_mac_address).lower()

return None
self.structured_config.ip_virtual_router_mac_address = str(self.shared_utils.node_config.virtual_router_mac_address).lower()
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# that can be found in the LICENSE file.
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING, Protocol

from pyavd._eos_designs.structured_config.structured_config_generator import structured_config_contributor

if TYPE_CHECKING:
from . import AvdStructuredConfigOverlayProtocol

Expand All @@ -17,10 +18,10 @@ class RouterTrafficEngineering(Protocol):
Class should only be used as Mixin to a AvdStructuredConfig class.
"""

@cached_property
def router_traffic_engineering(self: AvdStructuredConfigOverlayProtocol) -> dict | None:
"""Return structured config for router traffic-engineering."""
@structured_config_contributor
def router_traffic_engineering(self: AvdStructuredConfigOverlayProtocol) -> None:
"""Set the structured config for router traffic-engineering."""
if not self.shared_utils.is_cv_pathfinder_router:
return None
return

return {"enabled": True}
self.structured_config.router_traffic_engineering.enabled = True
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# that can be found in the LICENSE file.
from __future__ import annotations

from functools import cached_property
from typing import TYPE_CHECKING, Protocol

from pyavd._eos_cli_config_gen.schema import EosCliConfigGen
from pyavd._eos_designs.structured_config.structured_config_generator import structured_config_contributor
from pyavd._utils import get
from pyavd.j2filters import natural_sort

Expand All @@ -20,18 +21,18 @@ class RouterMsdpMixin(Protocol):
Class should only be used as Mixin to a AvdStructuredConfig class.
"""

@cached_property
def router_msdp(self: AvdStructuredConfigUnderlayProtocol) -> dict | None:
@structured_config_contributor
def router_msdp(self: AvdStructuredConfigUnderlayProtocol) -> None:
"""
Return structured config for router_msdp.
Set the structured config for router_msdp.
Used for to configure multicast anycast RPs for the underlay
"""
if not self.shared_utils.underlay_multicast or not self.inputs.underlay_multicast_rps:
return None
return

if self.inputs.underlay_multicast_anycast_rp.mode != "msdp":
return None
return

peers = set()
for rp_entry in self.inputs.underlay_multicast_rps:
Expand All @@ -42,17 +43,13 @@ def router_msdp(self: AvdStructuredConfigUnderlayProtocol) -> dict | None:
peers.update(node.name for node in rp_entry.nodes if node.name != self.shared_utils.hostname)

if not peers:
return None

return {
"originator_id_local_interface": "Loopback0",
"peers": [
{
"ipv4_address": get(self.shared_utils.get_peer_facts(peer), "router_id", required=True),
"local_interface": "Loopback0",
"description": peer,
"mesh_groups": [{"name": "ANYCAST-RP"}],
}
for peer in natural_sort(peers)
],
}
return

self.structured_config.router_msdp.originator_id_local_interface = "Loopback0"
for peer in natural_sort(peers):
self.structured_config.router_msdp.peers.append_new(
ipv4_address=get(self.shared_utils.get_peer_facts(peer), "router_id", required=True),
local_interface="Loopback0",
description=peer,
mesh_groups=EosCliConfigGen.RouterMsdp.PeersItem.MeshGroups([EosCliConfigGen.RouterMsdp.PeersItem.MeshGroupsItem(name="ANYCAST-RP")]),
)

0 comments on commit eeae0f7

Please sign in to comment.