Actions¶
add_config Action¶
- ztps.add_config.main(attributes)[source]¶
Adds startup-config section.
Appends config section to startup config based on the value of the ‘url’ attribute.
This action is dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
copy_file Action¶
- ztps.copy_file.main(attributes)[source]¶
Copies file to the switch.
Copies file based on the values of ‘src_url’ and ‘dst_url’ attributes (‘dst_url’ should point to the detination folder). If ‘overwrite’ is set to:
- ‘replace’: the file is copied to the switch regardless of whether there is already a file with the same name at the destination;
- ‘if-missing’: the file is copied to the switch only if there is not already a file with the same name at the destination; if there is, then the action is a no-op;
- ‘backup’: the file is copied to the switch; if there is already another file at the destination, that file is renamed by appending the ‘.backup’ suffix
If ‘overwrite’ is not set, then ‘replace’ is the default behaviour.
This action is NOT dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
install_cli_plugin Action¶
- ztps.install_cli_plugin.main(attributes)[source]¶
Installs EOS CliPlugin.
Installs CliPlugin based on the value of the ‘url’ attribute.
This action is NOT dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
install_extension Action¶
- ztps.install_extension.main(attributes)[source]¶
Installs EOS extension.
Installs extension based on the value of the ‘url’ attribute. If ‘force’ is set, then the dependency checks are overridden.
This action is NOT dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
install_image Action¶
- ztps.install_image.main(attributes)[source]¶
Installs software image on the switch.
If the current software image is the same as the ‘version’ attribute value, then this action is a no-op. Otherwise, the action will replace the existing software image.
For dual supervisor systems, the image on the active supervisor is used as reference.
This action is dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
replace_config Action¶
- ztps.replace_config.main(attributes)[source]¶
Replaces stratup-config on the switch.
Replaces/adds /mnt/flash/startup-config based on the value of the ‘url’ attribute.
This action is dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation
send_email Action¶
- ztps.send_email.main(attributes)[source]¶
Sends an email using an SMTP relay host
Generates an email from the bootstrap process and routes it through a smarthost. The parameters value expects a dictionary with the following values in order for this function to work properly.
{ 'smarthost': <hostname of smarthost>, 'sender': <from email address> 'receivers': [ <array of recipients to send email to> ], 'subject': <subject line of the message>, 'body': <the message body>, 'attachments': [ <array of files to attach> ], 'commands': [ <array of commands to run and attach> ] }
The required fields for this function are smarthost, sender, and receivers. All other fields are optional.
This action is dual-supervisor compatible.
Parameters: attributes – list of attributes; use attributes.get(<ATTRIBUTE_NAME>) to read attribute values - :param Special attributes::
- node: attributes.get(‘NODE’)
- API: see documentation