air_sdk.endpoints.ztp_scripts
air_sdk.endpoints.ztp_scripts
Classes
Module Contents
Bases: air_sdk.air_model.AirModel
The ZTP (Zero Touch Provisioning) configuration of a simulation.
It holds one entry per OS type: a provisioning script for Cumulus and a ZTP JSON object for NVOS. A simulation can configure either one, or both.
ZTPScript objects should not be created directly. Use
simulation.create_ztp_script(...) instead.
When printed, the configured OS types are listed and content is truncated
to 50 characters with newlines collapsed, to avoid flooding console/logs
with large scripts. Access the full configuration via
ztp_script.ztp_configs.
Examples:
When the configuration was created.
When the configuration was last modified.
The Cumulus provisioning script, or None when Cumulus is not configured.
The configuration keyed by OS type: cumulus holds the
provisioning script and nvos the ZTP JSON object. Object keys are
returned sorted by name. None when the Air API does not support
per-OS ZTP configuration.
The simulation this configuration belongs to.
Returns the respective AirModelAPI type for this model
The current model API instance.
Update this ZTP configuration.
Send either content or ztp_configs, not both. Only the OS types sent
are written; the others are kept. Each OS type sent replaces its whole
configuration, with nothing merged inside it: to change one NVOS
section, send the complete NVOS configuration. An OS type set to None
is removed; removing the last one needs delete().
Parameters:
content– The new Cumulus provisioning script.ztp_configs– The new configuration of each OS type sent, keyed by OS type:cumulus(the provisioning script) ornvos(the ZTP JSON object), orNoneto remove that OS type.
Example:
Delete this ZTP configuration, including every OS type.
After deletion, accessing simulation.ztp_script returns None. To
remove one OS type and keep the others, set it to None with update().
Example:
Bases: air_sdk.air_model.BaseEndpointAPI[air_sdk.endpoints.ztp_scripts.ZTPScript]
Create, retrieve, update, and delete the ZTP configuration of simulations.
A ZTP configuration can also be created during import or off of Simulation
objects.
update() and patch() here don’t refresh a simulation.ztp_script read
earlier: use simulation.update_ztp_script(), or call
simulation.clear_cached_property('ztp_script') before reading it again.
Examples:
Add a ZTP configuration to a simulation that has none.
Send either content or ztp_configs, not both. The simulation must be
in the INACTIVE state.
Parameters:
simulation– The simulation object or simulation ID.content– The Cumulus provisioning script.ztp_configs– The configuration keyed by OS type:cumulus(the provisioning script) and/ornvos(the ZTP JSON object).
Returns:
The created ZTP configuration.
Raises:
AirUnexpectedResponse– If the simulation already has a ZTP configuration; useupdate()to change it.
Example:
Get the ZTP configuration for the simulation if it exists.
Parameters:
simulation– The simulation object or simulation ID.
Returns:
The ZTP configuration for the simulation.
Raises:
AirUnexpectedResponse– If the simulation doesn’t have a ZTP configuration.
Example:
Update the ZTP configuration of a simulation.
Send either content or ztp_configs, not both. Only the OS types sent
are written; the others are kept. Each OS type sent replaces its whole
configuration, with nothing merged inside it: to change one NVOS
section, send the complete NVOS configuration. An OS type set to None
is removed; removing the last one needs delete(). The simulation must
be in the INACTIVE state.
Parameters:
simulation– The simulation object or simulation ID.content– The new Cumulus provisioning script.ztp_configs– The new configuration of each OS type sent, keyed by OS type:cumulus(the provisioning script) ornvos(the ZTP JSON object), orNoneto remove that OS type.
Returns:
The updated ZTP configuration.
Examples:
Update the ZTP configuration of a simulation.
This is an alias for patch() provided for consistency with other
endpoints.
Parameters:
simulation– The simulation object or simulation ID.content– The new Cumulus provisioning script.ztp_configs– The new configuration of each OS type sent, keyed by OS type:cumulus(the provisioning script) ornvos(the ZTP JSON object), orNoneto remove that OS type.
Returns:
The updated ZTP configuration.
Examples:
Delete the ZTP configuration of a simulation, including every OS type.
After deletion, simulation.ztp_script returns None. To remove one OS
type and keep the others, set it to None with update().
Parameters:
simulation– The simulation object or simulation ID.
Examples: