Skip to content
Draft
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
2 changes: 1 addition & 1 deletion plugins/modules/iosxr_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes here done, how are you validating those?
also we need to do changes in rm_templates, argspec files as well and not just here as it is just a doc file, actual changes need to be implemented in argspec, rm_templates file

text=dict(),
state=dict(default="present", choices=["present", "absent"]),
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
14 changes: 12 additions & 2 deletions tests/unit/modules/network/iosxr/test_iosxr_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ 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):
set_module_args(dict(banner="exec1", state="absent"))
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):
Expand All @@ -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)