diff --git a/plugins/modules/iosxr_banner.py b/plugins/modules/iosxr_banner.py index 909d79511..85f947fe9 100644 --- a/plugins/modules/iosxr_banner.py +++ b/plugins/modules/iosxr_banner.py @@ -255,7 +255,7 @@ def run(self): def main(): """main entry point for module execution""" argument_spec = dict( - banner=dict(required=True, choices=["login", "motd"]), + banner=dict(required=True, choices=["login", "motd", "exec"]), text=dict(), state=dict(default="present", choices=["present", "absent"]), ) diff --git a/tests/unit/modules/network/iosxr/fixtures/iosxr_banner_config.cfg b/tests/unit/modules/network/iosxr/fixtures/iosxr_banner_config.cfg index ed8e6d6dd..847a136d1 100644 --- a/tests/unit/modules/network/iosxr/fixtures/iosxr_banner_config.cfg +++ b/tests/unit/modules/network/iosxr/fixtures/iosxr_banner_config.cfg @@ -1,2 +1,3 @@ banner motd this is my motd banner banner login this is my login banner +banner exec this is my exec banner diff --git a/tests/unit/modules/network/iosxr/test_iosxr_banner.py b/tests/unit/modules/network/iosxr/test_iosxr_banner.py index 32085d51e..366a4a134 100644 --- a/tests/unit/modules/network/iosxr/test_iosxr_banner.py +++ b/tests/unit/modules/network/iosxr/test_iosxr_banner.py @@ -94,7 +94,7 @@ def test_iosxr_banner_fail_create(self): result = self.execute_module(failed=True, changed=True) self.assertEqual( result["msg"], - "value of banner must be one of: login, motd, got: exec1", + "value of banner must be one of: login, motd, exec got: exec1", ) def test_iosxr_banner_exec1_fail_remove(self): @@ -102,7 +102,7 @@ def test_iosxr_banner_exec1_fail_remove(self): result = self.execute_module(failed=True, changed=True) self.assertIn( result["msg"], - "value of banner must be one of: login, motd, got: exec1", + "value of banner must be one of: login, motd, exec got: exec1", ) def test_iosxr_banner_motd_create(self): @@ -114,3 +114,13 @@ def test_iosxr_banner_motd_remove(self): set_module_args(dict(banner="motd", state="absent")) commands = ["no banner motd"] self.execute_module(changed=True, commands=commands) + + def test_iosxr_banner_exec_create(self): + set_module_args(dict(banner="exec", text="test\nbanner\nstring")) + commands = ["banner exec test\nbanner\nstring"] + self.execute_module(changed=True, commands=commands) + + def test_iosxr_banner_exec_remove(self): + set_module_args(dict(banner="exec", state="absent")) + commands = ["no banner exec"] + self.execute_module(changed=True, commands=commands)