diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1A.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1A.cfg index c7778484981..800bf4490e1 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1A.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/DC1-BL1A.cfg @@ -312,7 +312,6 @@ router bfd multihop interval 1200 min-rx 1200 multiplier 3 ! router bgp 65104 - router-id 192.168.255.14 update wait-install no bgp default ipv4-unicast maximum-paths 4 ecmp 4 @@ -414,7 +413,6 @@ router bgp 65104 rd 192.168.254.14:15 route-target import evpn 65104:15 route-target export evpn 65104:15 - router-id 192.168.255.14 redistribute connected ! vrf Tenant_A_WAN_Zone @@ -425,7 +423,6 @@ router bgp 65104 route-target export evpn 65104:14 route-target export evpn 65000:789 route-target export vpn-ipv4 65000:123 - router-id 192.168.255.14 update wait-install neighbor 123.1.1.10 remote-as 1234 neighbor 123.1.1.10 shutdown @@ -475,31 +472,30 @@ router bgp 65104 rd 192.168.254.14:20 route-target import evpn 65104:20 route-target export evpn 65104:20 - router-id 192.168.255.14 redistribute connected ! vrf Tenant_B_WAN_Zone rd 192.168.254.14:21 route-target import evpn 65104:21 route-target export evpn 65104:21 - router-id 192.168.255.14 redistribute connected ! vrf Tenant_C_WAN_Zone rd 192.168.254.14:31 route-target import evpn 65104:31 route-target export evpn 65104:31 - router-id 192.168.255.14 redistribute connected ! vrf TENANT_D_WAN_ZONE rd 192.168.254.14:42 route-target import evpn 65104:42 route-target export evpn 65104:42 - router-id 192.168.255.14 +! +router general + router-id ipv4 192.168.255.14 + exit ! router ospf 14 vrf Tenant_A_WAN_Zone - router-id 192.168.255.14 passive-interface default no passive-interface Ethernet7 no passive-interface Vlan150 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1A.yml index e2e129e49d3..2e040a703a6 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/DC1-BL1A.yml @@ -2,7 +2,6 @@ hostname: DC1-BL1A is_deployed: true router_bgp: as: '65104' - router_id: 192.168.255.14 bgp_defaults: - distance bgp 20 200 200 bgp: @@ -131,7 +130,6 @@ router_bgp: - address_family: evpn route_targets: - '65104:15' - router_id: 192.168.255.14 redistribute: connected: enabled: true @@ -154,7 +152,6 @@ router_bgp: - address_family: vpn-ipv4 route_targets: - 65000:123 - router_id: 192.168.255.14 redistribute: connected: enabled: true @@ -228,7 +225,6 @@ router_bgp: - address_family: evpn route_targets: - '65104:20' - router_id: 192.168.255.14 redistribute: connected: enabled: true @@ -243,7 +239,6 @@ router_bgp: - address_family: evpn route_targets: - '65104:21' - router_id: 192.168.255.14 redistribute: connected: enabled: true @@ -258,7 +253,6 @@ router_bgp: - address_family: evpn route_targets: - '65104:31' - router_id: 192.168.255.14 redistribute: connected: enabled: true @@ -273,7 +267,6 @@ router_bgp: - address_family: evpn route_targets: - '65104:42' - router_id: 192.168.255.14 vlan_aware_bundles: - name: Tenant_A_WAN_Zone rd: 192.168.254.14:14 @@ -452,6 +445,9 @@ ntp: null snmp_server: contact: example@example.com location: EOS_DESIGNS_UNIT_TESTS DC1-BL1A +router_general: + router_id: + ipv4: 192.168.255.14 ethernet_interfaces: - name: Ethernet1 peer: DC1-SPINE1 @@ -728,7 +724,6 @@ router_ospf: - Ethernet7 - Vlan150 max_lsa: 15000 - router_id: 192.168.255.14 redistribute: bgp: enabled: true diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/DC1-BL1A.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/DC1-BL1A.yml index 8c881a25603..b7610e875cd 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/DC1-BL1A.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/DC1-BL1A.yml @@ -5,6 +5,8 @@ my_special_dci_ethernet_interfaces: custom_structured_configuration_list_merge: append +use_router_general_for_router_id: true + # Test appending to list of ip name-servers. override_ip_name_servers: - ip_address: 1.1.1.1 diff --git a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py index 4e1b63553d3..e55a255ffb7 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py +++ b/python-avd/pyavd/_eos_designs/structured_config/base/__init__.py @@ -67,7 +67,7 @@ def router_bgp(self) -> dict | None: router_bgp = { "as": self.shared_utils.bgp_as, - "router_id": self.shared_utils.router_id if self.shared_utils.use_router_general_for_router_id is False else None, + "router_id": self.shared_utils.router_id if not self.shared_utils.use_router_general_for_router_id else None, "distance": get(self._hostvars, "bgp_distance"), "bgp_defaults": get(self.shared_utils.switch_data_combined, "bgp_defaults"), "bgp": { 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 9c6ddd55a1b..94c204ef1e7 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 @@ -168,7 +168,7 @@ def _router_bgp_vrfs(self: AvdStructuredConfigNetworkServices) -> dict: bgp_vrf_redistribute_connected = get(vrf, "redistribute_connected", default=True) if vrf_name != "default": # Non-default VRF - if self.shared_utils.use_router_general_for_router_id is False: + if not self.shared_utils.use_router_general_for_router_id: bgp_vrf["router_id"] = self.shared_utils.router_id if bgp_vrf_redistribute_connected is 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 fb025381e8f..729129e6291 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 @@ -72,7 +72,7 @@ def router_ospf(self: AvdStructuredConfigNetworkServices) -> dict | None: if ospf_router_id := get(vrf, "ospf.router_id"): process["router_id"] = ospf_router_id - elif self.shared_utils.use_router_general_for_router_id is False: + elif not self.shared_utils.use_router_general_for_router_id: process["router_id"] = self.shared_utils.router_id process_redistribute = {} diff --git a/python-avd/pyavd/_eos_designs/structured_config/underlay/mpls.py b/python-avd/pyavd/_eos_designs/structured_config/underlay/mpls.py index 3f65353f81e..57c80c835c8 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/underlay/mpls.py +++ b/python-avd/pyavd/_eos_designs/structured_config/underlay/mpls.py @@ -33,7 +33,7 @@ def mpls(self: AvdStructuredConfigUnderlay) -> dict | None: "ip": True, "ldp": { "interface_disabled_default": True, - "router_id": self.shared_utils.router_id if self.shared_utils.use_router_general_for_router_id is False else None, + "router_id": self.shared_utils.router_id if not self.shared_utils.use_router_general_for_router_id else None, "shutdown": False, "transport_address_interface": "Loopback0", }, diff --git a/python-avd/pyavd/_eos_designs/structured_config/underlay/router_isis.py b/python-avd/pyavd/_eos_designs/structured_config/underlay/router_isis.py index 771d87bdde9..ad1753acd2d 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/underlay/router_isis.py +++ b/python-avd/pyavd/_eos_designs/structured_config/underlay/router_isis.py @@ -32,7 +32,7 @@ def router_isis(self: AvdStructuredConfigUnderlay) -> dict | None: "instance": self.shared_utils.isis_instance_name, "log_adjacency_changes": True, "net": self._isis_net, - "router_id": self.shared_utils.router_id if self.shared_utils.use_router_general_for_router_id is False else None, + "router_id": self.shared_utils.router_id if not self.shared_utils.use_router_general_for_router_id else None, "is_type": self._is_type, "address_family_ipv4": {"enabled": True, "maximum_paths": get(self._hostvars, "isis_maximum_paths", default=4)}, } diff --git a/python-avd/pyavd/_eos_designs/structured_config/underlay/router_ospf.py b/python-avd/pyavd/_eos_designs/structured_config/underlay/router_ospf.py index 11835ee1e88..96262a333d1 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/underlay/router_ospf.py +++ b/python-avd/pyavd/_eos_designs/structured_config/underlay/router_ospf.py @@ -40,7 +40,7 @@ def router_ospf(self: AvdStructuredConfigUnderlay) -> dict | None: process = { "id": process_id, "passive_interface_default": True, - "router_id": self.shared_utils.router_id if self.shared_utils.use_router_general_for_router_id is False else None, + "router_id": self.shared_utils.router_id if not self.shared_utils.use_router_general_for_router_id else None, "max_lsa": get(self._hostvars, "underlay_ospf_max_lsa", default=12000), "no_passive_interfaces": no_passive_interfaces, "bfd_enable": get(self._hostvars, "underlay_ospf_bfd_enable", default=False),