diff --git a/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_BGP_VTEP_ROUTER_ID.yml b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_BGP_VTEP_ROUTER_ID.yml new file mode 100644 index 00000000000..2ffeb76406b --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_BGP_VTEP_ROUTER_ID.yml @@ -0,0 +1,36 @@ +l3leaf: + defaults: + loopback_ipv4_pool: 10.42.0.0/24 + vtep_loopback_ipv4_pool: 10.43.0.0/24 + mlag_interfaces: [ Ethernet5, Ethernet6 ] + mlag_peer_ipv4_pool: 10.255.252.0/24 + mlag_peer_l3_ipv4_pool: 10.255.251.0/24 + + node_groups: + - group: vrf-router-id + nodes: + - name: vrf-bgp-vtep-router-id + bgp_as: 42 + id: 42 + +type: l3leaf + +tenants: + # Tenant A Specific Information - VRFs / VLANs + - name: Tenant_X + mac_vrf_vni_base: 11000 + vrfs: + - name: Tenant_X_OP_Zone + vrf_id: 20 + svis: + - id: 310 + name: Tenant_X_OP_Zone_1 + tags: [opzone] + enabled: true + bgp: + router_id: diagnostic_loopback + +expected_error_message: >- + Invalid configuration on VRF 'Tenant_X_OP_Zone' in Tenant 'Tenant_X'. + 'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined + when 'router_id' is set to 'diagnostic_loopback' on the VRF. diff --git a/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_OSPF_VTEP_ROUTER_ID.yml b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_OSPF_VTEP_ROUTER_ID.yml new file mode 100644 index 00000000000..9519062503f --- /dev/null +++ b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/group_vars/VRF_OSPF_VTEP_ROUTER_ID.yml @@ -0,0 +1,37 @@ +l3leaf: + defaults: + loopback_ipv4_pool: 10.42.0.0/24 + vtep_loopback_ipv4_pool: 10.43.0.0/24 + mlag_interfaces: [ Ethernet5, Ethernet6 ] + mlag_peer_ipv4_pool: 10.255.252.0/24 + mlag_peer_l3_ipv4_pool: 10.255.251.0/24 + + node_groups: + - group: vrf-router-id + nodes: + - name: vrf-ospf-vtep-router-id + bgp_as: 42 + id: 42 + +type: l3leaf + +tenants: + # Tenant A Specific Information - VRFs / VLANs + - name: Tenant_X + mac_vrf_vni_base: 11000 + vrfs: + - name: Tenant_X_OP_Zone + vrf_id: 20 + svis: + - id: 310 + name: Tenant_X_OP_Zone_1 + tags: [opzone] + enabled: true + ospf: + enabled: true + router_id: diagnostic_loopback + +expected_error_message: >- + Invalid configuration on VRF 'Tenant_X_OP_Zone' in Tenant 'Tenant_X'. + 'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined + when 'router_id' is set to 'diagnostic_loopback' on the VRF. diff --git a/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/hosts.yml b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/hosts.yml index 9ec68dcf98c..84626420737 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/hosts.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_negative_unit_tests/inventory/hosts.yml @@ -148,6 +148,12 @@ all: hosts: duplicate-vlans-mlag-a: duplicate-vlans-mlag-b: + VRF_BGP_VTEP_ROUTER_ID: + hosts: + vrf-bgp-vtep-router-id: + VRF_OSPF_VTEP_ROUTER_ID: + hosts: + vrf-ospf-vtep-router-id: EOS_DESIGNS_FAILURES_EXCLUDED: # These hosts are included in the vars and facts, but will not be included in the structured config run, diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1B.cfg index b9d72a16f4e..ce591245e29 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1B.cfg @@ -477,7 +477,6 @@ router bgp 65105 router-id 192.168.255.15 ! router ospf 14 vrf Tenant_A_WAN_Zone - router-id 192.168.255.15 passive-interface default no passive-interface Vlan150 redistribute bgp diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF1A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF1A.cfg index f5f5aa5a392..53f396779e1 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF1A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF1A.cfg @@ -375,7 +375,6 @@ router bgp 65101 rd 1.1.1.1:12 route-target import evpn 1234:12 route-target export evpn 1234:12 - router-id 192.168.42.42 redistribute connected ! vrf Tenant_A_OP_Zone @@ -394,7 +393,7 @@ router bgp 65101 redistribute connected ! router ospf 9 vrf Tenant_A_OP_Zone - router-id 192.168.42.42 + router-id 10.10.10.10 passive-interface default no passive-interface Vlan113 redistribute bgp diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg index 2cc47494930..7d1ffeda879 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2A.cfg @@ -822,14 +822,13 @@ router bgp 65102 rd 65001:12 route-target import evpn 100000:12 route-target export evpn 100000:12 - router-id 192.168.255.10 redistribute connected ! vrf Tenant_A_DB_Zone rd 65001:13 route-target import evpn 100000:13 route-target export evpn 100000:13 - router-id 192.168.255.10 + router-id 11.11.11.11 redistribute connected ! vrf Tenant_A_OP_Zone @@ -877,7 +876,7 @@ router bgp 65102 redistribute static ! router ospf 16 vrf Tenant_A_OSPF - router-id 192.168.255.10 + router-id 10.255.11.10 passive-interface default no passive-interface Ethernet22 no passive-interface Ethernet23 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg index 7ff1a8051cb..4fdf39c7007 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-LEAF2B.cfg @@ -786,14 +786,13 @@ router bgp 65102 rd 65001:12 route-target import evpn 100000:12 route-target export evpn 100000:12 - router-id 192.168.255.11 redistribute connected ! vrf Tenant_A_DB_Zone rd 65001:13 route-target import evpn 100000:13 route-target export evpn 100000:13 - router-id 192.168.255.11 + router-id 11.11.11.11 redistribute connected ! vrf Tenant_A_OP_Zone @@ -841,7 +840,7 @@ router bgp 65102 redistribute static ! router ospf 16 vrf Tenant_A_OSPF - router-id 192.168.255.11 + router-id 10.255.11.11 passive-interface default no passive-interface Ethernet24 redistribute bgp diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg index 1c26eff7e99..be47852bd6c 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3A.cfg @@ -1098,7 +1098,6 @@ router bgp 65103 rd 65103:12 route-target import evpn 12:12 route-target export evpn 12:12 - router-id 192.168.255.12 update wait-install neighbor 10.255.251.7 peer group MLAG-PEERS neighbor 10.255.251.7 description DC1-SVC3B @@ -1108,7 +1107,7 @@ router bgp 65103 rd 65103:13 route-target import evpn 13:13 route-target export evpn 13:13 - router-id 192.168.255.12 + router-id 11.11.11.11 update wait-install neighbor 10.255.251.7 peer group MLAG-PEERS neighbor 10.255.251.7 description DC1-SVC3B diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg index ae0e1c3b85a..def4973d53b 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-SVC3B.cfg @@ -1062,7 +1062,6 @@ router bgp 65103 rd 65103:12 route-target import evpn 12:12 route-target export evpn 12:12 - router-id 192.168.255.13 update wait-install neighbor 10.255.251.6 peer group MLAG-PEERS neighbor 10.255.251.6 description DC1-SVC3A @@ -1072,7 +1071,7 @@ router bgp 65103 rd 65103:13 route-target import evpn 13:13 route-target export evpn 13:13 - router-id 192.168.255.13 + router-id 11.11.11.11 update wait-install neighbor 10.255.251.6 peer group MLAG-PEERS neighbor 10.255.251.6 description DC1-SVC3A diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1A.cfg index 9d0fdf68148..ad140e51238 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1A.cfg @@ -656,7 +656,6 @@ router bgp 65110 rd 192.168.255.21:12 route-target import evpn 12:12 route-target export evpn 12:12 - router-id 192.168.255.21 update wait-install neighbor 10.255.251.25 peer group MLAG-PEERS neighbor 10.255.251.25 description DC1_UNDEPLOYED_LEAF1B @@ -666,7 +665,7 @@ router bgp 65110 rd 192.168.255.21:13 route-target import evpn 13:13 route-target export evpn 13:13 - router-id 192.168.255.21 + router-id 11.11.11.11 update wait-install neighbor 10.255.251.25 peer group MLAG-PEERS neighbor 10.255.251.25 description DC1_UNDEPLOYED_LEAF1B diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1B.cfg index eb9d4e39717..594c53dec7a 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1_UNDEPLOYED_LEAF1B.cfg @@ -656,7 +656,6 @@ router bgp 65111 rd 192.168.255.22:12 route-target import evpn 12:12 route-target export evpn 12:12 - router-id 192.168.255.22 update wait-install neighbor 10.255.251.24 peer group MLAG-PEERS neighbor 10.255.251.24 description DC1_UNDEPLOYED_LEAF1A @@ -666,7 +665,7 @@ router bgp 65111 rd 192.168.255.22:13 route-target import evpn 13:13 route-target export evpn 13:13 - router-id 192.168.255.22 + router-id 11.11.11.11 update wait-install neighbor 10.255.251.24 peer group MLAG-PEERS neighbor 10.255.251.24 description DC1_UNDEPLOYED_LEAF1A diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1A.cfg index bb6d7f4616c..7969db0bbd5 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1A.cfg @@ -423,7 +423,7 @@ router bgp 65151 rd 192.168.255.33:20 route-target import evpn 20:20 route-target export evpn 20:20 - router-id 192.168.255.33 + router-id 10.255.1.33 redistribute connected ! end diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1B.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1B.cfg index e759e28453a..06de2e9c6f7 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1B.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF1B.cfg @@ -423,7 +423,7 @@ router bgp 65152 rd 192.168.255.34:20 route-target import evpn 20:20 route-target export evpn 20:20 - router-id 192.168.255.34 + router-id 10.255.1.34 redistribute connected ! end diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF2A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF2A.cfg index 2dafa6ac6f7..164aee24c23 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF2A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/MH-LEAF2A.cfg @@ -228,7 +228,7 @@ router bgp 65153 rd 192.168.255.35:20 route-target import evpn 20:20 route-target export evpn 20:20 - router-id 192.168.255.35 + router-id 10.255.1.35 redistribute connected ! end diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/evpn_services_l2_only_false.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/evpn_services_l2_only_false.cfg index f0ca27b1e09..4af46f64bf5 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/evpn_services_l2_only_false.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/evpn_services_l2_only_false.cfg @@ -659,14 +659,13 @@ router bgp 101 rd 192.168.255.109:12 route-target import evpn 12:12 route-target export evpn 12:12 - router-id 192.168.255.109 redistribute connected ! vrf Tenant_A_DB_Zone rd 192.168.255.109:13 route-target import evpn 13:13 route-target export evpn 13:13 - router-id 192.168.255.109 + router-id 11.11.11.11 redistribute connected ! vrf Tenant_A_ERP_Zone diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1B.yml index c5a90f4d711..a5525f6f072 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1B.yml @@ -595,7 +595,6 @@ router_ospf: - id: 14 vrf: Tenant_A_WAN_Zone passive_interface_default: true - router_id: 192.168.255.15 no_passive_interfaces: - Vlan150 max_lsa: 15000 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF1A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF1A.yml index 483f8da16b2..f5590dc36fb 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF1A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF1A.yml @@ -339,7 +339,6 @@ router_bgp: - address_family: evpn route_targets: - '1234:12' - router_id: 192.168.42.42 redistribute: connected: enabled: true @@ -395,7 +394,7 @@ router_ospf: - id: 9 vrf: Tenant_A_OP_Zone passive_interface_default: true - router_id: 192.168.42.42 + router_id: 10.10.10.10 no_passive_interfaces: - Vlan113 redistribute: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2A.yml index 4f559feb19d..d6b357c8f85 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2A.yml @@ -748,7 +748,6 @@ router_bgp: - address_family: evpn route_targets: - '100000:12' - router_id: 192.168.255.10 redistribute: connected: enabled: true @@ -763,7 +762,7 @@ router_bgp: - address_family: evpn route_targets: - '100000:13' - router_id: 192.168.255.10 + router_id: 11.11.11.11 redistribute: connected: enabled: true @@ -881,7 +880,7 @@ router_ospf: - id: 16 vrf: Tenant_A_OSPF passive_interface_default: true - router_id: 192.168.255.10 + router_id: 10.255.11.10 no_passive_interfaces: - Ethernet22 - Ethernet23 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2B.yml index f5de3e6a894..194bd2530da 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-LEAF2B.yml @@ -688,7 +688,6 @@ router_bgp: - address_family: evpn route_targets: - '100000:12' - router_id: 192.168.255.11 redistribute: connected: enabled: true @@ -703,7 +702,7 @@ router_bgp: - address_family: evpn route_targets: - '100000:13' - router_id: 192.168.255.11 + router_id: 11.11.11.11 redistribute: connected: enabled: true @@ -821,7 +820,7 @@ router_ospf: - id: 16 vrf: Tenant_A_OSPF passive_interface_default: true - router_id: 192.168.255.11 + router_id: 10.255.11.11 no_passive_interfaces: - Ethernet24 redistribute: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml index 1a6be73b779..e2eecd280cf 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3A.yml @@ -1101,7 +1101,6 @@ router_bgp: - address_family: evpn route_targets: - '12:12' - router_id: 192.168.255.12 updates: wait_install: true neighbors: @@ -1122,7 +1121,7 @@ router_bgp: - address_family: evpn route_targets: - '13:13' - router_id: 192.168.255.12 + router_id: 11.11.11.11 updates: wait_install: true neighbors: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml index 65f248f722a..fddd73cac17 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-SVC3B.yml @@ -1047,7 +1047,6 @@ router_bgp: - address_family: evpn route_targets: - '12:12' - router_id: 192.168.255.13 updates: wait_install: true neighbors: @@ -1068,7 +1067,7 @@ router_bgp: - address_family: evpn route_targets: - '13:13' - router_id: 192.168.255.13 + router_id: 11.11.11.11 updates: wait_install: true neighbors: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1A.yml index 149afd667d0..dcafe9a8924 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1A.yml @@ -443,7 +443,6 @@ router_bgp: - address_family: evpn route_targets: - '12:12' - router_id: 192.168.255.21 updates: wait_install: true neighbors: @@ -464,7 +463,7 @@ router_bgp: - address_family: evpn route_targets: - '13:13' - router_id: 192.168.255.21 + router_id: 11.11.11.11 updates: wait_install: true neighbors: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1B.yml index b723c78aa2a..1b782722224 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1_UNDEPLOYED_LEAF1B.yml @@ -443,7 +443,6 @@ router_bgp: - address_family: evpn route_targets: - '12:12' - router_id: 192.168.255.22 updates: wait_install: true neighbors: @@ -464,7 +463,7 @@ router_bgp: - address_family: evpn route_targets: - '13:13' - router_id: 192.168.255.22 + router_id: 11.11.11.11 updates: wait_install: true neighbors: diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1A.yml index 0ef33c93505..04034f395ed 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1A.yml @@ -554,7 +554,7 @@ router_bgp: - address_family: evpn route_targets: - '20:20' - router_id: 192.168.255.33 + router_id: 10.255.1.33 redistribute: connected: enabled: true diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1B.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1B.yml index 05947f02736..2a0dbad98eb 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1B.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF1B.yml @@ -554,7 +554,7 @@ router_bgp: - address_family: evpn route_targets: - '20:20' - router_id: 192.168.255.34 + router_id: 10.255.1.34 redistribute: connected: enabled: true diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF2A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF2A.yml index 7ba6f9eee23..b7242442049 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF2A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/MH-LEAF2A.yml @@ -290,7 +290,7 @@ router_bgp: - address_family: evpn route_targets: - '20:20' - router_id: 192.168.255.35 + router_id: 10.255.1.35 redistribute: connected: enabled: true diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/evpn_services_l2_only_false.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/evpn_services_l2_only_false.yml index 0031bb9ab0e..6641bbb0715 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/evpn_services_l2_only_false.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/evpn_services_l2_only_false.yml @@ -327,7 +327,6 @@ router_bgp: - address_family: evpn route_targets: - '12:12' - router_id: 192.168.255.109 redistribute: connected: enabled: true @@ -342,7 +341,7 @@ router_bgp: - address_family: evpn route_targets: - '13:13' - router_id: 192.168.255.109 + router_id: 11.11.11.11 redistribute: connected: enabled: true diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_TENANTS_NETWORKS/Tenant_A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_TENANTS_NETWORKS/Tenant_A.yml index 71dbba27089..34642be4061 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_TENANTS_NETWORKS/Tenant_A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/DC1_TENANTS_NETWORKS/Tenant_A.yml @@ -57,6 +57,7 @@ tenant_a: key: "AQQvKeimxJu+uGQ/yYvv9w==" ospf: enabled: true + router_id: 10.10.10.10 nodes: - DC1-LEAF1A - name: Tenant_A_WEB_Zone @@ -112,6 +113,8 @@ tenant_a: - 10.1.32.254 - 10.2.32.254/24 - 10.3.32.254/24 + bgp: + router_id: none - name: Tenant_A_DB_Zone vrf_vni: 13 svis: @@ -125,10 +128,13 @@ tenant_a: tags: ['db'] enabled: true ip_address_virtual: 10.1.41.1/24 + bgp: + router_id: 11.11.11.11 - name: Tenant_A_WAN_Zone vrf_id: 14 ospf: enabled: true + router_id: none max_lsa: 15000 redistribute_bgp: enabled: true @@ -281,6 +287,7 @@ tenant_a: vrf_id: 16 ospf: enabled: true + router_id: diagnostic_loopback l3_interfaces: - interfaces: - Ethernet22 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/MH_TENANT_NETWORKS.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/MH_TENANT_NETWORKS.yml index 8d945b3baf7..1bfb4361ded 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/MH_TENANT_NETWORKS.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/group_vars/MH_TENANT_NETWORKS.yml @@ -17,6 +17,8 @@ tenants: tags: [opzone] enabled: true ip_address_virtual: 10.1.10.1/24 + bgp: + router_id: diagnostic_loopback - name: default vrf_id: 21 svis: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/fabric-settings.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/fabric-settings.md index a5873d6bbe7..b1971c60b8e 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/fabric-settings.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/fabric-settings.md @@ -55,6 +55,7 @@ | [underlay_routing_protocol](## "underlay_routing_protocol") | String | | | Value is converted to lower case.
Valid Values:
- ebgp
- ospf
- ospf-ldp
- isis
- isis-sr
- isis-ldp
- isis-sr-ldp
- none | - The following underlay routing protocols are supported:
- EBGP (default for l3ls-evpn)
- OSPF.
- OSPF-LDP*.
- ISIS.
- ISIS-SR*.
- ISIS-LDP*.
- ISIS-SR-LDP*.
- No underlay routing protocol (none)
- The variables should be applied to all devices in the fabric.
*Only supported with core_interfaces data model.
| | [uplink_ptp](## "uplink_ptp") | Dictionary | | | | Enable PTP on all infrastructure links. | | [  enable](## "uplink_ptp.enable") | Boolean | | `False` | | | + | [use_router_general_for_router_id](## "use_router_general_for_router_id") | Boolean | | `False` | | Use `router general` to set router ID for all routing protocols and VRFs. | === "YAML" @@ -348,4 +349,7 @@ # Enable PTP on all infrastructure links. uplink_ptp: enable: + + # Use `router general` to set router ID for all routing protocols and VRFs. + use_router_general_for_router_id: ``` diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-ospf-settings.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-ospf-settings.md index 55b39fed32c..a8fc28396bf 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-ospf-settings.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-ospf-settings.md @@ -14,7 +14,7 @@ | [        ospf](## ".[].vrfs.[].ospf") | Dictionary | | | | Router OSPF configuration.
This will create an OSPF routing instance in the tenant VRF. If there is no nodes definition, the OSPF instance will be
created on all leafs where the VRF is deployed. This will also cause automatic OSPF redistribution into BGP unless
explicitly turned off with "redistribute_ospf: false".
| | [          enabled](## ".[].vrfs.[].ospf.enabled") | Boolean | | | | | | [          process_id](## ".[].vrfs.[].ospf.process_id") | Integer | | | | If not set, "vrf_id" will be used. | - | [          router_id](## ".[].vrfs.[].ospf.router_id") | String | | | | If not set, switch router_id will be used. | + | [          router_id](## ".[].vrfs.[].ospf.router_id") | String | | `main_router_id` | | Router ID to use for OSPF in this VRF.
This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback".
- "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set."
- "none" will not configure a OSPF Router ID for this VRF. EOS will use the main OSPF Router ID.
- "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. | | [          max_lsa](## ".[].vrfs.[].ospf.max_lsa") | Integer | | | | | | [          bfd](## ".[].vrfs.[].ospf.bfd") | Boolean | | `False` | | | | [          redistribute_bgp](## ".[].vrfs.[].ospf.redistribute_bgp") | Dictionary | | | | | @@ -110,8 +110,12 @@ # If not set, "vrf_id" will be used. process_id: - # If not set, switch router_id will be used. - router_id: + # Router ID to use for OSPF in this VRF. + # This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + # - "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set." + # - "none" will not configure a OSPF Router ID for this VRF. EOS will use the main OSPF Router ID. + # - "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. + router_id: max_lsa: bfd: redistribute_bgp: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-settings.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-settings.md index b7826c75c84..9c2e527512b 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-settings.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/network-services-vrfs-settings.md @@ -64,6 +64,7 @@ | [        redistribute_connected](## ".[].vrfs.[].redistribute_connected") | Boolean | | `True` | | Enable or disable the redistribution of all connected routes to BGP in the VRF. Note this is not applicable to VRF `default`. | | [        bgp](## ".[].vrfs.[].bgp") | Dictionary | | | | | | [          enabled](## ".[].vrfs.[].bgp.enabled") | Boolean | | | | Force (no) configuration of BGP for the VRF.
If not set, BGP will be configured when needed according to the following rules:
- If the VRF is part of an overlay (`evpn` or `mpls`), BGP will be configured for it.
- If any BGP peers are configured under the VRF, BGP will be configured for it. This is useful for L2LS designs with VRFs.
- If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it. | + | [          router_id](## ".[].vrfs.[].bgp.router_id") | String | | `main_router_id` | | Router ID to use for BGP in this VRF.
This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback".
- "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set."
- "none" will not configure a BGP Router ID for this VRF. EOS will use the main BGP Router ID.
- "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. | | [          raw_eos_cli](## ".[].vrfs.[].bgp.raw_eos_cli") | String | | | | EOS CLI rendered directly on the Router BGP, VRF definition in the final EOS configuration.
| | [          structured_config](## ".[].vrfs.[].bgp.structured_config") | Dictionary | | | | Custom structured config added under router_bgp.vrfs.[name=] for eos_cli_config_gen. | | [        additional_route_targets](## ".[].vrfs.[].additional_route_targets") | List, items: Dictionary | | | | Configuration of extra route-targets for this VRF. Useful for route-leaking or gateway between address families. | @@ -278,6 +279,13 @@ # - If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it. enabled: + # Router ID to use for BGP in this VRF. + # This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + # - "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set." + # - "none" will not configure a BGP Router ID for this VRF. EOS will use the main BGP Router ID. + # - "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. + router_id: + # EOS CLI rendered directly on the Router BGP, VRF definition in the final EOS configuration. raw_eos_cli: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/use-router-general-for-router-id.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/use-router-general-for-router-id.md deleted file mode 100644 index c2ed0c30898..00000000000 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/use-router-general-for-router-id.md +++ /dev/null @@ -1,17 +0,0 @@ - -=== "Table" - - | Variable | Type | Required | Default | Value Restrictions | Description | - | -------- | ---- | -------- | ------- | ------------------ | ----------- | - | [use_router_general_for_router_id](## "use_router_general_for_router_id") | Boolean | | `False` | | Use `router general` to set router ID for all routing protocols and VRFs. | - -=== "YAML" - - ```yaml - # Use `router general` to set router ID for all routing protocols and VRFs. - use_router_general_for_router_id: - ``` diff --git a/python-avd/pyavd/_eos_designs/schema/__init__.py b/python-avd/pyavd/_eos_designs/schema/__init__.py index 8cbf44b4dbf..27ceb37c717 100644 --- a/python-avd/pyavd/_eos_designs/schema/__init__.py +++ b/python-avd/pyavd/_eos_designs/schema/__init__.py @@ -35034,7 +35034,7 @@ class Nodes(AvdList[str]): _fields: ClassVar[dict] = { "enabled": {"type": bool}, "process_id": {"type": int}, - "router_id": {"type": str}, + "router_id": {"type": str, "default": "main_router_id"}, "max_lsa": {"type": int}, "bfd": {"type": bool, "default": False}, "redistribute_bgp": {"type": RedistributeBgp}, @@ -35045,8 +35045,20 @@ class Nodes(AvdList[str]): enabled: bool | None process_id: int | None """If not set, "vrf_id" will be used.""" - router_id: str | None - """If not set, switch router_id will be used.""" + router_id: str + """ + Router ID to use for OSPF in this VRF. + This can be an IPv4 address, "main_router_id", "none" or + "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router + general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a OSPF + Router ID for this VRF. EOS will use the main OSPF Router ID. + - "diagnostic_loopback" will use the + IP address of the VRF Diagnostic Loopback interface. + + Default value: `"main_router_id"` + """ max_lsa: int | None bfd: bool """Default value: `False`""" @@ -35065,7 +35077,7 @@ def __init__( *, enabled: bool | None | UndefinedType = Undefined, process_id: int | None | UndefinedType = Undefined, - router_id: str | None | UndefinedType = Undefined, + router_id: str | UndefinedType = Undefined, max_lsa: int | None | UndefinedType = Undefined, bfd: bool | UndefinedType = Undefined, redistribute_bgp: RedistributeBgp | UndefinedType = Undefined, @@ -35082,7 +35094,16 @@ def __init__( Args: enabled: enabled process_id: If not set, "vrf_id" will be used. - router_id: If not set, switch router_id will be used. + router_id: + Router ID to use for OSPF in this VRF. + This can be an IPv4 address, "main_router_id", "none" or + "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router + general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a OSPF + Router ID for this VRF. EOS will use the main OSPF Router ID. + - "diagnostic_loopback" will use the + IP address of the VRF Diagnostic Loopback interface. max_lsa: max_lsa bfd: bfd redistribute_bgp: Subclass of AvdModel. @@ -37769,6 +37790,7 @@ class StructuredConfig(EosCliConfigGen.RouterBgp.VrfsItem): _fields: ClassVar[dict] = { "enabled": {"type": bool}, + "router_id": {"type": str, "default": "main_router_id"}, "raw_eos_cli": {"type": str}, "structured_config": {"type": StructuredConfig}, "_custom_data": {"type": dict}, @@ -37785,6 +37807,20 @@ class StructuredConfig(EosCliConfigGen.RouterBgp.VrfsItem): - If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it. """ + router_id: str + """ + Router ID to use for BGP in this VRF. + This can be an IPv4 address, "main_router_id", "none" or + "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router + general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a BGP + Router ID for this VRF. EOS will use the main BGP Router ID. + - "diagnostic_loopback" will use the IP + address of the VRF Diagnostic Loopback interface. + + Default value: `"main_router_id"` + """ raw_eos_cli: str | None """EOS CLI rendered directly on the Router BGP, VRF definition in the final EOS configuration.""" structured_config: StructuredConfig @@ -37802,6 +37838,7 @@ def __init__( self, *, enabled: bool | None | UndefinedType = Undefined, + router_id: str | UndefinedType = Undefined, raw_eos_cli: str | None | UndefinedType = Undefined, structured_config: StructuredConfig | UndefinedType = Undefined, _custom_data: dict[str, Any] | UndefinedType = Undefined, @@ -37823,6 +37860,16 @@ def __init__( This is useful for L2LS designs with VRFs. - If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it. + router_id: + Router ID to use for BGP in this VRF. + This can be an IPv4 address, "main_router_id", "none" or + "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router + general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a BGP + Router ID for this VRF. EOS will use the main BGP Router ID. + - "diagnostic_loopback" will use the IP + address of the VRF Diagnostic Loopback interface. raw_eos_cli: EOS CLI rendered directly on the Router BGP, VRF definition in the final EOS configuration. structured_config: Custom structured config added under router_bgp.vrfs.[name=] for eos_cli_config_gen. diff --git a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml index becffb10f9e..6f5e8e3a971 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -4583,6 +4583,8 @@ keys: See `cv_topology` for details.' use_router_general_for_router_id: + documentation_options: + table: fabric-settings type: bool description: Use `router general` to set router ID for all routing protocols and VRFs. @@ -6529,7 +6531,20 @@ $defs: description: If not set, "vrf_id" will be used. router_id: type: str - description: If not set, switch router_id will be used. + description: 'Router ID to use for OSPF in this VRF. + + This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + + - "main_router_id" will use the IP address of Loopback0 or the + common `router general` Router ID if `use_router_general_for_router_id` + is set." + + - "none" will not configure a OSPF Router ID for this VRF. EOS + will use the main OSPF Router ID. + + - "diagnostic_loopback" will use the IP address of the VRF Diagnostic + Loopback interface.' + default: main_router_id max_lsa: type: int convert_types: @@ -7213,6 +7228,22 @@ $defs: - If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it.' + router_id: + type: str + description: 'Router ID to use for BGP in this VRF. + + This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + + - "main_router_id" will use the IP address of Loopback0 or the + common `router general` Router ID if `use_router_general_for_router_id` + is set." + + - "none" will not configure a BGP Router ID for this VRF. EOS + will use the main BGP Router ID. + + - "diagnostic_loopback" will use the IP address of the VRF Diagnostic + Loopback interface.' + default: main_router_id raw_eos_cli: type: str description: 'EOS CLI rendered directly on the Router BGP, VRF diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml index 9291d57305c..54f9377920c 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_network_services.schema.yml @@ -508,7 +508,13 @@ $defs: description: If not set, "vrf_id" will be used. router_id: type: str - description: If not set, switch router_id will be used. + description: |- + Router ID to use for OSPF in this VRF. + This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a OSPF Router ID for this VRF. EOS will use the main OSPF Router ID. + - "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. + default: main_router_id max_lsa: type: int convert_types: @@ -1079,6 +1085,15 @@ $defs: - If the VRF is part of an overlay (`evpn` or `mpls`), BGP will be configured for it. - If any BGP peers are configured under the VRF, BGP will be configured for it. This is useful for L2LS designs with VRFs. - If uplink type is `p2p-vrfs` *and* the vrf is included in the uplink VRFs, BGP will be configured for it. + router_id: + type: str + description: |- + Router ID to use for BGP in this VRF. + This can be an IPv4 address, "main_router_id", "none" or "diagnostic_loopback". + - "main_router_id" will use the IP address of Loopback0 or the common `router general` Router ID if `use_router_general_for_router_id` is set." + - "none" will not configure a BGP Router ID for this VRF. EOS will use the main BGP Router ID. + - "diagnostic_loopback" will use the IP address of the VRF Diagnostic Loopback interface. + default: main_router_id raw_eos_cli: type: str description: | diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/use_router_general_for_router_id.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/use_router_general_for_router_id.schema.yml index e1d110de147..8de54d44872 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/use_router_general_for_router_id.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/use_router_general_for_router_id.schema.yml @@ -7,6 +7,8 @@ type: dict keys: use_router_general_for_router_id: + documentation_options: + table: fabric-settings type: bool description: Use `router general` to set router ID for all routing protocols and VRFs. default: false diff --git a/python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py b/python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py index bd1744714de..f96731f7b80 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py +++ b/python-avd/pyavd/_eos_designs/structured_config/network_services/router_bgp.py @@ -166,9 +166,7 @@ def _router_bgp_vrfs(self: AvdStructuredConfigNetworkServices) -> dict: self._update_router_bgp_vrf_evpn_or_mpls_cfg(bgp_vrf, vrf, vrf_address_families) if vrf_name != "default": - # Non-default VRF - if not self.inputs.use_router_general_for_router_id: - bgp_vrf["router_id"] = self.shared_utils.router_id + bgp_vrf["router_id"] = self.get_vrf_router_id(vrf, vrf.bgp.router_id, tenant.name) if vrf.redistribute_connected: bgp_vrf["redistribute"] = {"connected": {"enabled": True}} diff --git a/python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py b/python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py index d67d7117638..f7c045a0100 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py +++ b/python-avd/pyavd/_eos_designs/structured_config/network_services/router_ospf.py @@ -65,7 +65,7 @@ def router_ospf(self: AvdStructuredConfigNetworkServices) -> dict | None: "id": process_id, "vrf": vrf.name if vrf.name != "default" else None, "passive_interface_default": True, - "router_id": default(vrf.ospf.router_id, self.shared_utils.router_id if not self.inputs.use_router_general_for_router_id else None), + "router_id": self.get_vrf_router_id(vrf, vrf.ospf.router_id, tenant.name), "no_passive_interfaces": ospf_interfaces, "bfd_enable": vrf.ospf.bfd or None, # Historic behavior is to only output if True. "max_lsa": vrf.ospf.max_lsa, diff --git a/python-avd/pyavd/_eos_designs/structured_config/network_services/utils.py b/python-avd/pyavd/_eos_designs/structured_config/network_services/utils.py index bf52dfc896c..e6113514373 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/network_services/utils.py +++ b/python-avd/pyavd/_eos_designs/structured_config/network_services/utils.py @@ -9,7 +9,7 @@ from typing import TYPE_CHECKING from pyavd._errors import AristaAvdError, AristaAvdInvalidInputsError -from pyavd._utils import default, get +from pyavd._utils import default, get, get_ip_from_ip_prefix from pyavd.j2filters import natural_sort from .utils_wan import UtilsWanMixin @@ -402,3 +402,44 @@ def get_vlan_aware_bundle_rt( return f"{admin_subfield}:{rt_override}" return f"{admin_subfield}:{bundle_number}" + + def get_vrf_router_id( + self: AvdStructuredConfigNetworkServices, + vrf: EosDesigns._DynamicKeys.DynamicNetworkServicesItem.NetworkServicesItem.VrfsItem, + router_id: str, + tenant_name: str, + ) -> str | None: + """ + Determine the router ID for a given VRF based on its configuration. + + Args: + vrf: The VRF object containing OSPF/BGP and vtep_diagnostic details. + router_id: The router ID type specified for the VRF (e.g., "vtep_diagnostic", "main_router_id", "none", or an IPv4 address). + tenant_name: The name of the tenant to which the VRF belongs. + + Returns: + The resolved router ID as a string, or None if the router ID is not applicable. + + Raises: + AristaAvdInvalidInputsError: If required configuration for "vtep_diagnostic" router ID is missing. + """ + # Handle "vtep_diagnostic" router ID case + if router_id == "diagnostic_loopback": + # Validate required configuration + if (interface_data := self._get_vtep_diagnostic_loopback_for_vrf(vrf)) is None: + msg = ( + f"Invalid configuration on VRF '{vrf.name}' in Tenant '{tenant_name}'. " + "'vtep_diagnostic.loopback' along with either 'vtep_diagnostic.loopback_ip_pools' or 'vtep_diagnostic.loopback_ip_range' must be defined " + "when 'router_id' is set to 'diagnostic_loopback' on the VRF." + ) + raise AristaAvdInvalidInputsError(msg) + # Resolve router ID from loopback interface + return get_ip_from_ip_prefix(interface_data["ip_address"]) + if router_id == "main_router_id": + return self.shared_utils.router_id if not self.inputs.use_router_general_for_router_id else None + # Handle "none" router ID + if router_id == "none": + return None + + # Default to the specified router ID + return router_id