From 96b1efdce42b11248e3699405e3b9d60e06a5f5a Mon Sep 17 00:00:00 2001 From: Sara-Touqan <55439434+Sara-Touqan@users.noreply.github.com> Date: Wed, 8 Jan 2020 18:51:25 +0200 Subject: [PATCH] Supporting bfd command in Ansible. (#64509) --- lib/ansible/modules/network/onyx/onyx_protocol.py | 6 ++++++ .../network/onyx/fixtures/onyx_protocols_show.cfg | 3 ++- test/units/modules/network/onyx/test_onyx_protocols.py | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/onyx/onyx_protocol.py b/lib/ansible/modules/network/onyx/onyx_protocol.py index ce5c6360ba0..60c4d12bbdd 100644 --- a/lib/ansible/modules/network/onyx/onyx_protocol.py +++ b/lib/ansible/modules/network/onyx/onyx_protocol.py @@ -59,6 +59,10 @@ options: description: nve protocol choices: ['enabled', 'disabled'] version_added: "2.9" + bfd: + description: bfd protocol + choices: ['enabled', 'disabled'] + version_added: "2.10" """ EXAMPLES = """ @@ -113,6 +117,8 @@ class OnyxProtocolModule(BaseOnyxModule): disable="no protocol ospf"), nve=dict(name="nve", enable="protocol nve", disable="no protocol nve"), + bfd=dict(name="bfd", enable="protocol bfd", + disable="no protocol bfd"), ) @classmethod diff --git a/test/units/modules/network/onyx/fixtures/onyx_protocols_show.cfg b/test/units/modules/network/onyx/fixtures/onyx_protocols_show.cfg index 8379ef21925..fd4549cdf29 100644 --- a/test/units/modules/network/onyx/fixtures/onyx_protocols_show.cfg +++ b/test/units/modules/network/onyx/fixtures/onyx_protocols_show.cfg @@ -22,5 +22,6 @@ "dot1x": "disabled", "bgp": "disabled", "priority-flow-control": "disabled", - "ospf": "disabled" + "ospf": "disabled", + "bfd": "disabled" } diff --git a/test/units/modules/network/onyx/test_onyx_protocols.py b/test/units/modules/network/onyx/test_onyx_protocols.py index 8dee5b832f5..c81dd8ee601 100644 --- a/test/units/modules/network/onyx/test_onyx_protocols.py +++ b/test/units/modules/network/onyx/test_onyx_protocols.py @@ -141,3 +141,12 @@ class TestOnyxProtocolModule(TestOnyxModule): def test_nve_disabled(self): set_module_args(dict(nve='disabled')) self.execute_module(changed=False) + + def test_bfd_enable(self): + set_module_args(dict(bfd='enabled')) + commands = ['protocol bfd'] + self.execute_module(changed=True, commands=commands) + + def test_bfd_disabled(self): + set_module_args(dict(bfd='disabled')) + self.execute_module(changed=False)