Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

devaci

Python library that generates Cisco ACI configuration from Jinja2 templates + Excel/CSV inputs, and optionally pushes it to an APIC controller via Cisco's official Cobra SDK.

Pipeline: data + template → JinjaRenderer (Jinja2 → YAML dict) → CobraBuilder (dict → ConfigRequest) → output / APIC commit, orchestrated by DeployClass.

Requirements

  • Python 3.10+
  • The Cisco ACI Cobra SDK (acicobra, acimodel) — see below; it is not on PyPI.

Installation

uv sync                 # create .venv, install devaci + dev dependencies
source .venv/bin/activate

External dependency: Cobra SDK

The Cisco ACI Cobra SDK is distributed as .whl/.egg by Cisco and is not on PyPI. Download the wheels and place them in vendor/ (not tracked by git), then:

uv pip install vendor/*.whl

The importable package is cobra. This repository vendors acicobra + acimodel; other Cisco modules are optional. import devaci (and therefore the whole test suite) fails until the SDK is installed.

Quick start

from pathlib import Path

from devaci import DeployClass

aci = DeployClass(
    testing=True,                 # True = dry run, no APIC credentials prompted
    working_folder=Path.cwd(),    # base folder for templates/data/outputs
    file_output="outputs/scripts/config",   # optional: save XML/JSON
    show_output=False,            # print the rendered config to the terminal
    logging=True,                 # append results to logging_output (JSON)
)

aci.xlsx = "data/aci.xlsx"        # load every sheet into template variables
aci.template = "templates/tenant.j2"
aci.deploy()

print(aci.config)                 # rendered XML (or JSON dict)
print(aci.results)                # per-template result dicts

DeployClass accepts either a typed DeployConfig or the keyword arguments shown above:

from devaci import DeployConfig, DeployClass

config = DeployConfig(testing=True, render_to_xml=False)
aci = DeployClass(config=config)

With testing=False and no ip/username/password, the APIC credentials are prompted interactively (getpass). deploy() commits to the APIC only when every template in the run succeeded.

Templates

A template is a Jinja2 file that renders to YAML. Each top-level key maps to an ACI object class handled by CobraBuilder (fvTenant, fvAp, mcpInstPol, fabricNodeControl, ...). Values may be a list of objects or a nested mapping:

fvTenant:
  - name: {{ tenant_name }}
    descr: {{ tenant_descr }}
    status: {{ status }}

fvAp:
  - name: web
    fvRsCtx:
      tnFvCtxName: {{ vrf }}

Rendering uses a coercion-free YAML loader: YAML ints/floats/bools are kept as strings so APIC values are never mangled, and the string nan becomes "".

Template filters

Filter Example Result
bool {{ "yes" | bool }} True
range {{ "1-3,5" | range }} [1, 2, 3, 5]
nan {{ value | nan }} False when nan
split {{ "a,b" | split }} ["a", "b"]

Data inputs (XLSX / CSV)

Both aci.xlsx and aci.csv accept a filename or a list of filenames:

  • An XLSX workbook loads one variable per sheet, named after the sheet.
  • A CSV file loads one variable named after the file stem.

Each variable is a list of row dicts, so a sheet named tenants is used as {% for row in tenants %}.

Filtering

  • filters: list of values to keep, matched against the filter_by column (default tag). Rows with empty/NaN tags are always dropped.
  • filters_source_sheet: derive the filter values from a dedicated sheet. Rows where filters_condition_field (default enabled) is truthy contribute their filters_output_field (default name) as a filter value.
aci = DeployClass(
    testing=True,
    filters=["IBK-6", "IBK-7"],
    filter_by="tag",
    filters_source_sheet="OCs",       # optional
    filters_condition_field="enabled",
    filters_output_field="name",
)

Output

  • render_to_xml=True (default): config is XML (.xml); otherwise JSON (.json).
  • file_output="outputs/scripts/config": write the rendered config to disk.
  • show_output=True: pretty-print the rendered config to the terminal.
  • save_output(name) / print_output() can be called directly.

Logging

devaci uses the standard library logging module. It attaches a NullHandler on import (no output by default); opt in with the public configure_logging():

import logging
from devaci import configure_logging

configure_logging(level=logging.INFO)   # idempotent; adds one stream handler

Module loggers are exposed as devaci.<module> (e.g. devaci.deploy) and propagate to the stdlib root logger, so per-module levels can be tuned with normal logging configuration. Terminal output of rendered configuration and the APIC countdown go through the shared rich console in devaci.console.

RunLog (logging_output, default outputs/logs/logging.json) is a JSON execution history, not stdlib logging. Disable with logging=False.

Project structure

src/devaci/
├── __init__.py        # public API
├── config.py          # typed DeployConfig
├── console.py         # centralized logging + shared rich console
├── deploy.py          # DeployClass orchestrator
├── exceptions.py
├── results.py         # result dataclasses
├── _values.py         # shared value predicates (nan/empty checks)
├── inputs/            # TemplateSource + DataLoader (xlsx/csv, filters)
├── rendering/         # JinjaRenderer, filters, non-coercing YAML loader
├── output/            # OutputWriter + RunLog
├── transport/         # ApicSession (login/commit)
└── cobra/             # CobraBuilder + BUILDERS mapping

Development

uv run pytest                 # full test suite
uv run pytest --cov=devaci    # with coverage (fails under 80%)
uv run ruff check .           # lint
uv run mypy src               # typecheck (strict)

Run order when verifying a change: ruff check . → mypy src → pytest.

Publishing

uv build
uv publish

Only a PyPI release bumps the version; commits do not. See CONTRIBUTING.md.

Metadata

Release files for devaci 2.0.0a3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for devaci 2.0.0a3
File Size Uploaded Provenance Actions
devaci-2.0.0a3.tar.gz 34.7 kB Without provenance Details for devaci-2.0.0a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for devaci 2.0.0a3
File Interpreter ABI Platform Actions
devaci-2.0.0a3-py3-none-any.whl Python 3 none any Details for devaci-2.0.0a3-py3-none-any.whl

Total release size: 68.8 kB

Release files / devaci-2.0.0a3.tar.gz

Download URL devaci-2.0.0a3.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c90546cba0059d9df033e7632ac43d8a74705b4a19111c69c65202cf074d469f
BLAKE2b-256 checksum
How to use checksums
b254852e956206d3146c51e3a74c2fe8c147db83beea608bb09f6920c3cdbe63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / devaci-2.0.0a3-py3-none-any.whl

Download URL devaci-2.0.0a3-py3-none-any.whl
Size 34.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d82ae7a6c65109f4380ce285a7e809494574f8a9a958c007dd2ee0921839e723
BLAKE2b-256 checksum
How to use checksums
2b73d4cada2c4169b640c079ae74298f5c2c23120024cb90b28d33db4d631e82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for devaci 2.0.0a3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page