mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07:00
Extreme Networks SLXOS Config Module (#38607)
* Adding slxos_config module and supporing util functions. * Adding slxos module_utils load_config test * Adding slxos_config module tests * Removing unneeded required false statements from slxos_config module * Removing version_aded from slxos_config module * Removing force and save from slxos config module * Removing save test
This commit is contained in:
parent
fee55b41fe
commit
d030032b47
6 changed files with 733 additions and 0 deletions
|
@ -105,3 +105,44 @@ def run_commands(module, commands):
|
|||
responses.append(out)
|
||||
|
||||
return responses
|
||||
|
||||
|
||||
def get_config(module):
|
||||
"""Get switch configuration
|
||||
|
||||
Gets the described device's current configuration. If a configuration has
|
||||
already been retrieved it will return the previously obtained configuration.
|
||||
|
||||
Args:
|
||||
module: A valid AnsibleModule instance.
|
||||
|
||||
Returns:
|
||||
A string containing the configuration.
|
||||
"""
|
||||
if not hasattr(module, 'device_configs'):
|
||||
module.device_configs = {}
|
||||
elif module.device_configs != {}:
|
||||
return module.device_configs
|
||||
|
||||
connection = get_connection(module)
|
||||
out = connection.get_config()
|
||||
cfg = to_text(out, errors='surrogate_then_replace').strip()
|
||||
module.device_configs = cfg
|
||||
return cfg
|
||||
|
||||
|
||||
def load_config(module, commands):
|
||||
"""Apply a list of commands to a device.
|
||||
|
||||
Given a list of commands apply them to the device to modify the
|
||||
configuration in bulk.
|
||||
|
||||
Args:
|
||||
module: A valid AnsibleModule instance.
|
||||
commands: Iterable of command strings.
|
||||
|
||||
Returns:
|
||||
None
|
||||
"""
|
||||
connection = get_connection(module)
|
||||
connection.edit_config(commands)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue