Skip to content

Commit

Permalink
Refactor(eos_designs): structured_config for agents (aristanetworks#4975
Browse files Browse the repository at this point in the history
)

Co-authored-by: laxmikantchintakindi <[email protected]>
Co-authored-by: Shivani-gslab <[email protected]>
Co-authored-by: Guillaume Mulocher <[email protected]>
  • Loading branch information
4 people authored Feb 5, 2025
1 parent 0dc8ba1 commit 70af94c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions python-avd/pyavd/_eos_designs/structured_config/underlay/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# 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

if TYPE_CHECKING:
from . import AvdStructuredConfigUnderlayProtocol

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

@cached_property
def agents(self: AvdStructuredConfigUnderlayProtocol) -> list | None:
"""Return structured config for agents."""
@structured_config_contributor
def agents(self: AvdStructuredConfigUnderlayProtocol) -> None:
"""Set the structured config for agents."""
if not self.shared_utils.is_wan_router:
return None
return

return [
{"name": "KernelFib", "environment_variables": [{"name": "KERNELFIB_PROGRAM_ALL_ECMP", "value": "1"}]},
]
agent = EosCliConfigGen.AgentsItem(name="KernelFib")
agent.environment_variables.append_new(name="KERNELFIB_PROGRAM_ALL_ECMP", value="1")
self.structured_config.agents.append(agent)

0 comments on commit 70af94c

Please sign in to comment.