Containerlab Orchestrator API Package¶
containerlab_orchestrator.api
¶
REST API for the containerlab_orchestrator app.
serializers
¶
REST API serializers for the containerlab_orchestrator app.
ContainerlabHostSerializer
¶
Bases: TaggedModelSerializerMixin, NautobotModelSerializer
Serializer for ContainerlabHost.
The Secrets Group shows as a reference, never as a secret value.
Source code in containerlab_orchestrator/api/serializers.py
InterfaceMappingSerializer
¶
Bases: ValidatedModelSerializer
Serializer for InterfaceMapping.
The model full_clean() checks the unique names, so a duplicate has the same error key __all__ as the model.
Source code in containerlab_orchestrator/api/serializers.py
LabNodeSerializer
¶
Bases: BaseModelSerializer
Read-only serializer for LabNode.
Source code in containerlab_orchestrator/api/serializers.py
LabOwnerSerializer
¶
Bases: BaseModelSerializer
Read-only serializer that shows a lab owner with the username and no other user data.
Source code in containerlab_orchestrator/api/serializers.py
LabSerializer
¶
Bases: TaggedModelSerializerMixin, NautobotModelSerializer
Serializer for Lab.
The model clean() checks the unique name, so a duplicate gets the name error key. The topology YAML is
not a field, because it can be large; the topology action of the lab downloads it.
Source code in containerlab_orchestrator/api/serializers.py
Meta
¶
build_nested_field(field_name, relation_info, nested_depth)
¶
Show the owner with LabOwnerSerializer at each depth from 1, with no other user data.
Source code in containerlab_orchestrator/api/serializers.py
validate(attrs)
¶
On create, make the request user the owner and set the Planned status.
Raises:
| Type | Description |
|---|---|
ValidationError
|
If the request is not a REST API request of a signed-in user, as in the CSV import job. |
Source code in containerlab_orchestrator/api/serializers.py
NodeMappingSerializer
¶
Bases: TaggedModelSerializerMixin, NautobotModelSerializer
Serializer for NodeMapping.
Source code in containerlab_orchestrator/api/serializers.py
urls
¶
REST API URL patterns for the containerlab_orchestrator app.
views
¶
REST API views for the containerlab_orchestrator app.
TOPOLOGY_RENDERERS = [renderer for renderer in api_settings.DEFAULT_RENDERER_CLASSES if renderer.format != 'csv']
module-attribute
¶
The renderers of the topology download. With no CSV renderer, a CSV request cannot rename the file.
ContainerlabHostViewSet
¶
Bases: NautobotModelViewSet
REST API viewset for ContainerlabHost.
Source code in containerlab_orchestrator/api/views.py
InterfaceMappingViewSet
¶
Bases: ModelViewSet
REST API viewset for InterfaceMapping.
Source code in containerlab_orchestrator/api/views.py
LabNodeViewSet
¶
Bases: ReadOnlyModelViewSet
Read-only REST API viewset for LabNode. The Build and Inspect jobs write the rows.
Source code in containerlab_orchestrator/api/views.py
LabViewSet
¶
Bases: NautobotModelViewSet
REST API viewset for Lab.
Source code in containerlab_orchestrator/api/views.py
topology(request, pk=None)
¶
Download the stored topology YAML of the lab as <lab>.clab.yml.
Raises:
| Type | Description |
|---|---|
NotFound
|
If the lab has no topology YAML. |
Source code in containerlab_orchestrator/api/views.py
NodeMappingViewSet
¶
Bases: NautobotModelViewSet
REST API viewset for NodeMapping.