Cisco IOS configuration manipulation helpers
New in version 2019.2.0.
This module provides a collection of helper functions for Cisco IOS style configuration manipulation. This module does not have external dependencies and can be used from any Proxy or regular Minion.
salt.modules.iosconfig.clean(config=None, path=None, saltenv=u'base')¶Return a clean version of the config, without any special signs (such as
! as an individual line) or empty lines, but just lines with significant
value in the configuration of the network device.
path
is configured.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.basepath is not a salt:// URL.CLI Example:
salt '*' iosconfig.clean path=salt://path/to/my/config.txt
salt '*' iosconfig.clean path=https://bit.ly/2mAdq7z
salt.modules.iosconfig.diff_text(candidate_config=None, candidate_path=None, running_config=None, running_path=None, saltenv=u'base')¶Return the diff, as text, between the candidate and the running config.
candidate_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.running_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.basecandidate_path or running_path is not a
salt:// URL.CLI Example:
salt '*' iosconfig.diff_text candidate_path=salt://path/to/candidate.cfg running_path=salt://path/to/running.cfg
salt.modules.iosconfig.diff_tree(candidate_config=None, candidate_path=None, running_config=None, running_path=None, saltenv=u'base')¶Return the diff, as Python dictionary, between the candidate and the running configuration.
candidate_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.running_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.basecandidate_path or running_path is not a
salt:// URL.CLI Example:
salt '*' iosconfig.diff_tree candidate_path=salt://path/to/candidate.cfg running_path=salt://path/to/running.cfg
salt.modules.iosconfig.merge_diff(initial_config=None, initial_path=None, merge_config=None, merge_path=None, saltenv=u'base')¶Return the merge diff, as text, after merging the merge config into the initial config.
initial_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.merge_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.baseinitial_path or merge_path is not a salt:// URL.CLI Example:
salt '*' iosconfig.merge_diff initial_path=salt://path/to/running.cfg merge_path=salt://path/to/merge.cfg
salt.modules.iosconfig.merge_text(initial_config=None, initial_path=None, merge_config=None, merge_path=None, saltenv=u'base')¶Return the merge result of the initial_config with the merge_config,
as plain text.
initial_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.merge_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.baseinitial_path or merge_path is not a salt:// URL.CLI Example:
salt '*' iosconfig.merge_text initial_path=salt://path/to/running.cfg merge_path=salt://path/to/merge.cfg
salt.modules.iosconfig.merge_tree(initial_config=None, initial_path=None, merge_config=None, merge_path=None, saltenv=u'base')¶Return the merge tree of the initial_config with the merge_config,
as a Python dictionary.
initial_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.merge_path is set.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.baseinitial_path or merge_path is not a salt:// URL.CLI Example:
salt '*' iosconfig.merge_tree initial_path=salt://path/to/running.cfg merge_path=salt://path/to/merge.cfg
salt.modules.iosconfig.tree(config=None, path=None, with_tags=False, saltenv=u'base')¶Transform Cisco IOS style configuration to structured Python dictionary.
Depending on the value of the with_tags argument, this function may
provide different views, valuable in different situations.
path
is configured.cp.get_url), e.g., salt://,
https://, s3://, ftp:/, etc.Falsebasepath is not a salt:// URL.CLI Example:
salt '*' iosconfig.tree path=salt://path/to/my/config.txt
salt '*' iosconfig.tree path=https://bit.ly/2mAdq7z