---
title: Air gap Features
slug: sdk/air-gap-features
docTags: 
createdAt: 2025-03-26T23:10:12.824Z
---

The `airgap_features` module builds deployment templates programmatically so you can configure a Litmus Edge instance without it ever needing to reach the internet. Useful for industrial / OT networks, customer sites with strict outbound rules, and reproducible bring-up of identical edges.

## Imports

```python
from litmussdk.airgap_features.template_creation import _airgap_template
```

The main builder is the `AirGapTemplate` class.

## Build a Template

```python
from litmussdk.airgap_features.template_creation import _airgap_template

t = _airgap_template.AirGapTemplate()

# Add devices and their tags
device = devices.list_device_by_id(device_id)
t.add_entire_devicehub_device(device)

# Add a digital twin model
t.add_digital_twin_model(model_id="...")

# Add a flow
t.add_flow(flow_id="...")

# Add an analytics group
t.add_analytics_group(group_name="default")

# Add a marketplace registry / image
t.add_marketplace_registry(registry_id="...")

# Add system settings (auth providers, certs, NTP, DNS, etc.)
t.add_system_settings()

# Generate the template payload
template = t.build()
```

The result is a JSON-serializable dict that mirrors what `system.templates.apply_template` accepts. You can save it to disk, ship it on a USB stick, then apply it on the target Edge:

```python
import json

# On the build machine:
with open("plant-floor.json", "w") as f:
    json.dump(template, f, indent=2)

# On the air-gapped Edge (with the SDK pointed at it):
from litmussdk.system import templates
with open("plant-floor.json") as f:
    templates.apply_template(json.load(f))
```

## Composing from a Live Edge

The `add_entire_devicehub_device` family of methods works against a connected source Edge. The typical flow is:

1. Run the builder against a "golden" Edge that has the configuration you want.
2. Save the generated template JSON.
3. Apply that JSON on N target Edges.

The source connection is the standard SDK default connection or an explicit `LEConnection` you pass to each `add_*` call.

## Including Flows with Their File Content

For Flows Manager, the template can include the flow file contents (so the target Edge has both the flow definition and its on-disk artifacts):

```python
flow_id = 1
flow_content = flows.download_flow_file(flow_id)        # bytes
t.add_flow(flow_id=flow_id, flow_file=flow_content)
```

:::BlockQuote
`download_flow_file` returns proper bytes as of SDK 2.6.0; prior versions silently corrupted the content via UTF-8 decode. See [Release Notes](#).
:::

## Including Marketplace Images

Marketplace images (Docker registry containers) can be embedded by reference. The target Edge must still be able to pull from the registry, or the image must be pre-loaded onto the target.

```python
t.add_marketplace_image(image_id="...", registry_id="...")
```

## License

Copyright (c) Litmus Automation Inc.
