Skip to content

Commit c314c77

Browse files
petercrockerclaude
andcommitted
Fix Cisco spine template BGP configuration
- Pass both bgp (flattened) and bgp_profiles (original list) to templates - Update Cisco spine template to use bgp_profiles instead of bgp - Cisco template expects list of profile objects with nested structure - Arista/Juniper templates continue using flattened bgp dict 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6bcc050 commit c314c77

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

templates/configs/spines/cisco_nxos.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ router ospf {{ ospf_config.process_id }}
5050
{%- endfor %}
5151
!
5252
! BGP Configuration
53-
{%- for bgp_config in bgp %}
53+
{%- for bgp_config in bgp_profiles %}
5454
router bgp {{ bgp_config.local_as.asn }}
5555
router-id {{ bgp_config.router_id.address.split('/')[0] }}
5656
{%- if bgp_config.graceful_restart %}

transforms/spine.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ async def transform(self, data: Any) -> Any:
4242
# Extract first OSPF config or use empty dict
4343
ospf = ospf_configs[0] if ospf_configs else {}
4444

45-
# Restructure BGP data for template
46-
# Template expects: bgp.local_as, bgp.router_id, bgp.neighbors
45+
# Create both flattened BGP dict (for Arista/Juniper templates)
46+
# and pass original bgp_profiles list (for Cisco template)
4747
bgp = {}
4848
if bgp_profiles:
4949
# Get common BGP settings from first profile
@@ -69,7 +69,8 @@ async def transform(self, data: Any) -> Any:
6969

7070
config = {
7171
"hostname": data.get("name"),
72-
"bgp": bgp,
72+
"bgp": bgp, # Flattened dict for Arista/Juniper/SONiC templates
73+
"bgp_profiles": bgp_profiles, # Original list for Cisco template
7374
"ospf": ospf,
7475
"interface_roles": get_interface_roles(data.get("interfaces")),
7576
"loopbacks": get_loopbacks(data.get("interfaces")),

0 commit comments

Comments
 (0)