Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ebgp-multihop config/facts-gathering #404

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/fix_eos_bgp_global.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- fix facts gathering for ebgp-multihop attribute.
5 changes: 2 additions & 3 deletions plugins/module_utils/network/eos/rm_templates/bgp_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
facilitates both facts gathering and native command generation for
the given network resource.
"""

import re

from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.rm_base.network_template import (
Expand Down Expand Up @@ -264,7 +263,7 @@ def _tmplt_bgp_neighbor(config_data):
elif config_data["neighbor"].get("dont_capability_negotiate"):
command += " dont-capability-negotiate"
elif config_data["neighbor"].get("ebgp_multihop"):
command += " ebgp-multiphop"
command += " ebgp-multihop"
if config_data["neighbor"]["ebgp_multihop"].get("ttl"):
command += " {ttl}".format(**config_data["neighbor"]["ebgp_multihop"])
elif config_data["neighbor"].get("encryption_password"):
Expand Down Expand Up @@ -1654,7 +1653,7 @@ def __init__(self, lines=None, module=None):
\s*neighbor
\s+(?P<peer>\S+)
\s+ebgp-multihop
\s*(?P<ttl>\d+)*
\s+(?P<ttl>\d+)*
$""",
re.VERBOSE,
),
Expand Down
29 changes: 27 additions & 2 deletions tests/unit/modules/network/eos/test_eos_bgp_global.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def test_eos_bgp_global_merged(self):
"neighbor peer1 peer group",
"neighbor peer1 bfd c-bit",
"neighbor peer1 maximum-routes 12000",
"neighbor peer1 ebgp-multiphop",
"neighbor peer1 ebgp-multihop",
"neighbor peer1 send-community link-bandwidth divide ratio",
"neighbor peer1 timers 5 10",
"neighbor peer1 ttl maximum-hops 33",
Expand Down Expand Up @@ -238,6 +238,31 @@ def test_eos_bgp_global_merged(self):
]
self.execute_module(changed=True, commands=commands)

def test_eos_bgp_global_merged_multihop(self):
set_module_args(
dict(
config=dict(
as_number="65535",
router_id="192.168.1.1",
neighbor=[
dict(
neighbor_address="10.2.2.1",
peer_group="evpn",
ebgp_multihop=dict(set=True, ttl=2),
),
],
),
state="merged",
),
)
commands = [
"router bgp 65535",
"neighbor 10.2.2.1 ebgp-multihop 2",
"neighbor 10.2.2.1 peer group",
"router-id 192.168.1.1",
]
self.execute_module(changed=True, commands=commands)

def test_eos_bgp_global_replaced_idempotent(self):
set_module_args(
dict(
Expand Down Expand Up @@ -800,7 +825,7 @@ def test_eos_bgp_global_rendered(self):
"neighbor peer2 peer group",
"neighbor peer2 local-as 55 no-prepend replace-as fallback",
"neighbor peer2 next-hop-v6-addr 5001::/64 in",
"neighbor peer2 ebgp-multiphop 10",
"neighbor peer2 ebgp-multihop 10",
"neighbor peer2 enforce-first-as",
"neighbor peer2 fall-over bfd",
"neighbor peer2 graceful-restart-helper",
Expand Down
Loading