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(eos_designs): Avoid returning objects in facts #5016

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python-avd/pyavd/_eos_designs/eos_designs_facts/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def evpn_route_servers(self: EosDesignsFactsProtocol) -> list:
"""
if self.shared_utils.underlay_router is True:
if self.evpn_role == "client":
return self.shared_utils.node_config.evpn_route_servers or self.shared_utils.uplink_switches
return self.shared_utils.node_config.evpn_route_servers
return self.shared_utils.node_config.evpn_route_servers._as_list() or self.shared_utils.uplink_switches
return self.shared_utils.node_config.evpn_route_servers._as_list()
return []

@cached_property
Expand All @@ -48,7 +48,7 @@ def mpls_route_reflectors(self: EosDesignsFactsProtocol) -> list | None:
if self.shared_utils.underlay_router is True and (
self.mpls_overlay_role in ["client", "server"] or (self.evpn_role in ["client", "server"] and self.overlay["evpn_mpls"])
):
return self.shared_utils.node_config.mpls_route_reflectors
return self.shared_utils.node_config.mpls_route_reflectors._as_list()
return None

@cached_property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
import json
from copy import deepcopy

import pytest
Expand Down Expand Up @@ -39,3 +40,5 @@ def test_get_avd_facts(molecule_scenario: MoleculeScenario) -> None:
assert isinstance(avd_facts["avd_overlay_peers"], dict)
assert "avd_topology_peers" in avd_facts
assert isinstance(avd_facts["avd_topology_peers"], dict)
# Test that we can dump the returned data as json.
assert json.dumps(avd_facts)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) 2023-2025 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
import json
from copy import deepcopy

import pytest
Expand Down Expand Up @@ -40,3 +41,5 @@ def test_get_device_structured_config(molecule_host: MoleculeHost) -> None:
assert isinstance(structured_config, dict)
assert molecule_host.name == structured_config["hostname"]
assert expected_structured_config == structured_config
# Test that we can dump the returned data as json.
assert json.dumps(structured_config)