diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/l3_edge_bgp.cfg b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/l3_edge_bgp.cfg index bc6f1c4637a..f604b40be1a 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/l3_edge_bgp.cfg +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/configs/l3_edge_bgp.cfg @@ -91,6 +91,13 @@ interface Ethernet8 no shutdown channel-group 7 mode active ! +interface ethernet9 + description P2P_peer7_ethernet9 + no shutdown + mtu 9214 + no switchport + ip address 192.168.0.12/31 +! interface Loopback0 description ROUTER_ID no shutdown @@ -128,6 +135,8 @@ router bgp 65000 neighbor 192.168.0.11 peer group IPv4-UNDERLAY-PEERS neighbor 192.168.0.11 remote-as 65006 neighbor 192.168.0.11 description peer6 + neighbor 192.168.0.13 remote-as 65007 + neighbor 192.168.0.13 description peer7 redistribute connected route-map RM-CONN-2-BGP ! address-family ipv4 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/l3_edge_bgp.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/l3_edge_bgp.yml index d2a037bad00..971d02fa6b4 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/l3_edge_bgp.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/intended/structured_configs/l3_edge_bgp.yml @@ -49,6 +49,10 @@ router_bgp: peer: peer6 description: peer6 peer_group: IPv4-UNDERLAY-PEERS + - ip_address: 192.168.0.13 + remote_as: '65007' + peer: peer7 + description: peer7 service_routing_protocols_model: multi-agent ip_routing: true vlan_internal_order: @@ -178,6 +182,16 @@ ethernet_interfaces: id: 7 mode: active description: P2P_peer6_Ethernet8 +- name: ethernet9 + peer: peer7 + peer_interface: ethernet9 + peer_type: other + switchport: + enabled: false + shutdown: false + mtu: 9214 + ip_address: 192.168.0.12/31 + description: P2P_peer7_ethernet9 port_channel_interfaces: - name: Port-Channel5 peer: peer5 diff --git a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/l3_edge_bgp.yml b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/l3_edge_bgp.yml index 34bbc14621e..4d320b9cd73 100644 --- a/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/l3_edge_bgp.yml +++ b/ansible_collections/arista/avd/molecule/eos_designs_unit_tests/inventory/host_vars/l3_edge_bgp.yml @@ -85,3 +85,11 @@ l3_edge: - node: peer6 interfaces: [ Ethernet7, Ethernet8 ] include_in_underlay_protocol: true + + # P2P link with ebgp and no underlay routing. + - nodes: [l3_edge_bgp, peer7] + interfaces: [ethernet9, ethernet9] + subnet: 192.168.0.12/31 + as: [65000, 65007] + include_in_underlay_protocol: false + routing_protocol: ebgp diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/core-interfaces.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/core-interfaces.md index d7f6b026c42..18fb0ce28ab 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/core-interfaces.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/core-interfaces.md @@ -57,7 +57,7 @@ | [              - <str>](## "core_interfaces.p2p_links_profiles.[].port_channel.nodes_child_interfaces.[].interfaces.[]") | String | | | | | | [            channel_id](## "core_interfaces.p2p_links_profiles.[].port_channel.nodes_child_interfaces.[].channel_id") | Integer | | | | Port-Channel ID. If no channel_id is specified, an id is generated from the first switch port in the port channel. | | [      raw_eos_cli](## "core_interfaces.p2p_links_profiles.[].raw_eos_cli") | String | | | | EOS CLI rendered directly on the point-to-point interface in the final EOS configuration. | - | [      routing_protocol](## "core_interfaces.p2p_links_profiles.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
- ebgp: Enforce plain IPv4 BGP peering | + | [      routing_protocol](## "core_interfaces.p2p_links_profiles.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group.
- ebgp: Enforce plain IPv4 BGP peering | | [      structured_config](## "core_interfaces.p2p_links_profiles.[].structured_config") | Dictionary | | | | Custom structured config for interfaces.
Note! The content of this dictionary is _not_ validated by the schema, since it can be either ethernet_interfaces or port_channel_interfaces. | | [  p2p_links](## "core_interfaces.p2p_links") | List, items: Dictionary | | | | | | [    - nodes](## "core_interfaces.p2p_links.[].nodes") | List, items: String | Required | | | Nodes where this link should be configured. | @@ -104,7 +104,7 @@ | [              - <str>](## "core_interfaces.p2p_links.[].port_channel.nodes_child_interfaces.[].interfaces.[]") | String | | | | | | [            channel_id](## "core_interfaces.p2p_links.[].port_channel.nodes_child_interfaces.[].channel_id") | Integer | | | | Port-Channel ID. If no channel_id is specified, an id is generated from the first switch port in the port channel. | | [      raw_eos_cli](## "core_interfaces.p2p_links.[].raw_eos_cli") | String | | | | EOS CLI rendered directly on the point-to-point interface in the final EOS configuration. | - | [      routing_protocol](## "core_interfaces.p2p_links.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
- ebgp: Enforce plain IPv4 BGP peering | + | [      routing_protocol](## "core_interfaces.p2p_links.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group.
- ebgp: Enforce plain IPv4 BGP peering | | [      structured_config](## "core_interfaces.p2p_links.[].structured_config") | Dictionary | | | | Custom structured config for interfaces.
Note! The content of this dictionary is _not_ validated by the schema, since it can be either ethernet_interfaces or port_channel_interfaces. | === "YAML" @@ -260,6 +260,7 @@ raw_eos_cli: # Enables deviation of the routing protocol used on this link from the fabric underlay default. + # If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group. # - ebgp: Enforce plain IPv4 BGP peering routing_protocol: @@ -405,6 +406,7 @@ raw_eos_cli: # Enables deviation of the routing protocol used on this link from the fabric underlay default. + # If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group. # - ebgp: Enforce plain IPv4 BGP peering routing_protocol: diff --git a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/l3-edge.md b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/l3-edge.md index 46f0ff8481c..b5cf0f26e34 100644 --- a/ansible_collections/arista/avd/roles/eos_designs/docs/tables/l3-edge.md +++ b/ansible_collections/arista/avd/roles/eos_designs/docs/tables/l3-edge.md @@ -57,7 +57,7 @@ | [              - <str>](## "l3_edge.p2p_links_profiles.[].port_channel.nodes_child_interfaces.[].interfaces.[]") | String | | | | | | [            channel_id](## "l3_edge.p2p_links_profiles.[].port_channel.nodes_child_interfaces.[].channel_id") | Integer | | | | Port-Channel ID. If no channel_id is specified, an id is generated from the first switch port in the port channel. | | [      raw_eos_cli](## "l3_edge.p2p_links_profiles.[].raw_eos_cli") | String | | | | EOS CLI rendered directly on the point-to-point interface in the final EOS configuration. | - | [      routing_protocol](## "l3_edge.p2p_links_profiles.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
- ebgp: Enforce plain IPv4 BGP peering | + | [      routing_protocol](## "l3_edge.p2p_links_profiles.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group.
- ebgp: Enforce plain IPv4 BGP peering | | [      structured_config](## "l3_edge.p2p_links_profiles.[].structured_config") | Dictionary | | | | Custom structured config for interfaces.
Note! The content of this dictionary is _not_ validated by the schema, since it can be either ethernet_interfaces or port_channel_interfaces. | | [  p2p_links](## "l3_edge.p2p_links") | List, items: Dictionary | | | | | | [    - nodes](## "l3_edge.p2p_links.[].nodes") | List, items: String | Required | | | Nodes where this link should be configured. | @@ -104,7 +104,7 @@ | [              - <str>](## "l3_edge.p2p_links.[].port_channel.nodes_child_interfaces.[].interfaces.[]") | String | | | | | | [            channel_id](## "l3_edge.p2p_links.[].port_channel.nodes_child_interfaces.[].channel_id") | Integer | | | | Port-Channel ID. If no channel_id is specified, an id is generated from the first switch port in the port channel. | | [      raw_eos_cli](## "l3_edge.p2p_links.[].raw_eos_cli") | String | | | | EOS CLI rendered directly on the point-to-point interface in the final EOS configuration. | - | [      routing_protocol](## "l3_edge.p2p_links.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
- ebgp: Enforce plain IPv4 BGP peering | + | [      routing_protocol](## "l3_edge.p2p_links.[].routing_protocol") | String | | | Valid Values:
- ebgp | Enables deviation of the routing protocol used on this link from the fabric underlay default.
If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group.
- ebgp: Enforce plain IPv4 BGP peering | | [      structured_config](## "l3_edge.p2p_links.[].structured_config") | Dictionary | | | | Custom structured config for interfaces.
Note! The content of this dictionary is _not_ validated by the schema, since it can be either ethernet_interfaces or port_channel_interfaces. | === "YAML" @@ -260,6 +260,7 @@ raw_eos_cli: # Enables deviation of the routing protocol used on this link from the fabric underlay default. + # If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group. # - ebgp: Enforce plain IPv4 BGP peering routing_protocol: @@ -405,6 +406,7 @@ raw_eos_cli: # Enables deviation of the routing protocol used on this link from the fabric underlay default. + # If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group. # - ebgp: Enforce plain IPv4 BGP peering routing_protocol: 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 8aea7157cc8..1120d8a41e0 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -9679,6 +9679,9 @@ $defs: description: 'Enables deviation of the routing protocol used on this link from the fabric underlay default. + If routing_protocol is ''ebgp'' and include_in_underlay_protocol is ''false'' + then the bgp peering will not be included in the underlay peer group. + - ebgp: Enforce plain IPv4 BGP peering' structured_config: type: dict diff --git a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_p2p_links.schema.yml b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_p2p_links.schema.yml index 82e534f61c8..1a6741fefb3 100644 --- a/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_p2p_links.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/schema_fragments/defs_p2p_links.schema.yml @@ -192,6 +192,7 @@ $defs: - ebgp description: |- Enables deviation of the routing protocol used on this link from the fabric underlay default. + If routing_protocol is 'ebgp' and include_in_underlay_protocol is 'false' then the bgp peering will not be included in the underlay peer group. - ebgp: Enforce plain IPv4 BGP peering structured_config: type: dict diff --git a/python-avd/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/router_bgp.py b/python-avd/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/router_bgp.py index 65fd87cf656..b5d9f5aafd8 100644 --- a/python-avd/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/router_bgp.py +++ b/python-avd/pyavd/_eos_designs/structured_config/core_interfaces_and_l3_edge/router_bgp.py @@ -31,7 +31,7 @@ def router_bgp(self: AvdStructuredConfigCoreInterfacesAndL3Edge) -> dict | None: neighbors = [] neighbor_interfaces = [] for p2p_link in self._filtered_p2p_links: - if p2p_link.get("include_in_underlay_protocol", True) is not True: + if p2p_link.get("include_in_underlay_protocol", True) is not True and p2p_link.get("routing_protocol") != "ebgp": continue if p2p_link["data"]["bgp_as"] is None or p2p_link["data"]["peer_bgp_as"] is None: @@ -42,9 +42,12 @@ def router_bgp(self: AvdStructuredConfigCoreInterfacesAndL3Edge) -> dict | None: "remote_as": p2p_link["data"]["peer_bgp_as"], "peer": p2p_link["data"]["peer"], "description": p2p_link["data"]["peer"], - "peer_group": self.shared_utils.bgp_peer_groups["ipv4_underlay_peers"]["name"], } + # Set peer group only if include_in_underlay_protocol is True + if p2p_link.get("include_in_underlay_protocol", True): + neighbor["peer_group"] = self.shared_utils.bgp_peer_groups["ipv4_underlay_peers"]["name"] + # RFC5549 if self.shared_utils.underlay_rfc5549 and p2p_link.get("routing_protocol") != "ebgp": neighbor_interfaces.append({"name": p2p_link["data"]["interface"], **neighbor})