From e105fb4dbed76de07f6cd5ba92cf8c2cad6b9e7c Mon Sep 17 00:00:00 2001 From: Nathan Musser Date: Wed, 18 Sep 2024 12:24:46 -0500 Subject: [PATCH 1/3] Added check to render neighbors without peer group if "include_in_underlay" is set to False and the protocol is ebgp. --- .../core_interfaces_and_l3_edge/router_bgp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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}) From 1eaf22684dbd16ce0bedd1b58ba49a59b43cbe22 Mon Sep 17 00:00:00 2001 From: Nathan Musser Date: Tue, 1 Oct 2024 15:53:51 -0500 Subject: [PATCH 2/3] Updated p2p links description --- .../avd/roles/eos_designs/docs/tables/core-interfaces.md | 6 ++++-- .../arista/avd/roles/eos_designs/docs/tables/l3-edge.md | 6 ++++-- python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml | 3 +++ .../schema/schema_fragments/defs_p2p_links.schema.yml | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) 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 2ded1723cab..9c4a192f249 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 @@ -56,7 +56,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. | @@ -102,7 +102,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" @@ -235,6 +235,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: @@ -357,6 +358,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 db7b4be549a..2c5e10c0125 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 @@ -56,7 +56,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. | @@ -102,7 +102,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" @@ -235,6 +235,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: @@ -357,6 +358,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 bb204f5a076..ee657c9b278 100644 --- a/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml +++ b/python-avd/pyavd/_eos_designs/schema/eos_designs.schema.yml @@ -9537,6 +9537,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 2913d8caea3..96414a7b699 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 @@ -168,6 +168,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 From 45937281e3436de822986512b85ea7c1fa8e0ab8 Mon Sep 17 00:00:00 2001 From: Nathan Musser Date: Thu, 3 Oct 2024 09:00:53 -0500 Subject: [PATCH 3/3] Added molecule test for l3_edge no underlay and ebgp --- .../intended/configs/l3_edge_bgp.cfg | 9 +++++++++ .../intended/structured_configs/l3_edge_bgp.yml | 14 ++++++++++++++ .../inventory/host_vars/l3_edge_bgp.yml | 8 ++++++++ 3 files changed, 31 insertions(+) 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