Zosterops is a genus of passerine birds containing the typical white-eyes in the white-eye family Zosteropidae. (Source: Wikipedia)
But ZosTeroPs is a ZTP (Zero Touch Provisioning) server that aims to support provisioning of devices on different platforms from different vendors.
It's a current WIP (Work In Progress) project, but it's expected to be fully operational and to include more and more advanced features as the development progresses. I have adopted an incremental development approach: It is expected to have a minimal working platform in the early development stage, with the addition of more advanced and customizing features over the time.
ZosTeroPs is a web system developed in Python using the Django framework.
Installation is described in INSTALL.md
ZosTeroPs permits to create vendors and platforms that are used to classify firmwares.
ZosTeroPs hosts firmwares and delivers them by HTTP upon device request. When files are downloaded, SHA512 and MD5 checksums are calculated. This permits to ensure the image is not alterated. This also serves as a local registry of checksums to ensure the image has correctly been transferred to the network device, if it permits to make such verifications.
Details of a specific firmware
Configurations are template-based text files that are rendered with device-specific content such hostnames, IP addresses, firmwares, ...
Configurations is well suited for providing configuration files or data structures (for instance JSON or YAML content). Specific data are determined using one or multiple parameters added to the request URL. These parameters are compared with the key values of configuration tables.
List of defined configurations
Example of one templated-Cisco configuration. The specific values are determined
upon the MAC (the first column of the table is the key) address of the device
that has to be passed (mandatory parameter) at the end of the URL (using the
?MAC=0011.2233.4455
syntax).
Creation/edition of a configuration is easy.
When correctly requested, the configuration is rendered using the substitution data (here for the MAC 0011.2233.4455)
Configuration is also suitable to deliver configuration data, for instance, a
JSON file:
Example of one templated-JSON data file. Note that this configuration uses
preprocessor elements, such as @@FIRMWARE[2].URL@@
. This is
typically well suited to pass values such as an firmware URL download link, or a
checksum value.
Creation/edition of a data template is easy.
Example of a downloaded JSON data file for the MAC 0011.2233.4455
ZTP scripts are usually the scripts that are loaded by the device during the initial configuration process. They are generally more general than configuration as the URL to retrieve them is most of the time specified in DHCP responses.
ZosTeroPs permits to define a script template in any textual form that is
supported by the network device. ZosTeroPs permits to substitute some parameters
with different custom values. These are simple substitutions that make it easy
to set/change values. These parameters can be referenced in the template using
double curly braces. If the parameter DEBUG
is set to True
, the syntax
{{ DEBUG }}
in the template would be replaced with True
.
The parameter-value substitution has to be enabled by checking the "Render template" value and "Use parameters".
Substitution values may also be given using the URL query string (the part that comes after the page name followed by a question mark). This needs to be enabled with "Accept query string".
When both "Use parameters" and "Accept query string" are checked, parameters can overwrite query string values if both define the same name. Checking "Priority query string over arguments" makes query string values overwrite parameters when both have the same name.
In addition to parameter substitution, ZTP scripts also allows preprocessing. Preprocessing occurs in any case (independently of the checkbox values) and before parameter substitution. Both parameters and template can have preprocessor values.
The preprocessor substitutes the preprocessing elements with some values
determined by the system. Preprocessing elements are surrounded with double
at-signs, like @@ HTTP_SERVER @@
. The substitution can be performed on any
parameter or any template of the ZTP script or Configuration sections.
Supported preprocessing elements are:
CONFIG[id]
returns the name of the configuration with indexid
CONFIG[id].URL
returns the URL of the configuration with indexid
CONFIG_PATH
which returns the path after the root URL used to access the Configurations. This is equals to theZTP_CONFIG_URL
setting.FIRMWARE[id]
returns the file name for the firmware with indexid
FIRMWARE[id].URL
returns the URL for the firmware with indexid
FIRMWARE[id].SIZE
returns the file size of the firmware with indexid
FIRMWARE[id].SHA512
returns the SHA512 checksum of the firmware with indexid
FIRMWARE[id].MD5
returns the MD5 checksum of the firmware with indexid
FIRMWARE_PATH
which returns the path after the root URL used to access the firmwares. This is equals to theZTP_FIRMWARES_URL
setting.HTTP_SERVER
which returns the root URL in the formprotocol://server_name/
of the current request.PORT
which returns the TCP port of the ZosTeroPs serverPROTOCOL
which returns 'http' or 'https' depending of the protocol used for the current requestSERVER_NAME
which returns the server name (or IP address) of the ZosTeroPs server (when the server responds to multiple addresses, the name returned is the one answering the query).ZTP[id]
returns the name of the ZTP script with indexid
ZTP[id].URL
returns the URL of the ZTP script with indexid
ZTP_PATH
which returns the path after the root URL used to access the ZTP scripts. This is equals to theZTP_BOOTSTRAP_URL
setting.
Note: Unknown or syntactically incorrect preprocessing elements are ignored and left as is (understand they are not substituted).
Currently, ZosTeroPs supports English and French. Language is determined based on the user browser-settings.
History of releases is detailed in HISTORY.md
And now, give back to Caesar what belongs to Caesar: The idea of developing ZosTeroPs is consecutive to the discover of the Tim Dorssers' ZTP project. This may explain some resemblance of the GUI or some code reuse. Tim's work as well as ZosTeroPs are both under MIT license.
ZosTeroPs includes all or some part of code from the following projects:
- Tim Dorssers' ZTP: Copyright (c) 2019 Tim Dorssers
- django-auditlog: Copyright (c) 2013-2020 Jan-Jelle Kester
- jQuery: Copyright OpenJS Foundation and other contributors, https://openjsf.org/
- jsTable: Which is a fork of Jexcel, removing unused code in order to make it lighter and without confusing features (such as formulas, ...)
- jQuery Formset: Copyright (c) 2009, Stanislaus Madueke
- stayhomech: Copyright (c) 2020 Alexandre Georges for the support with multiple settings file