neulab/tldr huggingface dataset:
WARNING: This works on any platform, regardless if they have or don't have native capabilities to confirming a commit. However, please be very cautious when using this feature: on Junos (as it is the only NAPALM core platform supporting this natively) it executes a commit confirmed as you would do from the command line.  All the other platforms don't have this capability natively, therefore the revert is done via Salt. That means, your device needs to be reachable at the moment when Salt will attempt to revert your changes. Be cautious when pushing configuration changes that would prevent you reach the device.
Similarly, if an user or a different process apply other configuration changes in the meanwhile (between the moment you commit and till the changes are reverted), these changes would be equally reverted, as Salt cannot be aware of them.
revert_at: None Commit and revert the changes at a specific time. Example of accepted formats: 1am (will commit and revert the changes at the next 1AM), 13:20 (will commit and revert at 13:20), 1:20am, etc.
saltenv: base Specifies the Salt environment name.
Returns a dictionary having the following keys:
• result (bool): if the config was applied successfully. It is False only in case of failure. In case     there are no changes to be applied and successfully performs all operations it is still True and so will be     the already_configured flag (example below)
• comment (str): a message for the user
• already_configured (bool): flag to check if there were no changes applied
• loaded_config (str): the configuration loaded on the device. Requires debug to be set as True
• diff (str): returns the config changes applied
salt '*' net.load_config text='ntp peer 192.168.0.1' salt '*' net.load_config filename='/absolute/path/to/your/file' salt '*' net.load_config filename='/absolute/path/to/your/file' test=True salt '*' net.load_config filename='/absolute/path/to/your/file' commit=False
{ 'comment': 'Configuration discarded.', 'already_configured': False, 'result': True, 'diff': '[edit interfaces xe-0/0/5]+   description "Adding a description";' }
salt.modules.napalm_network.load_template(template_name=None, template_source=None, context=None, defaults=None, template_engine='jinja', saltenv='base', template_hash=None, template_hash_name=None, skip_verify=False, test=False, commit=True, debug=False, replace=False, commit_in=None, commit_at=None, revert_in=None, revert_at=None, inherit_napalm_device=None, **template_vars) Renders a configuration template (default: Jinja) and loads the result on the device.
By default this function will commit the changes. If there are no changes, it does not commit, discards he config and the flag already_configured will be set as True to point this out.
To preserve the changes, set commit to False.  However, this is recommended to be used only in exceptional cases when there are applied few consecutive states and/or configuration changes. Otherwise the user might forget that the config DB is locked and the candidate config buffer is not cleared/merged in the running config.
template_name Identifies path to the template source.  The template can be either stored on the local machine, either remotely. The recommended location is under the file_roots as specified in the master config file.  For example, let's suppose the file_roots is configured as:
file_roots: base: - /etc/salt/states
Placing the template under /etc/salt/states/templates/example.jinja, it can be used as salt://templates/example.jinja.  Alternatively, for local files, the user can specify the absolute path.  If remotely, the source can be retrieved via http, https or ftp.
• salt://my_template.jinja
• /absolute/path/to/my_template.jinja
• http://example.com/template.cheetah
• https:/example.com/template.mako
• ftp://example.com/template.py
Changed in version 2019.2.0: This argument can now support a list of templates to be rendered.  The resulting configuration text is loaded at once, as a single configuration chunk.
template_source: None Inline config template to be rendered and loaded on the device.
template_hash: None Hash of the template file. Format: {hash_type: 'md5', 'hsum': <md5sum>}
context: None Overrides default context variables passed to the template.
template_hash_name: None When template_hash refers to a remote file, this specifies the filename to look for in that file.
saltenv: base Specifies the template environment.  This will influence the relative imports inside the templates.
template_engine: jinja The following templates engines are supported:
skip_verify: True If True, hash verification of remote file sources (http://, https://, ftp://) will be skipped, and the source_hash argument will be ignored.
test: False Dry run? If set to True, will apply the config, discard and return the changes.  Default: False and will commit the changes on the device.
commit: True Commit? (default: True)
debug: False Debug mode. Will insert a new key under the output dictionary, as loaded_config containing the raw result after the template was rendered.
replace: False Load and replace the configuration.
defaults: None Default variables/context passed to the template.
template_vars Dictionary with the arguments/context to be used when the template is rendered.
NOTE: Do not explicitly specify this argument. This represents any other variable that will be sent to the template rendering system.  Please see the examples below!
NOTE: It is more recommended to use the context argument to avoid conflicts between CLI arguments and template variables.
• result (bool): if the config was applied successfully. It is False only in case of failure. In case there are no changes to be applied and successfully performs all operations it is still True and so will be the already_configured flag (example below)
• loaded_config (str): the configuration loaded on the device, after rendering the template. Requires debug to be set as True
The template can use variables from the grains, pillar or opts, for example:
{% set router_model = grains.get('model') -%} {% set router_vendor = grains.get('vendor') -%} {% set os_version = grains.get('version') -%} {% set hostname = pillar.get('proxy', {}).get('host') -%} {% if router_vendor|lower == 'juniper' %} system { host-name {{hostname}}; } {% elif router_vendor|lower == 'cisco' %} hostname {{hostname}} {% endif %}
salt '*' net.load_template set_ntp_peers peers=[192.168.0.1]  # uses NAPALM default templates
# inline template: salt -G 'os:junos' net.load_template template_source='system { host-name {{host_name}}; }'         host_name='MX480.lab'
# inline template using grains info: salt -G 'os:junos' net.load_template         template_source='system { host-name {{grains.model}}.lab; }' # if the device is a MX480, the command above will set the hostname as: MX480.lab
# inline template using pillar data: salt -G 'os:junos' net.load_template template_source='system { host-name {{pillar.proxy.host}}; }'
salt '*' net.load_template https://bit.ly/2OhSgqP hostname=example  # will commit salt '*' net.load_template https://bit.ly/2OhSgqP hostname=example test=True  # dry run
salt '*' net.load_template salt://templates/example.jinja debug=True  # Using the salt:// URI
# render a mako template: salt '*' net.load_template salt://templates/example.mako template_engine=mako debug=True
# render remote template salt -G 'os:junos' net.load_template http://bit.ly/2fReJg7 test=True debug=True peers=['192.168.0.1'] salt -G 'os:ios' net.load_template http://bit.ly/2gKOj20 test=True debug=True peers=['192.168.0.1']
# render multiple templates at once salt '*' net.load_template "['https://bit.ly/2OhSgqP', 'salt://templates/example.jinja']" context="{'hostname': 'example'}"
{ 'comment': '', 'already_configured': False, 'result': True, 'diff': '[edit system]+  host-name edge01.bjm01', 'loaded_config': 'system { host-name edge01.bjm01; }'' }
salt.modules.napalm_network.mac(address='', interface='', vlan=0, **kwargs) Returns the MAC Address Table on the device.
• address -- MAC address to filter on
• interface -- Interface name to filter on
• vlan -- VLAN identifier
Returns A list of dictionaries representing the entries in the MAC Address Table
salt '*' net.mac salt '*' net.mac vlan=10
[ { 'mac'       : '00:1c:58:29:4a:71', 'interface' : 'xe-3/0/2', 'static'    : False, 'active'    : True, 'moves'     : 1, 'vlan'      : 10, 'last_move' : 1454417742.58 }, { 'mac'       : '8c:60:4f:58:e1:c1', 'interface' : 'xe-1/0/1', 'static'    : False, 'active'    : True, 'moves'     : 2, 'vlan'      : 42, 'last_move' : 1453191948.11 } ]
salt.modules.napalm_network.optics(**kwargs) New in version 2017.7.0.
Fetches the power usage on the various transceivers installed on the network device (in dBm), and returns a view that conforms with the OpenConfig model openconfig-platform-transceiver.yang.
Returns a dictionary where the keys are as listed below:
intf_name (unicode)
physical_channels
channels (list of dicts)
• index (int)
input_power
• instant (float)
• avg (float)
• min (float)
• max (float)
output_power
laser_bias_current
salt '*' net.optics
salt.modules.napalm_network.patch(patchfile, options='', saltenv='base', source_hash=None, show_changes=True, source='running', path=None, test=False, commit=True, debug=False, replace=True) New in version 2019.2.0.
Apply a patch to the configuration source, and load the result into the running config of the device.
patchfile A patch file to apply to the configuration source.
source_hash If the patch file (specified via the patchfile argument) is an HTTP(S) or FTP URL and the file exists in the minion's file cache, this option can be passed to keep the minion from re-downloading the file if the cached copy matches the specified hash.
path: None Save the temporary configuration to a specific path, then read from there. This argument is optional, can the user prefers a particular location of the temporary file.
salt '*' net.patch https://example.com/running_config.patch
salt.modules.napalm_network.ping(destination, source=None, ttl=None, timeout=None, size=None, count=None, vrf=None, **kwargs) Executes a ping on the network device and returns a dictionary as a result.
destination Hostname or IP address of remote host
source Source address of echo request
ttl    IP time-to-live value (IPv6 hop-limit value) (1..255 hops)
timeout Maximum wait time after sending final packet (seconds)
size   Size of request packets (0..65468 bytes)
count  Number of ping requests to send (1..2000000000 packets)
vrf    VRF (routing instance) for ping attempt
New in version 2016.11.4.
salt '*' net.ping 8.8.8.8 salt '*' net.ping 8.8.8.8 ttl=3 size=65468 salt '*' net.ping 8.8.8.8 source=127.0.0.1 timeout=1 count=100
salt.modules.napalm_network.replace_pattern(pattern, repl, count=0, flags=8, bufsize=1, append_if_not_found=False, prepend_if_not_found=False, not_found_content=None, search_only=False, show_changes=True, backslash_literal=False, source=None, path=None, test=False, replace=True, debug=False, commit=True) New in version 2019.2.0.
Replace occurrences of a pattern in the configuration source. If show_changes is True, then a diff of what changed will be returned, otherwise a True will be returned when changes are made, and False when no changes are made.  This is a pure Python implementation that wraps Python's sub().
repl   The replacement text.
flags (list or int): 8 A list of flags defined in the re module documentation from the Python standard library. Each list item should be a string that will correlate to the human-friendly flag name. E.g., ['IGNORECASE', 'MULTILINE']. Optionally, flags may be an int, with a value corresponding to the XOR (|) of all the desired flags. Defaults to 8 (which supports 'MULTILINE').
bufsize (int or str): 1 How much of the configuration to buffer into memory at once. The default value 1 processes one line at a time. The special value file may be specified which will read the entire file into memory before processing.
append_if_not_found: False If set to True, and pattern is not found, then the content will be appended to the file.
prepend_if_not_found: False If set to True and pattern is not found, then the content will be prepended to the file.
not_found_content Content to use for append/prepend if not found. If None (default), uses repl. Useful when repl uses references to group in pattern.
backslash_literal: False Interpret backslashes as literal backslashes for the repl and not escape characters.  This will help when using append/prepend so that the backslashes are not interpreted for the repl on the second run of the state.
path   Save the temporary configuration to a specific path, then read from there.
salt '*' net.replace_pattern "bind-address\s*=" "bind-address:"
salt '*' net.replace_pattern PREFIX-LIST_NAME new-prefix-list-name salt '*' net.replace_pattern bgp-group-name new-bgp-group-name count=1
salt.modules.napalm_network.rollback(inherit_napalm_device=None, **kwargs) Rollbacks the configuration.
salt '*' net.rollback
salt.modules.napalm_network.save_config(source=None, path=None) New in version 2019.2.0.
Save the configuration to a file on the local file system.
source: running The configuration source. Choose from: running, candidate, startup. Default: running.
path   Absolute path to file where to save the configuration.  To push the files to the Master, use cp.push Execution function.
salt '*' net.save_config source=running
salt.modules.napalm_network.traceroute(destination, source=None, ttl=None, timeout=None, vrf=None, **kwargs) Calls the method traceroute from the NAPALM driver object and returns a dictionary with the result of the traceroute command executed on the device.
destination Hostname or address of remote host
source Source address to use in outgoing traceroute packets
ttl    IP maximum time-to-live value (or IPv6 maximum hop-limit value)
timeout Number of seconds to wait for response (seconds)
vrf    VRF (routing instance) for traceroute attempt
salt '*' net.traceroute 8.8.8.8 salt '*' net.traceroute 8.8.8.8 source=127.0.0.1 ttl=5 timeout=1
salt.modules.napalm_ntp NAPALM NTP Manages NTP on network devices.
Dependencies • NAPALM proxy minion
• NET basic features
SEE ALSO: NTP peers management state
salt.modules.napalm_ntp.delete_peers(*peers, **options) Removes NTP peers configured on the device.
• peers -- list of IP Addresses/Domain Names to be removed as NTP peers
• (bool) (commit) -- discard loaded config. By default test is False (will not dicard the changes)
• (bool) -- commit loaded config. By default commit is True (will commit the changes). Useful when the user does not want to commit after each change, but after a couple.
By default this function will commit the config changes (if any). To load without committing, use the commit option. For a dry run, use the test argument.
salt '*' ntp.delete_peers 8.8.8.8 time.apple.com salt '*' ntp.delete_peers 172.17.17.1 test=True  # only displays the diff salt '*' ntp.delete_peers 192.168.0.1 commit=False  # preserves the changes, but does not commit
salt.modules.napalm_ntp.delete_servers(*servers, **options) Removes NTP servers configured on the device.
• servers -- list of IP Addresses/Domain Names to be removed as NTP servers
By default this function will commit the config changes (if any). To load without committing, use the commit option. For dry run use the test argument.
salt '*' ntp.delete_servers 8.8.8.8 time.apple.com salt '*' ntp.delete_servers 172.17.17.1 test=True  # only displays the diff salt '*' ntp.delete_servers 192.168.0.1 commit=False  # preserves the changes, but does not commit
salt.modules.napalm_ntp.peers(**kwargs) Returns a list the NTP peers configured on the network device.
Returns configured NTP peers as list.
salt '*' ntp.peers
[ '192.168.0.1', '172.17.17.1', '172.17.17.2', '2400:cb00:6:1024::c71b:840a' ]
salt.modules.napalm_ntp.servers(**kwargs) Returns a list of the configured NTP servers on the device.
salt '*' ntp.servers
salt.modules.napalm_ntp.set_peers(*peers, **options) Configures a list of NTP peers on the device.
• peers -- list of IP Addresses/Domain Names
• (bool) (test) -- discard loaded config. By default test is False (will not dicard the changes)
Commit commit (bool) commit loaded config. By default commit is True (will commit the changes). Useful when the user does not want to commit after each change, but after a couple.
salt '*' ntp.set_peers 192.168.0.1 172.17.17.1 time.apple.com salt '*' ntp.set_peers 172.17.17.1 test=True  # only displays the diff salt '*' ntp.set_peers 192.168.0.1 commit=False  # preserves the changes, but does not commit
salt.modules.napalm_ntp.set_servers(*servers, **options) Configures a list of NTP servers on the device.
• servers -- list of IP Addresses/Domain Names
salt '*' ntp.set_servers 192.168.0.1 172.17.17.1 time.apple.com salt '*' ntp.set_servers 172.17.17.1 test=True  # only displays the diff salt '*' ntp.set_servers 192.168.0.1 commit=False  # preserves the changes, but does not commit
salt.modules.napalm_ntp.stats(peer=None, **kwargs) Returns a dictionary containing synchronization details of the NTP peers.
Parameters peer -- Returns only the details of a specific NTP peer.
Returns a list of dictionaries, with the following keys:
• remote
• referenceid
• synchronized
• stratum
• type
• when
• hostpoll
• reachability
• delay
• offset
• jitter
salt '*' ntp.stats
[ { 'remote'        : '188.114.101.4', 'referenceid'   : '188.114.100.1', 'synchronized'  : True, 'stratum'       : 4, 'type'          : '-', 'when'          : '107', 'hostpoll'      : 256, 'reachability'  : 377, 'delay'         : 164.228, 'offset'        : -13.866, 'jitter'        : 2.695 } ]
salt.modules.napalm_probes NAPALM Probes Manages RPM/SLA probes on the network device.
SEE ALSO: Probes configuration management state
salt.modules.napalm_probes.config(**kwargs) Returns the configuration of the RPM probes.
Returns A dictionary containing the configuration of the RPM/SLA probes.
salt '*' probes.config
{ 'probe1':{ 'test1': { 'probe_type'   : 'icmp-ping', 'target'       : '192.168.0.1', 'source'       : '192.168.0.2', 'probe_count'  : 13, 'test_interval': 3 }, 'test2': { 'probe_type'   : 'http-ping', 'target'       : '172.17.17.1', 'source'       : '192.17.17.2', 'probe_count'  : 5, 'test_interval': 60 } } }
salt.modules.napalm_probes.delete_probes(probes, test=False, commit=True, **kwargs) Removes RPM/SLA probes from the network device.  Calls the configuration template 'delete_probes' from the NAPALM library, providing as input a rich formatted dictionary with the configuration details of the probes to be removed from the configuration of the device.
• probes -- Dictionary with a similar format as the output dictionary of the function config(), where the details are not necessary.
• test -- Dry run? If set as True, will apply the config, discard and return the changes. Default: False
• commit -- Commit? (default: True) Sometimes it is not needed to commit the config immediately after loading the changes. E.g.: a state loads a couple of parts (add / remove / update) and would not be optimal to commit after each operation.  Also, from the CLI when the user needs to apply the similar changes before committing, can specify commit=False and will not discard the config.
Raises MergeConfigException -- If there is an error on the configuration sent.
Returns A dictionary having the following keys:
Input example:
probes = { 'existing_probe':{ 'existing_test1': {}, 'existing_test2': {} } }
salt.modules.napalm_probes.results(**kwargs) Provides the results of the measurements of the RPM/SLA probes.
:return a dictionary with the results of the probes.
salt '*' probes.results
{ 'probe1':  { 'test1': { 'last_test_min_delay'   : 63.120, 'global_test_min_delay' : 62.912, 'current_test_avg_delay': 63.190, 'global_test_max_delay' : 177.349, 'current_test_max_delay': 63.302, 'global_test_avg_delay' : 63.802, 'last_test_avg_delay'   : 63.438, 'last_test_max_delay'   : 65.356, 'probe_type'            : 'icmp-ping', 'rtt'                   : 63.138, 'last_test_loss'        : 0, 'round_trip_jitter'     : -59.0, 'target'                : '192.168.0.1', 'source'                : '192.168.0.2', 'probe_count'           : 15, 'current_test_min_delay': 63.138 }, 'test2': { 'last_test_min_delay'   : 176.384, 'global_test_min_delay' : 169.226, 'current_test_avg_delay': 177.098, 'global_test_max_delay' : 292.628, 'current_test_max_delay': 180.055, 'global_test_avg_delay' : 177.959, 'last_test_avg_delay'   : 177.178, 'last_test_max_delay'   : 184.671, 'probe_type'            : 'icmp-ping', 'rtt'                   : 176.449, 'last_test_loss'        : 0, 'round_trip_jitter'     : -34.0, 'target'                : '172.17.17.1', 'source'                : '172.17.17.2', 'probe_count'           : 15, 'current_test_min_delay': 176.402 } } }
salt.modules.napalm_probes.schedule_probes(probes, test=False, commit=True, **kwargs) Will schedule the probes. On Cisco devices, it is not enough to define the probes, it is also necessary to schedule them.
This function calls the configuration template schedule_probes from the NAPALM library, providing as input a rich formatted dictionary with the names of the probes and the tests to be scheduled.
probes = { 'new_probe':{ 'new_test1': {}, 'new_test2': {} } }
salt.modules.napalm_probes.set_probes(probes, test=False, commit=True, **kwargs) Configures RPM/SLA probes on the device.  Calls the configuration template 'set_probes' from the NAPALM library, providing as input a rich formatted dictionary with the configuration details of the probes to be configured.
• probes -- Dictionary formatted as the output of the function config()
Return a dictionary having the following keys
Input example - via state/script:
probes = { 'new_probe':{ 'new_test1': { 'probe_type'   : 'icmp-ping', 'target'       : '192.168.0.1', 'source'       : '192.168.0.2', 'probe_count'  : 13, 'test_interval': 3 }, 'new_test2': { 'probe_type'   : 'http-ping', 'target'       : '172.17.17.1', 'source'       : '192.17.17.2', 'probe_count'  : 5, 'test_interval': 60 } } } set_probes(probes)
CLI Example - to push changes on the fly (not recommended):
salt 'junos_minion' probes.set_probes "{'new_probe':{'new_test1':{'probe_type':'icmp-ping',            'target':'192.168.0.1','source':'192.168.0.2','probe_count':13,'test_interval':3}}}" test=True
Output example - for the CLI example above:
junos_minion: ---------- already_configured: False comment: Configuration discarded. diff: [edit services rpm] probe transit { ... } +    probe new_probe { +        test new_test1 { +            probe-type icmp-ping; +            target address 192.168.0.1; +            probe-count 13; +            test-interval 3; +            source-address 192.168.0.2; +        } +    } result: True
salt.modules.napalm_route NAPALM Route Retrieves route details from network devices.
salt.modules.napalm_route.show(destination, protocol=None, **kwargs) Displays all details for a certain route learned via a specific protocol.  If the protocol is not specified, will return all possible routes.
NOTE: This function return the routes from the RIB.  In case the destination prefix is too short, there may be too many routes matched.  Therefore in cases of devices having a very high number of routes it may be necessary to adjust the prefix length and request using a longer prefix.
destination destination prefix.
protocol (optional) protocol used to learn the routes to the destination.
salt 'my_router' route.show 172.16.0.0/25 salt 'my_router' route.show 172.16.0.0/25 bgp
{ '172.16.0.0/25': [ { 'protocol': 'BGP', 'last_active': True, 'current_active': True, 'age': 1178693, 'routing_table': 'inet.0', 'next_hop': '192.168.0.11', 'outgoing_interface': 'xe-1/1/1.100', 'preference': 170, 'selected_next_hop': False, 'protocol_attributes': { 'remote_as': 65001, 'metric': 5, 'local_as': 13335, 'as_path': '', 'remote_address': '192.168.0.11', 'metric2': 0, 'local_preference': 0, 'communities': [ '0:2', 'no-export' ], 'preference2': -1 }, 'inactive_reason': '' }, { 'protocol': 'BGP', 'last_active': False, 'current_active': False, 'age': 2359429, 'routing_table': 'inet.0', 'next_hop': '192.168.0.17', 'outgoing_interface': 'xe-1/1/1.100', 'preference': 170, 'selected_next_hop': True, 'protocol_attributes': { 'remote_as': 65001, 'metric': 5, 'local_as': 13335, 'as_path': '', 'remote_address': '192.168.0.17', 'metric2': 0, 'local_preference': 0, 'communities': [ '0:3', 'no-export' ], 'preference2': -1 }, 'inactive_reason': 'Not Best in its group - Router ID' } ] }
salt.modules.napalm_snmp NAPALM SNMP Manages SNMP on network devices.
SEE ALSO: SNMP configuration management state
salt.modules.napalm_snmp.config(**kwargs) Returns the SNMP configuration
salt '*' snmp.config
salt.modules.napalm_snmp.remove_config(chassis_id=None, community=None, contact=None, location=None, test=False, commit=True, **kwargs) Removes a configuration element from the SNMP configuration.
• chassis_id -- (optional) Chassis ID
• community -- (optional) A dictionary having the following optional keys:
• acl (if any policy / ACL need to be set)
• mode: rw or ro. Default: ro
• contact -- Contact details
• location -- Location
salt '*' snmp.remove_config community='abcd'
salt.modules.napalm_snmp.update_config(chassis_id=None, community=None, contact=None, location=None, test=False, commit=True, **kwargs) Updates the SNMP configuration.
salt 'edge01.lon01' snmp.update_config location="Greenwich, UK" test=True
Output example (for the CLI example above):
edge01.lon01: ---------- already_configured: False comment: Configuration discarded. diff: [edit snmp] -  location "London, UK"; +  location "Greenwich, UK"; result: True
salt.modules.napalm_users NAPALM Users Manages the configuration of the users on network devices.
SEE ALSO: Users management state
salt.modules.napalm_users.config(**kwargs) Returns the configuration of the users on the device
salt '*' users.config
{ 'mircea': { 'level': 15, 'password': '$1$0P70xKPa$4jt5/10cBTckk6I/w/', 'sshkeys': [ 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4pFn+shPwTb2yELO4L7NtQrKOJXNeCl1je                    l9STXVaGnRAnuc2PXl35vnWmcUq6YbUEcgUTRzzXfmelJKuVJTJIlMXii7h2xkbQp0YZIEs4P                    8ipwnRBAxFfk/ZcDsN3mjep4/yjN56ejk345jhk345jk345jk341p3A/9LIL7l6YewLBCwJj6                    D+fWSJ0/YW+7oH17Fk2HH+tw0L5PcWLHkwA4t60iXn16qDbIk/ze6jv2hDGdCdz7oYQeCE55C                    CHOHMJWYfN3jcL4s0qv8/u6Ka1FVkV7iMmro7ChThoV/5snI4Ljf2wKqgHH7TfNaCfpU0WvHA                    nTs8zhOrGScSrtb mircea@master-roshi' ] } }
salt.modules.napalm_users.delete_users(users, test=False, commit=True, **kwargs) Removes users from the configuration of network devices.
• users -- Dictionary formatted as the output of the function config()
salt '*' users.delete_users "{'mircea': {}}"
salt.modules.napalm_users.set_users(users, test=False, commit=True, **kwargs) Configures users on network devices.
salt '*' users.set_users "{'mircea': {}}"
salt.modules.napalm_yang_mod NAPALM YANG NAPALM YANG basic operations.
salt.modules.napalm_yang_mod.compliance_report(data, *models, **kwargs) Return the compliance report using YANG objects.
data   Dictionary structured with respect to the models referenced.
models A list of models to be used when generating the config.
salt '*' napalm_yang.compliance_report {} models.openconfig_interfaces filepath=~/validate.yml
{ "skipped": [], "complies": true, "get_interfaces_ip": { "missing": [], "complies": true, "present": { "ge-0/0/0.0": { "complies": true, "nested": true } }, "extra": [] } }
salt.modules.napalm_yang_mod.diff(candidate, running, *models) Returns the difference between two configuration entities structured according to the YANG model.
NOTE: This function is recommended to be used mostly as a state helper.
candidate First model to compare.
running Second model to compare.
models A list of models to be used when comparing.
salt '*' napalm_yang.diff {} {} models.openconfig_interfaces
{ "interfaces": { "interface": { "both": { "Port-Channel1": { "config": { "mtu": { "first": "0", "second": "9000" } } } }, "first_only": [ "Loopback0" ], "second_only": [ "Loopback1" ] } } }
salt.modules.napalm_yang_mod.get_config(data, *models, **kwargs) Return the native config.
profiles: None Use certain profiles to generate the config.  If not specified, will use the platform default profile(s).
salt '*' napalm_yang.get_config {} models.openconfig_interfaces
interface et1 ip address 192.168.1.1/24 description Uplink1 mtu 9000 interface et2 ip address 192.168.2.1/24 description Uplink2 mtu 9000
salt.modules.napalm_yang_mod.load_config(data, *models, **kwargs) Generate and load the config on the device using the OpenConfig or IETF models and device profiles.
replace: False Should replace the config with the new generate one?
salt '*' napalm_yang.load_config {} models.openconfig_interfaces test=True debug=True
device1: ---------- already_configured: False comment: diff: [edit interfaces ge-0/0/0] -   mtu 1400; [edit interfaces ge-0/0/0 unit 0 family inet] -       dhcp; [edit interfaces lo0] -    unit 0 { -        description lo0.0; -    } +    unit 1 { +        description "new loopback"; +    } loaded_config: <configuration> <interfaces replace="replace"> <interface> <name>ge-0/0/0</name> <unit> <name>0</name> <family> <inet/> </family> <description>ge-0/0/0.0</description> </unit> <description>management interface</description> </interface> <interface> <name>ge-0/0/1</name> <disable/> <description>ge-0/0/1</description> </interface> <interface> <name>ae0</name> <unit> <name>0</name> <vlan-id>100</vlan-id> <family> <inet> <address> <name>192.168.100.1/24</name> </address> <address> <name>172.20.100.1/24</name> </address> </inet> </family> <description>a description</description> </unit> <vlan-tagging/> <unit> <name>1</name> <vlan-id>1</vlan-id> <family> <inet> <address> <name>192.168.101.1/24</name> </address> </inet> </family> <disable/> <description>ae0.1</description> </unit> <vlan-tagging/> <unit> <name>2</name> <vlan-id>2</vlan-id> <family> <inet> <address> <name>192.168.102.1/24</name> </address> </inet> </family> <description>ae0.2</description> </unit> <vlan-tagging/> </interface> <interface> <name>lo0</name> <unit> <name>1</name> <description>new loopback</description> </unit> <description>lo0</description> </interface> </interfaces> </configuration> result: True
salt.modules.napalm_yang_mod.parse(*models, **kwargs) Parse configuration from the device.
models A list of models to be used when parsing.
config: False Parse config.
state: False Parse state.
profiles: None Use certain profiles to parse. If not specified, will use the device default profile(s).
salt '*' napalm_yang.parse models.openconfig_interfaces
{ "interfaces": { "interface": { ".local.": { "name": ".local.", "state": { "admin-status": "UP", "counters": { "in-discards": 0, "in-errors": 0, "out-errors": 0 }, "enabled": True, "ifindex": 0, "last-change": 0, "oper-status": "UP", "type": "softwareLoopback" }, "subinterfaces": { "subinterface": { ".local..0": { "index": ".local..0", "state": { "ifindex": 0, "name": ".local..0" } } } } }, "ae0": { "name": "ae0", "state": { "admin-status": "UP", "counters": { "in-discards": 0, "in-errors": 0, "out-errors": 0 }, "enabled": True, "ifindex": 531, "last-change": 255203, "mtu": 1518, "oper-status": "DOWN" }, "subinterfaces": { "subinterface": { "ae0.0": { "index": "ae0.0", "state": { "description": "ASDASDASD", "ifindex": 532, "name": "ae0.0" } } "ae0.32767": { "index": "ae0.32767", "state": { "ifindex": 535, "name": "ae0.32767" } } } } }, "dsc": { "name": "dsc", "state": { "admin-status": "UP", "counters": { "in-discards": 0, "in-errors": 0, "out-errors": 0 }, "enabled": True, "ifindex": 5, "last-change": 0, "oper-status": "UP" } }, "ge-0/0/0": { "name": "ge-0/0/0", "state": { "admin-status": "UP", "counters": { "in-broadcast-pkts": 0, "in-discards": 0, "in-errors": 0, "in-multicast-pkts": 0, "in-unicast-pkts": 16877, "out-broadcast-pkts": 0, "out-errors": 0, "out-multicast-pkts": 0, "out-unicast-pkts": 15742 }, "description": "management interface", "enabled": True, "ifindex": 507, "last-change": 258467, "mtu": 1400, "oper-status": "UP" }, "subinterfaces": { "subinterface": { "ge-0/0/0.0": { "index": "ge-0/0/0.0", "state": { "description": "ge-0/0/0.0", "ifindex": 521, "name": "ge-0/0/0.0" } } } } } "irb": { "name": "irb", "state": { "admin-status": "UP", "counters": { "in-discards": 0, "in-errors": 0, "out-errors": 0 }, "enabled": True, "ifindex": 502, "last-change": 0, "mtu": 1514, "oper-status": "UP", "type": "ethernetCsmacd" } }, "lo0": { "name": "lo0", "state": { "admin-status": "UP", "counters": { "in-discards": 0, "in-errors": 0, "out-errors": 0 }, "description": "lo0", "enabled": True, "ifindex": 6, "last-change": 0, "oper-status": "UP", "type": "softwareLoopback" }, "subinterfaces": { "subinterface": { "lo0.0": { "index": "lo0.0", "state": { "description": "lo0.0", "ifindex": 16, "name": "lo0.0" } }, "lo0.16384": { "index": "lo0.16384", "state": { "ifindex": 21, "name": "lo0.16384" } }, "lo0.16385": { "index": "lo0.16385", "state": { "ifindex": 22, "name": "lo0.16385" } }, "lo0.32768": { "index": "lo0.32768", "state": { "ifindex": 248, "name": "lo0.32768" } } } } } } } }
salt.modules.netaddress Module for getting information about network addresses.
depends netaddr
salt.modules.netaddress.cidr_broadcast(cidr) Get the broadcast address associated with a CIDR address.
salt myminion netaddress.cidr_netmask 192.168.0.0/20
salt.modules.netaddress.cidr_netmask(cidr) Get the netmask address associated with a CIDR address.
salt.modules.netaddress.list_cidr_ips(cidr) Get a list of IP addresses from a CIDR.
salt myminion netaddress.list_cidr_ips 192.168.0.0/20
salt.modules.netaddress.list_cidr_ips_ipv6(cidr) Get a list of IPv6 addresses from a CIDR.
salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20
salt.modules.netbox NetBox Module to query NetBox
codeauthor Zach Moody <zmoody@do.co>
depends pynetbox
The following config should be in the minion config file. In order to work with secrets you should provide a token and path to your private key file:
netbox: url: <NETBOX_URL> token: <NETBOX_USERNAME_API_TOKEN (OPTIONAL)> keyfile: </PATH/TO/NETBOX/KEY (OPTIONAL)>
salt.modules.netbox.create_circuit(name, provider_id, circuit_type, description=None) New in version 2019.2.0.
Create a new Netbox circuit
name   Name of the circuit
provider_id The netbox id of the circuit provider
circuit_type The name of the circuit type
asn    The ASN of the circuit provider
description The description of the circuit
salt myminion netbox.create_circuit NEW_CIRCUIT_01 Telia Transit 1299 "New Telia circuit"
salt.modules.netbox.create_circuit_provider(name, asn=None) New in version 2019.2.0.
Create a new Netbox circuit provider
name   The name of the circuit provider
salt myminion netbox.create_circuit_provider Telia 1299
salt.modules.netbox.create_circuit_termination(circuit, interface, device, speed, xconnect_id=None, term_side='A') New in version 2019.2.0.
Terminate a circuit on an interface
circuit The name of the circuit
interface The name of the interface to terminate on
device The name of the device the interface belongs to
speed  The speed of the circuit, in Kbps
xconnect_id The cross-connect identifier
term_side The side of the circuit termination
salt myminion netbox.create_circuit_termination NEW_CIRCUIT_01 xe-0/0/1 myminion 10000 xconnect_id=XCON01
salt.modules.netbox.create_circuit_type(name) New in version 2019.2.0.
Create a new Netbox circuit type.
name   The name of the circuit type
salt myminion netbox.create_circuit_type Transit
salt.modules.netbox.create_device(name, role, model, manufacturer, site) New in version 2019.2.0.
Create a new device with a name, role, model, manufacturer and site.  All these components need to be already in Netbox.
name   The name of the device, e.g., edge_router
role   String of device role, e.g., router
model  String of device model, e.g., MX480
manufacturer String of device manufacturer, e.g., Juniper
site   String of device site, e.g., BRU
salt myminion netbox.create_device edge_router router MX480 Juniper BRU
salt.modules.netbox.create_device_role(role, color) New in version 2019.2.0.
Create a device role
salt myminion netbox.create_device_role router
salt.modules.netbox.create_device_type(model, manufacturer) New in version 2019.2.0.
Create a device type. If the manufacturer doesn't exist, create a new manufacturer.
salt myminion netbox.create_device_type MX480 Juniper
salt.modules.netbox.create_interface(device_name, interface_name, mac_address=None, description=None, enabled=None, lag=None, lag_parent=None, form_factor=None) New in version 2019.2.0.
Attach an interface to a device. If not all arguments are provided, they will default to Netbox defaults.
device_name The name of the device, e.g., edge_router
interface_name The name of the interface, e.g., TenGigE0/0/0/0
mac_address String of mac address, e.g., 50:87:89:73:92:C8
description String of interface description, e.g., NTT
enabled String of boolean interface status, e.g., True
lag:   Boolean of interface lag status, e.g., True
lag_parent String of interface lag parent name, e.g., ae13
form_factor Integer of form factor id, obtained through _choices API endpoint, e.g., 200
salt myminion netbox.create_interface edge_router ae13 description="Core uplink"
salt.modules.netbox.create_interface_connection(interface_a, interface_b) New in version 2019.2.0.
Create an interface connection between 2 interfaces
interface_a Interface id for Side A
interface_b Interface id for Side B
salt myminion netbox.create_interface_connection 123 456
salt.modules.netbox.create_inventory_item(device_name, item_name, manufacturer_name=None, serial='', part_id='', description='') New in version 2019.2.0.
Add an inventory item to an existing device.
device_name The name of the device, e.g., edge_router.
item_name String of inventory item name, e.g., Transceiver.
manufacturer_name String of inventory item manufacturer, e.g., Fiberstore.
serial String of inventory item serial, e.g., FS1238931.
part_id String of inventory item part id, e.g., 740-01234.
description String of inventory item description, e.g., SFP+-10G-LR.
salt myminion netbox.create_inventory_item edge_router Transceiver part_id=740-01234
salt.modules.netbox.create_ipaddress(ip_address, family, device=None, interface=None) New in version 2019.2.0.
Add an IP address, and optionally attach it to an interface.
ip_address The IP address and CIDR, e.g., 192.168.1.1/24
family Integer of IP family, e.g., 4
device The name of the device to attach IP to, e.g., edge_router
interface The name of the interface to attach IP to, e.g., ae13
salt myminion netbox.create_ipaddress 192.168.1.1/24 4 device=edge_router interface=ae13
salt.modules.netbox.create_manufacturer(name) New in version 2019.2.0.
Create a device manufacturer.
name   The name of the manufacturer, e.g., Juniper
salt myminion netbox.create_manufacturer Juniper
salt.modules.netbox.create_platform(platform) New in version 2019.2.0.
Create a new device platform
platform String of device platform, e.g., junos
salt myminion netbox.create_platform junos
salt.modules.netbox.create_site(site) New in version 2019.2.0.
Create a new device site
salt myminion netbox.create_site BRU
salt.modules.netbox.delete_interface(device_name, interface_name) New in version 2019.2.0.
Delete an interface from a device.
interface_name The name of the interface, e.g., ae13
salt myminion netbox.delete_interface edge_router ae13
salt.modules.netbox.delete_inventory_item(item_id) New in version 2019.2.0.
Remove an item from a devices inventory. Identified by the netbox id
item_id Integer of item to be deleted
salt myminion netbox.delete_inventory_item 1354
salt.modules.netbox.delete_ipaddress(ipaddr_id) New in version 2019.2.0.
Delete an IP address. IP addresses in Netbox are a combination of address and the interface it is assigned to.
id     The Netbox id for the IP address.
salt myminion netbox.delete_ipaddress 9002
salt.modules.netbox.filter_(app, endpoint, **kwargs) Get a list of items from NetBox.
app    String of netbox app, e.g., dcim, circuits, ipam
endpoint String of app endpoint, e.g., sites, regions, devices
kwargs Optional arguments that can be used to filter.  All filter keywords are available in Netbox, which can be found by surfing to the corresponding API endpoint, and clicking Filters. e.g., role=router
Returns a list of dictionaries
salt myminion netbox.filter dcim devices status=1 role=router
salt.modules.netbox.get_(app, endpoint, id=None, **kwargs) Get a single item from NetBox.
Returns a single dictionary
To get an item based on ID.
salt myminion netbox.get dcim devices id=123
Or using named arguments that correspond with accepted filters on the NetBox endpoint.
salt myminion netbox.get dcim devices name=my-router
salt.modules.netbox.get_circuit_provider(name, asn=None) New in version 2019.2.0.
Get a circuit provider with a given name and optional ASN.
salt myminion netbox.get_circuit_provider Telia 1299
salt.modules.netbox.get_interfaces(device_name=None, **kwargs) New in version 2019.2.0.
Returns interfaces for a specific device using arbitrary netbox filters
kwargs Optional arguments to be used for filtering
salt myminion netbox.get_interfaces edge_router name="et-0/0/5"
salt.modules.netbox.get_ipaddresses(device_name=None, **kwargs) New in version 2019.2.0.
Filters for an IP address using specified filters
device_name The name of the device to check for the IP address
kwargs Optional arguments that can be used to filter, e.g., family=4
salt myminion netbox.get_ipaddresses device_name family=4
salt.modules.netbox.make_interface_child(device_name, interface_name, parent_name) New in version 2019.2.0.
Set an interface as part of a LAG.
interface_name The name of the interface to be attached to LAG, e.g., xe-1/0/2.
parent_name The name of the LAG interface, e.g., ae13.
salt myminion netbox.make_interface_child xe-1/0/2 ae13
salt.modules.netbox.make_interface_lag(device_name, interface_name) New in version 2019.2.0.
Update an interface to be a LAG.
interface_name The name of the interface, e.g., ae13.
salt myminion netbox.make_interface_lag edge_router ae13
salt.modules.netbox.openconfig_interfaces(device_name=None) New in version 2019.2.0.
Return a dictionary structured as standardised in the openconfig-interfaces YANG model, containing physical and configuration data available in Netbox, e.g., IP addresses, MTU, enabled / disabled, etc.
device_name: None The name of the device to query the interface data for. If not provided, will use the Minion ID.
salt '*' netbox.openconfig_interfaces salt '*' netbox.openconfig_interfaces device_name=cr1.thn.lon
salt.modules.netbox.openconfig_lacp(device_name=None) New in version 2019.2.0.
Return a dictionary structured as standardised in the openconfig-lacp YANG model, with configuration data for Link Aggregation Control Protocol (LACP) for aggregate interfaces.
NOTE: The interval and lacp_mode keys have the values set as SLOW and ACTIVE respectively, as this data is not currently available in Netbox, therefore defaulting to the values defined in the standard.  See interval and lacp-mode for further details.
device_name: None The name of the device to query the LACP information for. If not provided, will use the Minion ID.
salt '*' netbox.openconfig_lacp salt '*' netbox.openconfig_lacp device_name=cr1.thn.lon
salt.modules.netbox.slugify(value) ' Slugify given value.  Credit to Djangoproject https://docs.djangoproject.com/en/2.0/_modules/django/utils/text/#slugify
salt.modules.netbox.update_device(name, **kwargs) New in version 2019.2.0.
Add attributes to an existing device, identified by name.
kwargs Arguments to change in device, e.g., serial=JN2932930
salt myminion netbox.update_device edge_router serial=JN2932920
salt.modules.netbox.update_interface(device_name, interface_name, **kwargs) New in version 2019.2.0.
Update an existing interface with new attributes.
kwargs Arguments to change in interface, e.g., mac_address=50:87:69:53:32:D0
salt myminion netbox.update_interface edge_router ae13 mac_address=50:87:69:53:32:D0
salt.modules.netbsd_sysctl Module for viewing and modifying sysctl parameters
salt.modules.netbsd_sysctl.assign(name, value) Assign a single sysctl parameter for this minion
salt.modules.netbsd_sysctl.get(name) Return a single sysctl parameter for this minion
salt.modules.netbsd_sysctl.persist(name, value, config='/etc/sysctl.conf') Assign and persist a simple sysctl parameter for this minion
salt '*' sysctl.persist net.inet.icmp.icmplim 50
salt.modules.netbsd_sysctl.show(config_file=False) Return a list of sysctl parameters for this minion
salt.modules.netbsdservice The service module for NetBSD
salt.modules.netbsdservice.available(name) Returns True if the specified service is available, otherwise returns False.
salt.modules.netbsdservice.disable(name, **kwargs) Disable the named service to start at boot
salt.modules.netbsdservice.disabled(name) Return True if the named service is enabled, false otherwise
salt.modules.netbsdservice.enable(name, **kwargs) Enable the named service to start at boot
salt.modules.netbsdservice.enabled(name, **kwargs) Return True if the named service is enabled, false otherwise
salt.modules.netbsdservice.force_reload(name) Force-reload the named service
salt.modules.netbsdservice.get_all() Return all available boot services
salt.modules.netbsdservice.get_disabled() Return a set of services that are installed but disabled
salt.modules.netbsdservice.get_enabled() Return a list of service that are enabled on boot
salt.modules.netbsdservice.missing(name) The inverse of service.available.  Returns True if the specified service is not available, otherwise returns False.
salt.modules.netbsdservice.reload_(name) Reload the named service
salt.modules.netbsdservice.restart(name) Restart the named service
salt.modules.netbsdservice.start(name) Start the specified service
salt.modules.netbsdservice.status(name, sig=None) Return the status for a service.  If the name contains globbing, a dict mapping service name to True/False values is returned.
salt.modules.netbsdservice.stop(name) Stop the specified service
salt.modules.netmiko_mod Netmiko Execution Module New in version 2019.2.0.
Execution module to interface the connection with a remote network device. It is flexible enough to execute the commands both when running under a Netmiko Proxy Minion, as well as running under a Regular Minion by specifying the connection arguments, i.e., device_type, ip, username, password etc.
codeauthor Mircea Ulinic <ping@mirceaulinic.net> & Kirk Byers <‐ ktbyers@twb-tech.com>
depends netmiko
Dependencies The netmiko proxy modules requires Netmiko to be installed: pip install netmiko.
Usage This module can equally be used via the netmiko Proxy module (check documentation), or directly from an arbitrary (Proxy) Minion that is running on a server (computer) having access to the network device, and has the netmiko library installed.
When running outside of the netmiko Proxy (i.e., from another Proxy Minion type, or regular Minion), the netmiko connection arguments can be either specified from the CLI when executing the command, or in a configuration block under the netmiko key in the configuration opts (i.e., (Proxy) Minion configuration file), or Pillar. The module supports these simultaneously. These fields are the exact same supported by the netmiko Proxy Module:
• device_type - Class selection based on device type. Supported options:
• a10: A10 Networks
• accedian: Accedian Networks
• alcatel_aos: Alcatel AOS
• alcatel_sros: Alcatel SROS
• apresia_aeos: Apresia AEOS
• arista_eos: Arista EOS
• aruba_os: Aruba
• avaya_ers: Avaya ERS
• avaya_vsp: Avaya VSP
• brocade_fastiron: Brocade Fastiron
• brocade_netiron: Brocade Netiron
• brocade_nos: Brocade NOS
• brocade_vdx: Brocade NOS
• brocade_vyos: VyOS
• checkpoint_gaia: Check Point GAiA
• calix_b6: Calix B6
• ciena_saos: Ciena SAOS
• cisco_asa: Cisco SA
• cisco_ios: Cisco IOS
• cisco_nxos: Cisco NX-oS
• cisco_s300: Cisco S300
• cisco_tp: Cisco TpTcCe
• cisco_wlc: Cisco WLC
• cisco_xe: Cisco IOS
• cisco_xr: Cisco XR
• coriant: Coriant
• dell_force10: Dell Force10
• dell_os10: Dell OS10
• dell_powerconnect: Dell PowerConnect
• eltex: Eltex
• enterasys: Enterasys
• extreme: Extreme
• extreme_wing: Extreme Wing
• f5_ltm: F5 LTM
• fortinet: Fortinet
• generic_termserver: TerminalServer
• hp_comware: HP Comware
• hp_procurve: HP Procurve
• huawei: Huawei
• huawei_vrpv8: Huawei VRPV8
• juniper: Juniper Junos
• juniper_junos: Juniper Junos
• linux: Linux
• mellanox: Mellanox
• mrv_optiswitch: MrvOptiswitch
• netapp_cdot: NetAppcDot
• netscaler: Netscaler
• ovs_linux: OvsLinux
• paloalto_panos: PaloAlto Panos
• pluribus: Pluribus
• quanta_mesh: Quanta Mesh
• ruckus_fastiron: Ruckus Fastiron
• ubiquiti_edge: Ubiquiti Edge