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

Playbook check and diff modes util and radius-server implemetation #279

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
major_changes:
- Playbook check and diff modes utility functions and sonic_radius_server module support for the check and diff modes (https://github.com/ansible-collections/dellemc.enterprise_sonic/pull/279).
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,20 @@
get_replaced_config,
normalize_interface_name,
)
from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.formatted_diff_utils import (
__DELETE_CONFIG_IF_NO_SUBCONFIG,
get_new_config,
get_formatted_config_diff
)

PATCH = 'patch'
DELETE = 'delete'
TEST_KEYS = [
{'host': {'name': ''}},
]
TEST_KEYS_formatted_diff = [
{'host': {'name': '', '__delete_op': __DELETE_CONFIG_IF_NO_SUBCONFIG}},
]


class Radius_server(ConfigBase):
Expand Down Expand Up @@ -92,6 +100,16 @@ def execute_module(self):
if result['changed']:
result['after'] = changed_radius_server_facts

new_config = changed_radius_server_facts
if self._module.check_mode:
result.pop('after', None)
new_config = get_new_config(commands, existing_radius_server_facts,
TEST_KEYS_formatted_diff)
result['after(generated)'] = new_config

if self._module._diff:
result['config_diff'] = get_formatted_config_diff(existing_radius_server_facts,
new_config)
result['warnings'] = warnings
return result

Expand Down
Loading